Hi,

the "getNormalized" - methods normalize the coordinates to a range between -1 and 1.

If w is the width of your screen then normalized = -1 + (width-mousex)/width*2

(and correspondingly for the y-coordinate).

I guess that getX() gets it in screen-coordinates, but as I am not familiar with osgGA I can´t tell for sure.

You use a lineIntersector to intersect with a line (for instance the line behind the mouse-pointer into the screen), a plane intersector to intersect with a plane and a polytope (which is a set of planes, I think) to intersect with a set of planes. But I have not used a polytope Intersector yet.

Examples:
intersection of a line with a node, the familiar cow.


intersection of a plane with a node

So for the typical task of intersecting the beam behind the mouse-pointer you will use a LineSegmentIntersector or the older version, don´t know its name anymore.

Regards,

Andreas
alessandro terenzi schrieb:
I've modified my picking code to use the osgUtil::LineSegmentIntersector class as in the osgPick example (previously I was using the osgUtil::PolytopeIntersector class) and now everything works fine. Thank for your advices. BTW, what's the difference between those classes? When one is more suitable than the other?
 
Given that I'm not familiar with both those classes, I see from the picking example given in OSG Quick Start Guide, that the latter uses getXnormalized() and getYnormalized() methods of osgGA::GUIEventAdapter class instead, in the osgPick example, mouse coordinates are aquired by getX() and getY() methods... as a result my PolytopeIntersector used normalized coordinates, instead the LineSegmentIntersector uses not-normalized coordinates...maybe the picking problems I was experiencing were due to this? What is the difference in using getX() and getY() instead of getXnormalized() and getYnormalized()?
 
Thanks.
Alessandro

 
On 4/24/07, Andreas Goebel <[EMAIL PROTECTED]> wrote:

>
> Yes, I'm using osg::Viewer and I modified the picking example from
> "OpenSceneGraph Quick Start Guide" not the osgPick example. As far as
> I can understand, my picker is created within the overridden
> osgGA::GUIEventHandler::handle() method and it is executed when the
> right event (for example a mouse click...) is catched, so I suppose it
> is up to date when the point of view changes.
>
> Maybe, my menu item picking problem deals with the original picking
> problem I talked about here...ie that it works fine with vertices but
> not with the polygon those vertices describe...
>
Hi,

i´ve just tried the osgPick-sample with several models, and I don´t see
it fail on any of them.

In my own program I do play around with the projected line (behind the
mouse -xy-point) a bit to get all picks, but this is a different story.
On my machine osgPick works just fine.

Regards,

Andreas


_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/



_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to