ray minimum distance

   6283   4   0
User Avatar
Member
224 posts
Joined: 6月 2009
Offline
I am trying to use the ray node to measure the minimum distance to a set of points. To create points, I am using sphere primitives.

However, the ray nodes seems to be measuring the distance to the top of the sphere, not the center of the sphere. Any ideas why this is happening?

Attachments:
ray_min_dist.hipnc (42.6 KB)

Patrick
User Avatar
Member
512 posts
Joined: 7月 2009
Offline
first of all, the Ray SOP is used to shoot rays from each point in the direction of its normal, to either move the point to the position where the ray hits a surface or to calculate the distance between the point and its ray collision position.
In your case a) the Ray SOP seems to be the wrong way to achieve what you want and b) you didn't assign normals to the points in the first place.

I would take a different approach to this and use an attribute create SOP for this and use the distance() expression to calculate the distance between each point of the curve and the center of sphere A and then do the same for sphere B.

cheers,

Manuel
http://vimeo.com/user2522760 [vimeo.com]
http://stormbornvfx.com/ [stormbornvfx.com]
Manuel Tausch
User Avatar
Member
224 posts
Joined: 6月 2009
Offline
Thanks for the reply. I see how the distance function could be used. But if I have a lot of points (rather than just 2), then I would have to use a forEach SOP, maybe with a Sort SOP - so it gets a little more complex.

I thought the Ray SOP could also do something like this. For the “Method” parameter, I was actually using the “Minimum Distance”. The help says:

Points are placed on the closest point on the collision geometry. This method does not use point normals. Use it to shrinkwrap or project one primitive onto another.

So that sounds good. But I actually want to find the distance to the closest point (not the closest primitive). So I changed the “Entity” parameter from “Primitive” to “Points”. But I am not sure what that parameter really does?
Patrick
User Avatar
Member
512 posts
Joined: 7月 2009
Offline
well if you use the method “minimum distance” it will still try to project the points against the sphere geometry, switch on “transform points” for a second and you'll see what I mean.
Switching the entity from primitive has no effect and does certainly not do what you thought it does

If you just want to measure the closest point, just use the nearpoint() expression, it's fast and you won't need a foreach SOP - then you can calculate the distance between each pair of points.

check out the file that I attached!

Attachments:
nearPoint_and_distance_expressions.hipnc (57.0 KB)

http://vimeo.com/user2522760 [vimeo.com]
http://stormbornvfx.com/ [stormbornvfx.com]
Manuel Tausch
User Avatar
Member
224 posts
Joined: 6月 2009
Offline
Thanks! the nearpoint() function solves it all…
Patrick
  • Quick Links