Code Red => AutoLISP (Vanilla / Visual) => Topic started by: mailmaverick on November 08, 2017, 03:45:58 AM
Title: Maximum distance between two LWPolylines
Post by: mailmaverick on November 08, 2017, 03:45:58 AM
Hi
How to find maximum distance of any two points between two LWPolylines. Both polylines are are Zero Elevation.
One way is to break any one polyline into 100 (or more) segments (points) and then loop through the points and find the minimum distance with other polyline (using vlax-curve-getClosestPointTo), storing all values in a list and then finally taking the maximum value of all the distances.
However, this approach is largely dependent upon the number of segments. Is there any other direct way to do it ?
Title: Re: Maximum distance between two LWPolylines
Post by: MickD on November 08, 2017, 04:25:28 PM
Can you post an example picture of the problem for context?
I'd probably start with the bounding boxes of both lines and see which points lie on the boundary of both boxes. You can then loop through this smaller collection of points to find the greatest distance. See below (points to use in blue circles):
Title: Re: Maximum distance between two LWPolylines
Post by: MickD on November 08, 2017, 04:27:14 PM
or perhaps even one for both?
Title: Re: Maximum distance between two LWPolylines
Post by: ronjonp on November 08, 2017, 04:39:39 PM
Don't think that will work:
Found some info on this HERE (http://www.theswamp.org/index.php?topic=42246.msg473885#msg473885) to get furthest point from a point.
Title: Re: Maximum distance between two LWPolylines
Post by: MickD on November 08, 2017, 04:49:18 PM