Jump to content

Given two point clouds, what is the individual furthest point from them?


sessionbeer

Recommended Posts

With 5 scattered points in group A, and 5 scattered points in group B, what is the furthest point in group B from group A, not as an average, but the individually furthest point?

Sounded like an easy problem but I'm spinning wheels here. I would really appreciate some help/teachings.

Link to comment
Share on other sites

If you isolate two group of points, you can use pcfind, make the search radius like 999, and the last array element is your furthest point.

 

int closept[] = pcfind(1, "P", @P, 999, 10);

i@fartestPt = closept[-1];

 

Hope this could help.

 

Jie

Edited by jimeng20
More accurate
Link to comment
Share on other sites

Try pcfarthest() if you want. Set point group to 'B' in a point wrangle and use a sort node reversed on attribute 'dist'. It's going to be point 0 then.

int num = npointsgroup(0, 'A');
int pc = pcopen(0, 'P', v@P, 1e5, num);
f@dist = pcfarthest(pc);

 

Or if you want a detail attribute with the furthest point number try this in a point wrangle:

int num = npointsgroup(0, grp_to);
int pts_near[] = nearpoints(0, grp_from, v@P, num);
i@pt_far = pts_near[-1];
vector pos_far = point(0, 'P', i@pt_far);
f@dist = distance(v@P, pos_far);

Next point wrangle for evaluating maximum distance:

setdetailattrib(0, 'dist_max', f@dist, 'max');

Identifying furthest point by comparing against maximum distance in another point wrangle:

if(@dist == detail(0, 'dist_max', 0)){
    setdetailattrib(0, 'farthest_point', i@ptnum, 'set');
}

 

pcs_dist_max.hipnc

Link to comment
Share on other sites

Thanks for the tips! These are actually really useful.

Where I’m running into a problem now is that I think I’m understanding the algorithm behind Mitchell’s Best-Candidate. I thought I was looking for the furthest point between two sets of points, once I find that point in group B, I remove the rest and repeat the process. Somehow I don’t thinks that’s actually the right approach and instead it’s to do with radius?

If you’re interested, this is what I’m trying to replicate:

https://bl.ocks.org/mbostock/1893974

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...