[this is an edited re-post]
I've been going over the osgUtil::IntersectVisitor code trying to
understand it better. More specifically, I'm interested in how the
_intersectPoint is calculated. I've examined it and am seeing that a
_ratio value is set and that it is the linchpin to this, but I'm not
seeing where or how it is calculated (yes, it comes from thitr->first,
but where does that come from? And first looks to be a vector, not a float).
The reason I ask is that I have some picking code I'm using that is
working fine, but I don't understand it as well as I'd like. Here's what
I'm doing:
osg::Vec3 np, fp, mp;
np = osg::Vec3(x,y, 0.0f) * inverseMVPW; //(matrix calculated elsewhere)
fp = osg::Vec3(x,y, 1.0f) * inverseMVPW;
std::cout << "np: " << np << std::endl;
std::cout << "fp: " << fp << std::endl;
osg::ref_ptr<osg::LineSegment> lineSegment =
new osg::LineSegment(np,fp);
...etc, etc... (picking is working fine)
If I call hit.getWorldIntersectPoint() on a given hit I get the
world coords - everything's perfect. I just don't see how it's deriving
those world coords for a given intersection.
Notice that I'm printing out the near point and far point values. These
values, when sent to the OSG intersection testing work beautifully; they
return accurate hits reliably. However when you actually look at these
printed values, they seem to have no relation to the world coordinates.
Also, when I print out the intersect point, it's exactly what I would
expect. I just don't know how OSG is deriving that point!
Ultimately, what I need to do is to provide some z value along the np,fp
line segment and have it return the world coordinate at that z.
Currently, the world coordinate that comes back is just bizarre. I need
one that actually corresponds to the world.
I would like to understand these processes better so any insights are
appreciated.
thanks,
dave
_______________________________________________
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/