|
//得到新的位置
osg::Vec3 newPos1 = m_vPosition + delta;
osgUtil::IntersectVisitor ivXY;
//根据新的位置得到两条线段检测
osg::ref_ptr<osg:ineSegment> lineXY = new osg::LineSegment(newPos1,
m_vPosition);
osg::ref_ptr<osg::LineSegment> lineZ = new osg::LineSegment(newPos1+osg::Vec3(0.0f,0.0f,10.0f),
newPos1-osg::Vec3(0.0f,0.0f,10.0f)) ;
ivXY.addLineSegment(lineZ.get()) ;
ivXY.addLineSegment(lineXY.get()) ;
//结构交集检测
m_pHostViewer->getSceneData()->accept(ivXY) ;
如果要分别求这两段线段的交点坐标该用什么函数,是不是HitList里有?怎么区分是哪条线段的 |
|