UltraRenders Posted December 31, 2021 Share Posted December 31, 2021 I’m looking for a way to go about connecting points based on a min/max distance. My goal is to skip connecting the points closest to the starting point, and only connect to points within the minimum distance threshold. Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted December 31, 2021 Share Posted December 31, 2021 (edited) With SOPs: Connect adjacent pieces-node, activate length attribute. Blast node set to primitives, group field: @restlength<0.02 With VEX: float radius_min = chf('radius_min'); float radius_max = chf('radius_max'); int pts_max = chi('maximum_points'); float dists[]; int pts[] = pcfind(0, 'P', v@P, radius_max, pts_max, dists); foreach(int i; int pt; pts){ if(dists[i] > radius_min){ addprim(0, 'polyline', i@ptnum, pt); } } Edited December 31, 2021 by konstantin magnus 2 Quote Link to comment Share on other sites More sharing options...
UltraRenders Posted December 31, 2021 Author Share Posted December 31, 2021 10 minutes ago, konstantin magnus said: With SOPs: Connect adjacent pieces-node, activate length attribute. Blast node set to primitives, group field: @restlength<0.02 With VEX: float dist_min = chf('min_dist'); float dist_max = chf('max_dist'); int pts[] = nearpoints(0, v@P, dist_max); foreach(int pt; pts){ vector pos_pt = point(0, 'P', pt); float dist_pt = distance(pos_pt, v@P); if(dist_pt > dist_min){ addprim(0, 'polyline', i@ptnum, pt); } } Amazing! Thanks so much! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.