How to remove points but keep lines?
2609 12 2- Candace Sun
- Member
- 4 posts
- Joined: July 2023
- Offline
I want to remove the selected points in Figure 1 (these points have been defined in the group) but keep the lines. I hope it looks like picture 2 after removing. I tried 'remove inline points', but it didn't work as expected.
Can anyone help?
Thank you so much!
Can anyone help?
Thank you so much!
Edited by Candace Sun - Aug. 3, 2023 01:34:31
- tamte
- Member
- 8555 posts
- Joined: July 2007
- Offline
assuming your polygons are closed or if they are open that the end points are not in your point group
you can use Blast SOP and specify your group
or Delete SOP set to Points
however Facet SOP with Remove Inline Points should work in your case as well, with same assumptions
you can use Blast SOP and specify your group
or Delete SOP set to Points
however Facet SOP with Remove Inline Points should work in your case as well, with same assumptions
Edited by tamte - Aug. 1, 2023 16:03:05
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- Benyee
- Member
- 56 posts
- Joined: April 2008
- Offline
64669804In this case you can try filtering points by calculating point angles with vex.
I want to remove the selected points in Figure 1 (these points have been defined in the group) but keep the lines. I hope it looks like picture 2 after removing. I tried 'remove inline points', but it didn't work as expected.
int pts[]=expandpointgroup(0,'group1'); int nb_pts2[]; string edges='',edge; // foreach(int pt;pts) { int nb_pts[]=neighbours(0,pt); for(int i=0;i<len(nb_pts);i++) { int ingrp=inpointgroup(0,'group1',nb_pts[i]); if(!ingrp) { pop(nb_pts,i); } else push(nb_pts2,nb_pts[i]); } //printf('%d\n',len(nb_pts)); // int pt_nb0=nb_pts[0]; int pt_nb1=nb_pts[1]; vector pos0=point(0,'P',pt_nb0); vector pos1=point(0,'P',pt_nb1); vector cur_pos=point(0,'P',pt); vector dir0=normalize(pos0-cur_pos); vector dir1=normalize(pos1-cur_pos); float angle=degrees(acos(dot(dir0,dir1))); setpointattrib(0,'angle',pt,angle,'set'); if(angle>175) { setpointgroup(0,'smooth_pts',pt,1,'set'); } }
- Candace Sun
- Member
- 4 posts
- Joined: July 2023
- Offline
- tamte
- Member
- 8555 posts
- Joined: July 2007
- Offline
- mestela
- Member
- 1738 posts
- Joined: May 2006
- Offline
- mestela
- Member
- 1738 posts
- Joined: May 2006
- Offline
- Candace Sun
- Member
- 4 posts
- Joined: July 2023
- Offline
tamteThat's exactly what I want! Thank you Tomas, this is really helpful!
your outline are made of many curve segments
the best is to convert them to closed curves using PolyPath
then you can remove inline points using Facet SOP
and if you want open back up using Ends SOP
I don't know why when I added 'PolyPath' in my own file, it was displayed differently from your file, but luckily the 'Ends' solved this problem finally.
Edited by Candace Sun - Aug. 3, 2023 05:20:15
- Candace Sun
- Member
- 4 posts
- Joined: July 2023
- Offline
- khomatech
- Member
- 7 posts
- Joined: Jan. 2022
- Offline
- cncverkstad
- Member
- 117 posts
- Joined: Aug. 2017
- Offline
vector src0 = point(0,"P",hedge_srcpoint(0,@vtxnum)); vector dst0 = point(0,"P",hedge_dstpoint(0,@vtxnum)); vector dir0 = normalize(dst0-src0); int nexth = hedge_next(0,@vtxnum); vector src1 = point(0,"P",hedge_srcpoint(0,nexth)); vector dst1 = point(0,"P",hedge_dstpoint(0,nexth)); vector dir1 = normalize(dst1-src1); if(dot(dir0,dir1)>1-0.002){ removevertex(0,nexth); int pt = vertexpoint(0,nexth); int l = len(pointvertices(0,pt)); if(l<2) removepoint(0,pt); }
sec solution
int nears[] = neighbours(0, @ptnum); vector last_dir = point(0, "P", nears[0])-point(0, "P", @ptnum); vector next_dir = point(0, "P", nears[1])-point(0, "P", @ptnum); if(abs(dot(last_dir,next_dir))>0.99){ removepoint(0,@ptnum); }
Edited by cncverkstad - Aug. 22, 2023 05:56:32
Conservation of Momentum
- eaniix
- Member
- 60 posts
- Joined: Nov. 2021
- Offline
- Jikian
- Member
- 131 posts
- Joined: Aug. 2012
- Offline
eaniix
Can't you just do this?if(@N == {1, 0, 0} || @N == {0, 0, 1} || @N == {-1, 0, 0} || @N == {0, 0, -1}){
removepoint(0, @ptnum);
}
Should work since you want to remove all points that are either pointing -x/+x or -z/+z
Not the wisest to perform direct == comparisons when working with possible floating point values. Fuse > Polypath > Facet (remove inline) is the "Houdini" solution that will work regardless of orientation.
-
- Quick Links