Hi houdiniks.
As an excersise I am trying to create a ray SOP but in VEX.
I manage to get all the ray intersecting stuff done.
But now I am trying to mimic the closest point mode from the ray SOP.
At the moment I made a try with brute force, basically I loop every point from the destination geometry and compare the distance against my current point, finally I get the point closer to the current point.
Theorically this should work, but I get weird results. Maybe cos VEX is executed in SIMD and then the variable storing the minimum distance is writted by several sampled points at a time?
Not sure, somebody have tried this before?
I have attached a file with the VOP SOP I am using.
thx
closest point - ray SOP in VEX
7474 4 2- lisux
- Member
- 581 posts
- Joined: July 2005
- Offline
- Simon
- Member
- 2199 posts
- Joined: July 2005
- Offline
In theory that should work, but will be painfully slow except in very simple cases.
You should look at doing this will a point cloud as that can automatically return the closest point. Of course the ray sop will actually return the closest point on a poly but once you have the closest point you could loop through the connected points and find the actually closest point on the surface.
You should look at doing this will a point cloud as that can automatically return the closest point. Of course the ray sop will actually return the closest point on a poly but once you have the closest point you could loop through the connected points and find the actually closest point on the surface.
The trick is finding just the right hammer for every screw
- lisux
- Member
- 581 posts
- Joined: July 2005
- Offline
SimonYes I have though about using a point cloud.
In theory that should work, but will be painfully slow except in very simple cases.
You should look at doing this will a point cloud as that can automatically return the closest point. Of course the ray sop will actually return the closest point on a poly but once you have the closest point you could loop through the connected points and find the actually closest point on the surface.
Can I use a regular .bgeo file as a point cloud?
Or I have to save the geometry with the .pc extension?
Still, only for curiosity, if anybody can tell me why the VOP SOP I made is not working correctly will be great.
cheers
Un saludo
Best Regards
Pablo Giménez
Best Regards
Pablo Giménez
- Simon
- Member
- 2199 posts
- Joined: July 2005
- Offline
- lisux
- Member
- 581 posts
- Joined: July 2005
- Offline
-
- Quick Links