From 56b7268c7213b3965544133d5f02e152c3b5501e Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sun, 3 Dec 2006 11:44:12 +0000 Subject: [PATCH] Added copying of plane to surface intersections in the osgUtil::PlaneIntersector class, and update wrappers. --- include/osgUtil/PlaneIntersector | 6 ++--- src/osgUtil/PlaneIntersector.cpp | 26 ++++++++++++++++---- src/osgWrappers/osgUtil/PlaneIntersector.cpp | 11 ++------- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/include/osgUtil/PlaneIntersector b/include/osgUtil/PlaneIntersector index 1e8034545..58dd0c4ce 100644 --- a/include/osgUtil/PlaneIntersector +++ b/include/osgUtil/PlaneIntersector @@ -55,14 +55,12 @@ class OSGUTIL_EXPORT PlaneIntersector : public Intersector }; - typedef std::set Intersections; + typedef std::vector Intersections; - inline void insertIntersection(const Intersection& intersection) { getIntersections().insert(intersection); } + inline void insertIntersection(const Intersection& intersection) { getIntersections().push_back(intersection); } inline Intersections& getIntersections() { return _parent ? _parent->_intersections : _intersections; } - inline Intersection getFirstIntersection() { Intersections& intersections = getIntersections(); return intersections.empty() ? Intersection() : *(intersections.begin()); } - public: virtual Intersector* clone(osgUtil::IntersectionVisitor& iv); diff --git a/src/osgUtil/PlaneIntersector.cpp b/src/osgUtil/PlaneIntersector.cpp index fd97d61c3..fe50c6d4e 100644 --- a/src/osgUtil/PlaneIntersector.cpp +++ b/src/osgUtil/PlaneIntersector.cpp @@ -52,6 +52,7 @@ namespace PlaneIntersectorUtils PolylineMap _startPolylineMap; PolylineMap _endPolylineMap; + void add(const osg::Vec3d& v1, const osg::Vec3d& v2) { if (v1==v2) return; @@ -339,6 +340,12 @@ namespace PlaneIntersectorUtils } + + void fuse() + { + osg::notify(osg::NOTICE)<<"supposed to be doing a fuse..."<_polyline; + new_intersection.nodePath = iv.getNodePath(); + new_intersection.drawable = drawable; + } osg::notify(osg::NOTICE)<, osgUtil::PlaneIntersector::Intersections); +TYPE_NAME_ALIAS(std::vector< osgUtil::PlaneIntersector::Intersection >, osgUtil::PlaneIntersector::Intersections); BEGIN_OBJECT_REFLECTOR(osgUtil::PlaneIntersector) I_BaseType(osgUtil::Intersector); @@ -45,10 +45,6 @@ BEGIN_OBJECT_REFLECTOR(osgUtil::PlaneIntersector) __Intersections_R1__getIntersections, "", ""); - I_Method0(osgUtil::PlaneIntersector::Intersection, getFirstIntersection, - __Intersection__getFirstIntersection, - "", - ""); I_Method1(osgUtil::Intersector *, clone, IN, osgUtil::IntersectionVisitor &, iv, __Intersector_P1__clone__osgUtil_IntersectionVisitor_R1, "", @@ -73,9 +69,6 @@ BEGIN_OBJECT_REFLECTOR(osgUtil::PlaneIntersector) __bool__containsIntersections, "", ""); - I_SimpleProperty(osgUtil::PlaneIntersector::Intersection, FirstIntersection, - __Intersection__getFirstIntersection, - 0); I_SimpleProperty(osgUtil::PlaneIntersector::Intersections &, Intersections, __Intersections_R1__getIntersections, 0); @@ -93,5 +86,5 @@ BEGIN_VALUE_REFLECTOR(osgUtil::PlaneIntersector::Intersection) I_PublicMemberProperty(osgUtil::PlaneIntersector::Intersection::Polyline, polyline); END_REFLECTOR -STD_SET_REFLECTOR(std::set< osgUtil::PlaneIntersector::Intersection >); +STD_VECTOR_REFLECTOR(std::vector< osgUtil::PlaneIntersector::Intersection >);