diff --git a/include/osg/Plane b/include/osg/Plane index c2b82765e..750ac4454 100644 --- a/include/osg/Plane +++ b/include/osg/Plane @@ -189,14 +189,14 @@ class OSG_EXPORT Plane return 1 if the bs is completely above plane, return 0 if the bs intersects the plane, return -1 if the bs is completely below the plane.*/ - inline int intersect(const std::vector& vertices) const + inline int intersect(const std::vector& vertices) const { if (vertices.empty()) return -1; int noAbove = 0; int noBelow = 0; int noOn = 0; - for(std::vector::const_iterator itr=vertices.begin(); + for(std::vector::const_iterator itr=vertices.begin(); itr != vertices.end(); ++itr) { @@ -229,9 +229,9 @@ class OSG_EXPORT Plane itr != vertices.end(); ++itr) { - float d = distance(*itr); - if (d>0.0f) ++noAbove; - else if (d<0.0f) ++noBelow; + double d = distance(*itr); + if (d>0.0) ++noAbove; + else if (d<0.0) ++noBelow; else ++noOn; } diff --git a/src/osgSim/OverlayNode.cpp b/src/osgSim/OverlayNode.cpp index e4d91fb81..a9f00933a 100644 --- a/src/osgSim/OverlayNode.cpp +++ b/src/osgSim/OverlayNode.cpp @@ -641,6 +641,9 @@ public: // is first edge point inside plane? if (distance_a>=0.0) newVertices.push_back(vertices[i]); + // add point to new face if point exactly on a plane + if (distance_a==0.0) newFace.vertices.push_back(vertices[i]); + // does edge intersect plane if (distance_a * distance_b<0.0) {