Find the longest distance among the points

hi, i’d like to find the longest distance among the points


I saw this post and thought about it. Please let me know if you need to fix something

Two point comps have the same input value

Have you tried flattening the Distance component output before inputting it into Bounds?

longestdistance.gh (7.4 KB)

Without seeing your data structure, I can’t help you with your specific problem …

You said the points have the same input, so you measure the distance between every point with itself = 0. To get the longest distance, you have to measure every point with all the others.

You can use interconnect points from kangaroo or my part. The part after distance can be replaced with your bounds/deconstruct domain if you want.

Just for the extra trivia, this is known as the “diameter” of a point set and there are more efficient ways to calculate it than comparing every pair of points ( which takes quadratic time)

Simplest is to filter only the points on the convex hull:


longestdistance_optimized.gh (11.0 KB)

For the 3D case there’s no native component but Convex Hull Points from MeshEdit works well http://www.food4rhino.com/app/meshedit

3 Likes

Way more elegant and efficient. Nice solution :slight_smile: