Hi,
I have trouble getting all the points that are contained in a polytope. I have
5 points and their coordinates are:
Code:
moCamPos
[0] -30628.215
[1] -126959.86
[2] 36593.875
vertices[0]
[0] 6853.2168
[1] -61593.543
[2] -118975.06
vertices[1]
[0] 5790.0107
[1] -57556.223
[2] -112859.98
vertices[2]
[0] 1168.1683
[1] -58543.223
[2] -112611.32
vertices[3]
[0] 2656.5122
[1] -62452.973
[2] -118697.02
The polytope is construct a follows:
Code:
std::vector<osg::Plane> planes;
for (int i = 1; i < vertices->size(); ++i)
{
planes.push_back(osg::Plane(moCamPos, vertices->at(i-1), vertices->at(i)));
}
planes.push_back(osg::Plane(moCamPos, vertices->at(vertices->size()-1),
vertices->at(0)));
planes.push_back(osg::Plane(vertices->at(0), vertices->at(1), vertices->at(2)));
osg::Polytope oPolyTope(planes);
Where the vertices contain the points above. When I iterate through all the
points in the model and query the polytope using contains method, it returns
false for each of them
Still, if I draw the lines corresponding to the points in question, and use the
bounding box of the geometry I do get points inside (see the attached image).
A couple of questions:
1. When constructing a polytope from a list of planes, do I have to take care
of the normal of the plane? The documentation says "When adding planes, their
normals should point inwards (into the volume)", does this apply to void
osg::Polytope::add(const osg::Plane & pl) method only?
2. Is there a better method of achieving this?
Thank you!
Cheers,
Teodor
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=45874#45874
Attachments:
http://forum.openscenegraph.org//files/intersection_102.jpg
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org