Jump to content

How can I create a normal vector pointing to the nearest point...


Masoud

Recommended Posts

Hi guys,

As you can see in the image below, I have some scattered points on a grid and there are some points near a curve that are selected.

Now I need help on how to create a "Normal vector" on each scattered point, that is toward (pointed to) the nearest point to the point selection.

 

Thanks for helping.

 

VEX_01.jpg

VEX_temp_01.hip

Edited by Masoud
Link to comment
Share on other sites

you can do that with pointclouds, it's ideal for averaging out the normal directions
which is probably what you want.
 

// wrangle1
// change color by proximity to curve points
int handle = pcopen(1,"P",@P,chf("radius"),1);
if(pcnumfound(handle)>0){
    @Cd = {1,0,1};
}

// use blast nodes to separte in 2 geometries

// wrangle2
// create normals from average closest points
int handle = pcopen(1,"P",@P,chf("radius"),chi("maxpoints"));
if(pcnumfound(handle)>0){
    vector p = pcfilter(handle,"P");
    v@N = p-@P;
}


 

normal_to_points.hipnc

normals_to_points.png
> using 1 point or 40 points for position lookup

Edited by bunker
  • Like 2
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...