diff --git a/src/osgSim/SphereSegment.cpp b/src/osgSim/SphereSegment.cpp index 422b0e7a8..60dd7ff31 100644 --- a/src/osgSim/SphereSegment.cpp +++ b/src/osgSim/SphereSegment.cpp @@ -2324,6 +2324,7 @@ template unsigned int TriangleIntersectOperator::Polygon::computeHitEdges(TriangleIntersectOperator& tio, I intersector, SurfaceType surfaceType) { // collect all the intersecting edges + bool needToDisgardEdges = false; EdgeList hitEdges; for(EdgeList::iterator itr = _edges.begin(); itr != _edges.end(); @@ -2331,10 +2332,10 @@ unsigned int TriangleIntersectOperator::Polygon::computeHitEdges(TriangleInterse { Edge* edge = const_cast(itr->get()); if (intersector(edge)) hitEdges.push_back(edge); + if (edge->completlyOutside()) needToDisgardEdges = true; } - if (hitEdges.empty()) return 0; - + if (hitEdges.empty() && !needToDisgardEdges) return 0; unsigned int numHitEdges = hitEdges.size(); @@ -2371,16 +2372,19 @@ unsigned int TriangleIntersectOperator::Polygon::computeHitEdges(TriangleInterse { if (edge->_intersectionType==Edge::NO_INTERSECTION) { + osg::notify(osg::NOTICE)<<"accept A"<_p1Outside) { + osg::notify(osg::NOTICE)<<"accept B"<_intersectionVertexIndex, edge->_p1, edge->_intersectionEdge)); } else if (!edge->_p2Outside) { + osg::notify(osg::NOTICE)<<"accept C"<_intersectionVertexIndex, edge->_p2, edge->_intersectionEdge)); } else @@ -2391,6 +2395,10 @@ unsigned int TriangleIntersectOperator::Polygon::computeHitEdges(TriangleInterse } } + else + { + osg::notify(osg::NOTICE)<<">>>>>>>>>>>>>>> disgarding Edge. <<<<<<<<<<<<<<<"<_intersectionEdge) +#if 1 + if ((*itr)->_intersectionEdge) { edges.push_back(*itr); } @@ -2432,7 +2440,7 @@ bool TriangleIntersectOperator::Polygon::createLine(TriangleIntersectOperator& t rc.add(tio._regions[(*itr)->_p1]); rc.add(tio._regions[(*itr)->_p2]); -#if 1 + #if 1 Region::Classification classification = rc.overallClassification((*itr)->_intersectionEdge, adjacentEdge[(*itr)->_intersectionEdge]); @@ -2441,12 +2449,12 @@ bool TriangleIntersectOperator::Polygon::createLine(TriangleIntersectOperator& t // reject if outside. if (classification==Region::OUTSIDE) { - osg::notify(osg::NOTICE)<<" disgarding outside edge "<<(*itr)->_p1<<" "<<(*itr)->_p2<_p1<<" "<<(*itr)->_p2<_p1<<" "<<(*itr)->_p2<_p1<<" "<<(*itr)->_p2<_p1<<" "<<(*itr)->_p2<_intersectionEdge)) { osg::notify(osg::NOTICE)<<" accepting edge "<<(*itr)->_p1<<" "<<(*itr)->_p2<0) { -#if 1 polygon.createLine(*this, _generatedLines); -#else - osg::notify(osg::NOTICE)<<"Testing Polygon with numIntersections = "<push_back(_originalVertices[tri->_p1]+_centre); - newLine->push_back(_originalVertices[tri->_p2]+_centre); - newLine->push_back(_originalVertices[tri->_p3]+_centre); - newLine->push_back(_originalVertices[tri->_p1]+_centre); - _generatedLines.push_back(newLine); -#endif } }