From d13306e885e240fca2c9e2f780e3c3c6eae136f7 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 19 Sep 2005 19:49:23 +0000 Subject: [PATCH] Added multiple intersect triangle visualization for testing purposes. --- src/osgSim/SphereSegment.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/osgSim/SphereSegment.cpp b/src/osgSim/SphereSegment.cpp index ef1c5fe59..f3defa746 100644 --- a/src/osgSim/SphereSegment.cpp +++ b/src/osgSim/SphereSegment.cpp @@ -1617,9 +1617,23 @@ struct TriangleIntersectOperator ++itr) { Triangle* tri = itr->get(); +#if 1 + RegionCounter rc; + rc.add(_regions[tri->_p1]); + rc.add(_regions[tri->_p2]); + rc.add(_regions[tri->_p3]); + int numIntersections = rc.numberOfIntersectingSurfaces(); + if (numIntersections==1) + { + tri->_e1 = addEdge(tri->_p1, tri->_p2, tri); + tri->_e2 = addEdge(tri->_p2, tri->_p3, tri); + tri->_e3 = addEdge(tri->_p1, tri->_p3, tri); + } +#else tri->_e1 = addEdge(tri->_p1, tri->_p2, tri); tri->_e2 = addEdge(tri->_p2, tri->_p3, tri); tri->_e3 = addEdge(tri->_p1, tri->_p3, tri); +#endif } osg::notify(osg::NOTICE)<<"Number of edges "<<_edges.size()<=3) ++numMore; + + if (numIntersections>=2) + { + osg::Vec3Array* newLine = new osg::Vec3Array; + newLine->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); + } + } osg::notify(osg::NOTICE)<<" numZero "<