Because we use the perturbation in Z trick, it is not strictly an interior test.
It tries to have decent performance, without using AABB meshes, by using an fast face retrieval:
before running location query:
the triangles are sorted by minZ
separately they sorted by maxZ
for each point:
we retrieve the triangles that share its Z position from the sorted arrays above
we cast a ray from the point towards positive X, then look for how many times we cross a triangle from the subset generated above
we return inside or outside depending on the number of intersections
This algo can deal with border cases where the ray crosses an edge between two triangles that may or may not correspond to crossing the mesh.
Because we use the perturbation in Z trick, it is not strictly an interior test. It tries to have decent performance, without using AABB meshes, by using an fast face retrieval:
This algo can deal with border cases where the ray crosses an edge between two triangles that may or may not correspond to crossing the mesh.
Its absolute performance was not judged as fantastic by Ella with 0.2ms / point :) but we don't know yet how other implementations fare. https://imagesc.zulipchat.com/#narrow/stream/391996-.5B2023-06.5D-scenery.2Bsciview-hackathon-dresden/topic/Half-edge.20data.20structure.20in.20Java