I believe this part of the ArbitraryGeometry code should be rewritten.
For the UV -> XYZ path, we should just probe vertically down. This should speed up uv2xyz calls by quite a bit
To improve the XYZ -> UV path and not return NaNs as often, we should use a custom osgUtil::PolytopeIntersector instead of the line intersectors in all directions, and implement finding the closest point if the polytope intersects.
https://github.com/loopbio/FreemooVRPrivate/blob/e05ce8ab869bbda1a8bc46c8e561da98b0283bec/src/DisplaySurfaceArbitraryGeometry.cpp#L213-L238
I believe this part of the ArbitraryGeometry code should be rewritten.
osgUtil::PolytopeIntersector
instead of the line intersectors in all directions, and implement finding the closest point if the polytope intersects.