Hi Julien-Charles,

Julien-Charles Levesque schrieb:
Hi,

I'm trying to use a PolytopeIntersector in my scene and so far I have succeeded but only by using the camera (i.e. mCamera->accept(PolyVisitor)) with a PolytopeIntersector built from x and y coordinates in window frame. However I would rather pass the visitor the root of my scene. I am doing this in a virtual reality project, and using the camera seems to complicate things a fair bit because we modify projection matrices and viewports a whole lot.
For my LineSegmentIntersector I have used 3D points in model space, which 
worked fine when visiting the root of the scene. For the PolytopeIntersector I 
am unsure how to do this... Only examples I have found so far used either 
coordinates in projection space or coordinates in window space.

Yes, the examples do not use all available constructors of PolytopeIntersector.
That is something that has been sitting on my to-do-list for a long time...

Now I have seen the CoordinateFrame MODEL or VIEW in the PolytopeIntersector 
constructor, but I am unsure as how to use it. I have seen that the Znear plane 
is fixed to 0 for MODEL and VIEW coordinate frames.. Does this mean that any 
object behind Z=0 could not be intersected?

I also have a bad feeling that building and using the PolytopeIntersector in MODEL and VIEW coordinate frames will make it just rectangular instead of pyramidal.

There are two constructors that should be suitable for your use-case:

/** Construct a PolytopeIntersector using specified polytope in
            MODEL coordinates.*/
        PolytopeIntersector(const osg::Polytope& polytope);

        /** Construct a PolytopeIntersector using specified polytope in
            specified coordinate frame.*/
        PolytopeIntersector(CoordinateFrame cf,
                            const osg::Polytope& polytope);

You can pass an arbitrary Polytope which does not have to be
rectangular.

To recapitulate : I am trying to build a polytpe intersector from one 3d point in model space (or world space) and it's orientation. I would prefer this polytope intersector to be independent from the cameras or viewports. I am stuck at this point. Am I assuming something wrong? Did I miss something that could make this simpler? Do you have any clue that could help me? Am I even making sense? :D

Try using one of the contructors above with a polytope that you
provide and use the MODEL coordinate frame. That should work.

Thank a lot,

Sincerely,
Julien-Charles

Cheers,

Peter
--
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Dr. Roland Niemeier, Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Michel Lepert
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to