diff --git a/include/osgUtil/PolytopeIntersector b/include/osgUtil/PolytopeIntersector index 4e2a0b4ef..e3c91ee0b 100644 --- a/include/osgUtil/PolytopeIntersector +++ b/include/osgUtil/PolytopeIntersector @@ -44,6 +44,8 @@ class OSGUTIL_EXPORT PolytopeIntersector : public Intersector * In VIEW and MODEL coordinates (clip space cube) creates a five sided polytope box that has a front face at 0.0 and sides around box xMin, yMin, xMax, yMax.*/ PolytopeIntersector(CoordinateFrame cf, double xMin, double yMin, double xMax, double yMax); + typedef osg::Plane::Vec3_type Vec3_type; + struct Intersection { Intersection(): @@ -70,9 +72,9 @@ class OSGUTIL_EXPORT PolytopeIntersector : public Intersector osg::NodePath nodePath; osg::ref_ptr drawable; osg::ref_ptr matrix; - osg::Vec3 localIntersectionPoint; ///< center of all intersection points + Vec3_type localIntersectionPoint; ///< center of all intersection points unsigned int numIntersectionPoints; - osg::Vec3 intersectionPoints[MaxNumIntesectionPoints]; + Vec3_type intersectionPoints[MaxNumIntesectionPoints]; unsigned int primitiveIndex; ///< primitive index }; diff --git a/src/osgUtil/PolytopeIntersector.cpp b/src/osgUtil/PolytopeIntersector.cpp index 2213da1a0..862c66ca2 100644 --- a/src/osgUtil/PolytopeIntersector.cpp +++ b/src/osgUtil/PolytopeIntersector.cpp @@ -24,13 +24,8 @@ using namespace osgUtil; namespace PolytopeIntersectorUtils { -#ifdef OSG_USE_FLOAT_PLANE - typedef float value_type; - typedef osg::Vec3f Vec3_type; -#else - typedef double value_type; - typedef osg::Vec3d Vec3_type; -#endif + typedef osg::Plane::Vec3_type Vec3_type; + typedef Vec3_type::value_type value_type; typedef osg::Polytope::ClippingMask PlaneMask; typedef std::vector > CandList_t; @@ -63,7 +58,7 @@ namespace PolytopeIntersectorUtils value_type _maxDistance; ///< maximum distance of intersection points from reference plane unsigned int _index; ///< primitive index unsigned int _numPoints; - osg::Vec3 _points[MaxNumIntesections]; + Vec3_type _points[MaxNumIntesections]; }; // class PolytopeIntersection typedef std::vector Intersections; @@ -590,12 +585,12 @@ void PolytopeIntersector::intersect(osgUtil::IntersectionVisitor& iv, osg::Drawa hit.drawable = drawable; hit.matrix = iv.getModelMatrix(); - osg::Vec3 center; + PolytopeIntersectorUtils::Vec3_type center; for (unsigned int i=0; i