Various additions to better support view dependent overlay node, and updated wrappers

This commit is contained in:
Robert Osfield
2007-05-19 13:43:38 +00:00
parent e3747b1004
commit e37ec98748
8 changed files with 446 additions and 40 deletions

View File

@@ -216,6 +216,35 @@ class OSG_EXPORT Plane
return -1; // treat points on line as outside...
}
/** intersection test between plane and vertex list
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<Vec3d>& vertices) const
{
if (vertices.empty()) return -1;
int noAbove = 0;
int noBelow = 0;
int noOn = 0;
for(std::vector<Vec3d>::const_iterator itr=vertices.begin();
itr != vertices.end();
++itr)
{
float d = distance(*itr);
if (d>0.0f) ++noAbove;
else if (d<0.0f) ++noBelow;
else ++noOn;
}
if (noAbove>0)
{
if (noBelow>0) return 0;
else return 1;
}
return -1; // treat points on line as outside...
}
/** intersection test between plane and bounding sphere.
return 1 if the bs is completely above plane,
return 0 if the bs intersects the plane,