[osg-users] Intersection with 2d plane embedded in 3d

Robert Osfield robert.osfield at gmail.com
Tue May 21 04:08:30 PDT 2019


Hi Steve.

On Tue, 21 May 2019 at 10:55, Steve Hardy <osgforum at tevs.eu> wrote:
> Thanks for the reply.  I take it that quad intersection is the right approach for this problem.

Well it's a simple approach.

The "right" way would probably be to compute the ray to plane
intersection separately, though I don't know how it would tie into the
rest of your application code/usage.

> So follow-up question: what would be a good way to improve efficiency?  I know exactly which quad to intersect, but don't want intersection to test against all the other zillions of geodes in the scene.  It looks like the same node mask trick can be used with the intersection visitor, so hopefully I can use another node bit for that - although it looks like I have to turn off that bit in all except the node path from camera to quad.

The OSG's IntersectionVisitor does tests against the bounding sphere's
of the nodes in the scene graph to know whether it's worth traversing
the subgraph or not, this avoids testing much of the scene graph.  If
this isn't sufficient then you can assign KdTree's to the Geometry
leaves to accelerate intersection testing.  See the osgkdtree example.

Doing the ray to plane intersection separately from the OSG's
IntersectionVisitor would be the most efficient solution, might even
be less work given the above steps.

Robert.


More information about the osg-users mailing list