Wish: RhinoCommon Intersection.RayShoot mesh support


Hi Devs,

It would be great if the RhinoCommon Intersection.RayShoot method could also support meshes in addition to Breps and surfaces. I often work with urban context models, which typically come in a mesh format. Calculating reflections within these would be highly valuable for various analysis purposes (such as external sun glare etc,).



(Menno Deij - van Rijswijk) #2

A mesh object inherits from the common abstract base class GeometryBase. You can use RayShoot with a mesh afaik


I noticed this as well, so I did try using mesh(es) as geometry input. This does not raise any errors however the method always return None. For the record I implemented it using Python within a Grasshopper component. Tried assigning the input type as both “GeometryBase” or “Mesh” with no luck. The same geometry as surfaces/breps works great by the way. Also tried adding thickness to meshes, welding their vertices, making sure the normals were facing “outwards” etc.

(Menno Deij - van Rijswijk) #4

Ah, yes I see this too. With Intersection.MeshRay you can get the first intersection, but Intersection.RayShoot never succeeds.

Looking at the API docs, I see:

Only Surface and Brep objects are currently supported. Trims are ignored on Breps.

So the support for meshes would need to be added. I suppose you could code your own version using Intersection.MeshRay and calculating the specular reflection by hand, each time creating a new ray from the intersection point found.