Jump to content
Sign in to follow this  
Masoud

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

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

Share this post


Link to post
Share on other sites

maybe this can be of same Help otherwise try to search For Slope example or Just describe what you want to do with them Points .. you can Use Ray also ...PArticles with Groups ..I'm more for visual motion explaining Example ..Don't know

 

new.hipnc

jk665fddffeerrr.gif

  • Like 1
  • Thanks 1

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Hi, dear Tesan and Julien,

You are excellent. Thanks for helping!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×