Project Points to Breps

Hi there,

I am in the process of converting an old plugin that was written with the Rhino.NET SDK for Rhino 4 to Rhino 5. Since I had to remove the dependency on external libraries I thought I could go with the Rhino Commons since this will be the future.

In the old Plugin I was using the method RhUtil.RhinoProjectPointsToBreps quite often. As far as I see, there ist only the method Rhino.Geometry.Intersect.Intersection.ProjectPointsToBreps in the RhinoCommons SDK.

I am missing two big advantages of the old method:
a) It gave me information about the points that were successfully projected (a whole array of indices). Now I have to figure myself which points where successfully projected.
b) It was much faster. On my computer about 15000 projections per second versus 1300. That is more the ten times slower.

Can you give any suggestion for fast point projection with Rhino 5 and RhinoCommons? Should I use the RayShoot method? Is it as accurate? Do you have sample code to o preliminary bounding box checks in case the ray does not hit any surface?

What projection method is used by the CAM software based on Rhino, by the way?

Thank you very much. I appreciate any help.

Best regards,
Christian

Hi Christian,

Both RhUtil.RhinoProjectPointsToBreps and Rhino.Geometry.Intersect.Intersection.ProjectPointsToBreps call the same underlying Rhino C++ SDK function, which is RhinoProjectPointsToBreps(), so I don’t see why projection would be any faster or slower depending on the .NET SDK. Can you provide some sample code and geometry for me to test?

Also, we can provide an override to Rhino.Geometry.Intersect.Intersection.ProjectPointsToBreps that returns the indices of the points that hit, just like RhUtil.RhinoProjectPointsToBreps. I’ve added this to the “to-do” pile.

Hi Dale,

thank you for the quick and very informative reply. I was unaware that both functions call into the same native code. I could provide sample code, but it is really just the different method call, unless I am mixing something up. Let me look into it.

Is there any difference in the native code between Rhino 4 and Rhino 5? For example, has caching been turned of to allow for “multiple entry” thread-safety?

Can I make a PInvoke call into the SDK myself? This way I could get the same behaviour that the native function offers.

And lastly: Is RayShoot any faster while providing the same accuracy (absolute tolerance was set to 1e-6 with a model in the 10x20 mm range)?

Thank you very much.

Best regards,
Christian

No, I don’t believe the function has changed between V4 and V5.

Of course.

Both perform curve-surface intersections, so its doubtful one method performs any faster than the other. But I don’t have any data to back this up.

Hi Dale,
I enjoy working with the RhinoCommon SDK. The function overload (that returns the successfully projected indices) would still be very valuable to me. Do you have any update on when it might be available in the SDK?
Best regards,
Christian

No I don’t. Its on the list, though…

This functionality will be available in SR10