I wonder if anyone can replicate the following behaviour. I’m having trouble finding the first ray-mesh intersection on the surface of a round hole. The intended behaviour is reflection but as you can see below eventually all rays go inside the solid. This does not happen when the hole is comprised of planar faces.
Square hole (correct):
Round hole (incorrect):
Plan view of both solids:
What is going on:
-> Meshes are created from Breps and seem to be correct (no gaps);
-> Different meshing parameters make no difference to the result;
-> Rays are created along a specified direction;
-> Intersection with each mesh is calculated;
-> If a ray hits multiple meshes, only the closest intersection is considered;
-> Normals are checked at each intersection and flipped if necessary;
-> A new ray is drawn at the closest intersection with the reflection direction;
-> Process iterates;
-> Rays are counted on the other side of the hole.
While debugging, I realised that when the ray goes through the mesh, the code is not actually finding a hit on the round mesh, so I take it there must be a problem computing the intersections. Furthermore, this mesh “transparency” happens seemingly in a random way, some rays reflect, others go through, but once the ray finds its way inside the solid, it doesn’t come out.
It appears that this effect occurs with any kind of curved surface, the round hole case is where it is more noticeable.
Any thoughts? I’m against the ropes on this one.