|
发表于 2012-3-28 10:16:53
|
显示全部楼层
本帖最后由 vinsonxp 于 2012-3-28 11:08 编辑
比如射线求交器可以用下面的代码判断有相交,那么判断多面体与线段相交的应该怎么写?
- void PickHandler::pick(osgViewer::View* view, const osgGA::GUIEventAdapter& ea)
- {
- osgUtil::LineSegmentIntersector::Intersections intersections;
- float x = ea.getX();
- float y = ea.getY();
- if (view->computeIntersections(x,y,intersections))
- {
- for(osgUtil::LineSegmentIntersector::Intersections::iterator hitr = intersections.begin();
- hitr != intersections.end();
- ++hitr)
- {
- ....
- }
- }
- }
复制代码 |
|