I wonder if there were some changes in MeshRay intersection logic since version 6?
I have some unpredictable results with sunlight calculation in my grasshopper plugin in Rhino 7. The plugin uses mesh boxes representing buildings and a bunch of vectors for sun rays. The final goal is to calculate the number of unobstructed sun rays.
The algorithm is basically following:
Extrusion ex = Extrusion.Create(crv, height, false);
var brep = ex.ToBrep();
var mesh = Mesh.CreateFromBrep(brep, MeshingParameters.FastRenderMesh);
double result = Intersection.MeshRay(mesh, ray);
Since my client started using Rhino 7 there have been some mistakes with intersection between sunlight vectors and meshes. I haven’t figured out yet where exactly the problem is but it seems to be somewhere between Extrusion.Create(), Extrusion.ToBrep() Mesh.CreateFromBrep() and MeshRay().
Is there something in particular I should pay more attention to?
It looks like moving closer to center can indeed solve this issue.
But the problem is that if you open that test file in Rhino 6 it would work fine regardless of location. And I can’t easily scale down everything in my project because all the dimensions are interconnected with other rhino and revit-plugins. Scaling would involve re-writing and debugging a lot of code.
It would also be quite inconvenient to use meters because I work with buildings and export everything to revit. The location is so off-centered because it uses GIS data with a city center as the origin. Depending on the site location buildings can be quite close to the origin as well as far away.
It’s a bit frustrating that my perfectly working Rhino 6 projects suddenly became incompatible with the new release.