Finding the point furthest away from another point?
2754 2 1- legendari
- Member
- 6 posts
- Joined: Sept. 2018
- Offline
- legendari
- Member
- 6 posts
- Joined: Sept. 2018
- Offline
Figured it out with help of friend if anyone is interested.
int pointToCheck = 0; v@opening = point(0,"P",pointToCheck); f[]@distance; for(int i = 0; i < @numpt; ++i) { v@ipoint = point(0,"P",i); @distance[i] = distance(@opening,@ipoint); } float dist = 0; int point = 0; for(int i = 0; i < @numpt; ++i) { if(dist > @distance[i]) { } else { dist = @distance[i]; point = i; } } for(int i = 0; i < @numpt; ++i) { if(i == point || i == pointToCheck) { } else { removepoint(0,i); } } setpointgroup(0, "originPoint", pointToCheck, 1, "set"); setpointgroup(0, "furthurestPoint", pointToCheck, 1, "set");
- mestela
- Member
- 1737 posts
- Joined: May 2006
- Online
Here's a brute force way!
Use nearpoints() to get a list of the nearest points. That list will be sorted nearest to furthest. Grab the last point in that list.
(edit)
Ugh, realised I'm running that same test for every point, not necessary. Swap the wrangle mode from ‘point’ to ‘detail’, so it only runs once.
Use nearpoints() to get a list of the nearest points. That list will be sorted nearest to furthest. Grab the last point in that list.
(edit)
Ugh, realised I'm running that same test for every point, not necessary. Swap the wrangle mode from ‘point’ to ‘detail’, so it only runs once.
Edited by mestela - Dec. 14, 2018 07:34:21
-
- Quick Links