Sorry, Are you mixing debug and release libraries from OSG?
Check you are linking with either all release or all debug.

Martin

-----Original Message-----
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Martin
Naylor
Sent: 12 May 2010 17:16
To: osg-users@lists.openscenegraph.org
Subject: Re: [osg-users] problem with osgUtil::IntersectVisitor and
osg::LineSegment

Hi Oliver,
Are mixing debug and release libraries?

Regards

Martin.


-----Original Message-----
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Olivier
Martinaud
Sent: 12 May 2010 14:33
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] problem with osgUtil::IntersectVisitor and
osg::LineSegment

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

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

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

Reply via email to