|
osg:ineSegment* lineSegment=new osg::LineSegment();
osgUtil::IntersectVisitor intersectVisitor;
osgUtil::IntersectVisitor::HitList hitList;
osgUtil::Hit hit;
lineSegment->set(osg::Vec3(_beginX,_beginY,99),osg::Vec3(_beginX,_beginY,-99));
intersectVisitor.addLineSegment(lineSegment);
_theProjection->accept(intersectVisitor);
hitList=intersectVisitor.getHitList(lineSegment);
k1=hitList.size();
std::cout<<k1<<std::endl;
lineSegment->set(osg::Vec3(_beginX,_beginY+6.0,99),osg::Vec3(_beginX,_beginY+6.0,-99));
intersectVisitor.addLineSegment(lineSegment);
_theProjection->accept(intersectVisitor);
hitList=intersectVisitor.getHitList(lineSegment);
k2=hitList.size();
std::cout<<k2<<std::endl;
请教各位意下为什么k1和k2的值会一样呢?(过x,y坐标为_beginX,_beginY的线在平面_theProjection内,而过x,y坐标为_beginX,_beginY+6.0的线不在平面内,按理说k1应该为1,k2应该为0呀,为什么两个都为1),谢谢 |
|