How to misure distance to combinations of geometries

Hi! I need some help, I’ve got 8 parallelepipeds and I want to know the reciprocal distances beetween the various possible couples of parallelepipeds. That is to say that I’ve the geometry number 1, the geometry number 2 ecc… I want to apply the “Geometry.distanceTo” to the couple 1-2, then to the couple 1-3… for the all combination.
Thanks in advance

1: List.Combinations with length set to 2, then get the first and list items in the resulting array to feed into the Geometry.DistanceTo Node. As long as you feed it polygons without too many sides (makes for more possible combinations) this should be doable.
2: toy with the Lacing and List@Level settings of the Geometry.DistanceTo Node. My results have not been consistent across different Nodes and a great deal depends on your input List Rank, but a Cross-Product Lacing and @3, @2 List@Level settings, where both inputs recieve the same list, might work.

Geometry.DistanceTo with cross product lacing should work without too much fuss. Just be sure to drop the item at the index at the level of the list (would be 0) in all cases.

Jacob, try that with an input of nested lists (OP has polygons and tests the distance between the lines of every polygon) and you might see where some more List@Level tweaking is needed. Some nodes will not replicate correctly though. Wrestling with a BoundingBox.Contains Node as we speak…

3 create a Custom Node that works for one polygon, then set that Custom Node’s Lacing to Longest.

Where did the OP indicate polygons?

Either way it’s still doable for n dimensional lists you just need to set up the levels based on the list structure you’re feeding it.

If one of you could provide a basic dynamo graph to replicate the geometries and list structure I’ll try to provide a version of the graph that works with that structure.

Good point @JacobSmall. I was referring to the Op’s parallelepipeds, trying to avoid typing it. But on reread the OP needs distances between pairs of these objects, not distances between pairs of lines insde the objects.

Ah! Well, the distances between the elements which make up the geometry is equally interesting…

I’m about to google ParallelPipeds to try and learn something new tonight. :slight_smile:

For those also learning: https://en.m.wikipedia.org/wiki/Parallelepiped

In Dynamo, this is likely a solid, but could be any one of a number of other object types.

Hi guys, thanks for the answers! I give you the dyn file so you can understand better!distance combinations.dyn|attachment (65.3 KB)

@Lucaly1994 Ideally you should try to avoid repeating nodes, as far as possible.
distance combinations.dyn (50.4 KB)

Thanks very much Vikram!

1 Like