Hello guys.
I have a VEX problem. I want learn a way to check my points have certain count of neighbors (I specify like let's say 3) within a given search radius (Donno this is correct, but something like neighborcount). If that point doesn't have certain amount of neighbors, i want to delete that point.
For example point 24 (red circle), I want to check if that point has 3 neighbors within the radius (blue circle). So it found only one. So, the point 24 will be deleted.
And I want to do this to all points (For loop type)
Can someone please help me ?
Thank you. Have a nice day.
Check if a point have any neighbors
901 2 2- Tashmika_VFX
- Member
- 1 posts
- Joined: March 2023
- Offline
- Enivob
- Member
- 2561 posts
- Joined: June 2008
- Offline
Review the docs on nearpoint and nearpoints. It should get there, along with removepoint.
https://www.sidefx.com/docs/houdini/vex/functions/nearpoints.html [www.sidefx.com]
https://www.sidefx.com/docs/houdini/vex/functions/nearpoints.html [www.sidefx.com]
Edited by Enivob - Aug. 28, 2023 14:50:08
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
- eaniix
- Member
- 60 posts
- Joined: Nov. 2021
- Offline
attribute wrangles (except detail wrangles) are forloops already anyway because eg a point wrangle executes the given code for each point.
this should solve your answer, you can use the created slider to control the search radius
this should solve your answer, you can use the created slider to control the search radius
float maxdist = chf('maxdist'); //create slider for search radius int neighbors[] = nearpoints(0, @P, maxdist); //create an array listing all neighbors within the search radius removevalue(neighbors, @ptnum); //remove itself from array int numberOfNeighbors = len(neighbors); //get number of neighbors if(numberOfNeighbors < 3){ removepoint(0, @ptnum); //delete point if it has less than 3 neighbors }
Edited by eaniix - Aug. 29, 2023 05:56:22
-
- Quick Links