Is there a way to detect and delete the points circled in red?
Notice how all non circled points have their normals aligned to the connected line? If there is no more line in the direction of the normal, I would like to delete the point.
Does anyone have an idea how to achieve this?
Removing points based on line detection
4897 7 2- lawindh
- Member
- 18 posts
- Joined: Sept. 2019
- Offline
- lawindh
- Member
- 18 posts
- Joined: Sept. 2019
- Offline
Messed around with this for a while and had an idea. I'm guessing that maybe I can use an intersect. I tried setting one up but be warned, my vex skills are that of a newbie.
What I am trying to achieve is to use the normal as my ray direction, cast a ray from each point using the lines as the intersect geo, then if nothing is detected then a -1 should be returned. Next I want to delete that point. What am I doing wrong here? Or is there a better way?
What I am trying to achieve is to use the normal as my ray direction, cast a ray from each point using the lines as the intersect geo, then if nothing is detected then a -1 should be returned. Next I want to delete that point. What am I doing wrong here? Or is there a better way?
- Konstantin Magnus
- Member
- 682 posts
- Joined: Sept. 2013
- Offline
Try deleting by normal length:
And next time please share the HIP file so people can help you more easily.
if(length(v@N) > 0.1){ removepoint(0, i@ptnum, 1); }
And next time please share the HIP file so people can help you more easily.
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
- Benjamin Lemoine
- Member
- 143 posts
- Joined: Oct. 2015
- Offline
Hello ,
you could first group by neighbors count as those point have only one
neighbourcount(0,@ptnum)<2
then iterate on this group and compare first neighbor direction with normal :
vector dir =point(0,“P”,neighbour(0,@ptnum,0))-point(0,“P”,@ptnum);
if(normalize(dir)!=normalize(v@N)){
removepoint(0,@ptnum);
}
or with a dot product to enable a little margin of error…
you could first group by neighbors count as those point have only one
neighbourcount(0,@ptnum)<2
then iterate on this group and compare first neighbor direction with normal :
vector dir =point(0,“P”,neighbour(0,@ptnum,0))-point(0,“P”,@ptnum);
if(normalize(dir)!=normalize(v@N)){
removepoint(0,@ptnum);
}
or with a dot product to enable a little margin of error…
- lawindh
- Member
- 18 posts
- Joined: Sept. 2019
- Offline
Benjamin Lemoine
Hello ,
you could first group by neighbors count as those point have only one
neighbourcount(0,@ptnum)<2
then iterate on this group and compare first neighbor direction with normal :
vector dir =point(0,“P”,neighbour(0,@ptnum,0))-point(0,“P”,@ptnum);
if(normalize(dir)!=normalize(v@N)){
removepoint(0,@ptnum);
}
or with a dot product to enable a little margin of error…
You nailed it!! This is working for me. Thanks so much. I'm a little confused on the dir vector and normalize sections, but I'll dig into them and see if I can make sense of how they are working.
Edited by lawindh - Nov. 18, 2019 15:15:01
- Benjamin Lemoine
- Member
- 143 posts
- Joined: Oct. 2015
- Offline
- lawindh
- Member
- 18 posts
- Joined: Sept. 2019
- Offline
Benjamin Lemoine
The dir vector is first neighbor position (that mean the only neighbor for extremity) minus current point position : that give a vector pointing from my position to the neighbor… So the direction of the line…
Oh yeah, that makes sense. Thanks for the explanation as well. It helps a lot.
- ThomasRunning
- Member
- 11 posts
- Joined: Dec. 2013
- Offline
-
- Quick Links