Investigate use of pre-computed LocalPosition in compatibleSurfaces(...)
There's potential saving operations in the compatibleSurfaces()
method.
The intersect(...)
method has the precomputed local position information mostly available, but is not requested to do the boundary check. Hence, when performing the boundary check the newly calculated global position is again translated into a local position and the boundary check is performed there.
A possibility is to optionally allow the Intersection
struct to also hold a local position which can be checked against immediately.
Edited by Andreas Salzburger