Hi,

I'm having some trouble implementing an intersection detection method. I have a 
model of a building and I'd like to get the coordinates of the intersection 
points between the model and a ray. I wrote the following code from osg samples 
online. 

        osg::LineSegment  *ls = new 
osg::LineSegment(osg::Vec3d(-5,-5,-5),osg::Vec3d(5,5,5));
        osgUtil::IntersectVisitor *iv = new osgUtil::IntersectVisitor();
        iv->addLineSegment(ls);
        iv->apply(*m_node);
        std::cout << iv->getNumHits(ls) << " intersection points (hits)." << 
std::endl; //result = 6
        osgUtil::IntersectVisitor::HitList& hitlist = iv->getHitList(ls);
        std::cout << "size : " << hitlist.size() << std::endl;
        //std::vector<osgUtil::Hit>::iterator itr = hitlist.begin();
        hitlist[0].getWorldIntersectPoint(); //causes unhandled exception...


When I execute the code I have this error : unhandled exception at 0x100042aa 
in OSGDefaultProject.exe : 0xC0000005: access violation when reading 0xfeeeff36.
The problem comes from the last line of the  code 
(getWorldIntersectionPoint()). What's weird is that the iv finds 6 points of 
intersection, so the algorithm seems to work fine. But the size of my hitlist 
is abnormally large : it says more than 4 billion !


Thank you!

Cheers,
Olivier

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=27798#27798





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to