"I've made a few changes to osgUtil::PolytopeIntersector so that it
actually uses double precision floating point numbers everywhere (as
long as OSG_USE_FLOAT_PLANE is not defined).
I needed double precision intersections in a project I am working on.
These changes fixed the problems I was having -- this is all testing I
have done.
Notice that I have changed
osgUtil::PolytopeIntersector::Intersection's members to use doubles
(osg::Vec3d, instead of osg::Vec3). I could have added #ifdef's there
too, but I think it is better to not change the types of stuff in the
public interface depending on some preprocessor definition.
The modified files are attached. A diff also follows, for those who like it."
With the following changes from Robert Osfield:
"I've just reviewed your changes and have just tweaked them a little to
streamline them. What I have done in the PolytopeIntersector header
is add:
typedef osg::Plane::Vec3_type Vec3_type;
And then use this typedef in the definition of the vertices rather
then Vec3d as you did. Next changes were to PolytopeInteresector.cpp
where to the PolytopeIntersectorUtils defintions of the Vec3_type, and
value_type which now simply read:
typedef osg::Plane::Vec3_type Vec3_type;
typedef Vec3_type::value_type value_type;
This way I was able to complete avoid any if def's and have essential
the same implementation as you achieved. Changes now checked into
svn/trunk."
CID 11828: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member distance is not initialized in this constructor nor in any functions that it calls.
Non-static class member maxDistance is not initialized in this constructor nor in any functions that it calls.
Non-static class member numIntersectionPoints is not initialized in this constructor nor in any functions that it calls.
Non-static class member primitiveIndex is not initialized in this constructor nor in any functions that it calls.
enhanced version of PolytopeIntersector.
New features of PolytopeIntersector :
* Dimension mask: The user may specify the dimensions of the
primitives to be tested. Checking polytope-triangle and
polytope-quad intersections is rather slow so this can
be turned off.
* Reference plane: The resulting intersections are sorted
by the distance to this plane.
New memebers of PolytopeIntersector::Intersection :
* distance: Distance of localIntersectionPoint to the reference plane
* maxDistance: Maximum distance of all intersectionPoints to the
reference plane.
* intersectionPoints: The points intersecting the planes of the polytope
or points completely inside the polytope.
* localIntersectionPoint: arithmetic mean of all intersection points
* primitiveIndex: Index of the primitive that intersected
I added some more output to the example osgkeyboardmouse."