Jump to content

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.




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);
    @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"));
    vector p = pcfilter(handle,"P");
    v@N = p-@P;



> 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.

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...