please tell me with this question, there is a closed polyline, is it possible to somehow find the most distant opposite lines in it?
max distance.gh (7.3 KB)
please tell me with this question, there is a closed polyline, is it possible to somehow find the most distant opposite lines in it?
Why isn’t it this? Your question needs to be defined in more detail. Grasshopper can’t guess which lines you’re talking about unless you just want to get the distance between two lines of a specific index (8-16; 3-13 in your image).
As Ftzuk mentioned, this is a bit of a manual approach if you are looking to connect segments (3)-(13) and segments (8)-(16), as they are not truly the max distance. In which case you can take this approach and manually chose which segments to evaluate and project the line along the X or Y axis.
If you are looking for the true “max distance on opposite sides” its a bit more complex and requires a different approach in which you would creating a set of all distances and only extract the longest. distance.
max distance.gh (19.5 KB)
Brute force Though it quickly gets very slow as the div points go up. WARNING!
300 points is more accurate:
Easy enough to add all the perimeter discontinuity points to the div points…
HEY In this case, if you replace divide curve with discontinuity points, the code is fast and more accurate!
max distance_2024_Jul22b.gh (18.4 KB)
Yeah that is essentially what I would do too!
OP would have to divide the segments and evaluate the distances between all points to determine the longest.
If they wanted to keep distances in the X-Y direction, they could splice our scripts together.
It just came to me that you could first find the two curves which have the furthest distance between midpoints, then divide those two curves up instead of all the curves in the list
… perhaps there are some edge cases where that would not work. I’m pondering how to acheive this with a less operationally intensive approach
Sounds good. I believe it’s this white group added to my version ‘22a’: