RS Wish: implement MeshRay method

Hi @Dale,

It would be very helpful to get an equivalent of RhinoCommon MeshRay function exposed in RhinoScript.
Hope you can consider it as V7 RhinoScript methods addition.

Thanks,

–jarek

Hi @Jarek,

Just use LineMeshIntersection, as does exactly the same thing as Intersection.MeshRay.

– Dale

Hi @Dale,

I am currently using the LineMeshIntersection or PointPick, mainly to determine points on objects under cursor as visible from the camera, so Camera(eye)<>Cursor line.
The disadvantage is I usually get lots of points on mesh, including objects behind the camera, so have to filter through them to pick the closest to camera. This would be fine if not the fact that I do it for real-time acting plugins so it has to be repeated ~10-30 times/second, so sometimes tends to slow down, depending on the model.
What I was hoping for with this method, is shooting a ray from camera directly and getting the first bounce on mesh only, which is exactly what I need without a need to analyze all of the resulting points of mesh-line intersection every single time. I don’t know the code inside MeshRay but sounded promising…
What do you think?

–jarek

Like I said, the RhinoScript and RhinoCommon methods do exactly the same thing. Sorry, but I don’t know how else to help here…

– Dale

Dale, if I can read well… RhinoCommon method takes a ray (point + vector) and returns Double, which represent the very first and only collision with mesh parameter.
LineMeshIntersection returns potentially 100s of points, all along the line…

Intuitively the first one should be faster. And do a different thing, in general, no?

–jarek

No.

Intersection.MeshRay creates a line from the ray and the call the exact same intersection code that RhinoScript does, as I have said. Intersection.MeshRay may return less, but that doesn’t mean it calculates less…

– Dale

ok NOW it is clear. thanks