Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80337 - in trunk/boost/polygon: . detail
From: lucanus.j.simonson_at_[hidden]
Date: 2012-08-31 14:17:28


Author: ljsimons
Date: 2012-08-31 14:17:28 EDT (Fri, 31 Aug 2012)
New Revision: 80337
URL: http://svn.boost.org/trac/boost/changeset/80337

Log:
fix for equivalence bug
Text files modified:
   trunk/boost/polygon/detail/polygon_set_view.hpp | 43 ++++++++++++++++++++++++---------------
   trunk/boost/polygon/polygon_set_data.hpp | 8 +-----
   2 files changed, 28 insertions(+), 23 deletions(-)

Modified: trunk/boost/polygon/detail/polygon_set_view.hpp
==============================================================================
--- trunk/boost/polygon/detail/polygon_set_view.hpp (original)
+++ trunk/boost/polygon/detail/polygon_set_view.hpp 2012-08-31 14:17:28 EDT (Fri, 31 Aug 2012)
@@ -99,26 +99,26 @@
     insert_into_view_arg(linput_, lvalue_);
     insert_into_view_arg(rinput_, rvalue_);
     polygon_45_set_data<coordinate_type> l45, r45, o45;
- if(linput_.downcast(l45) && rinput_.downcast(r45)) {
- //the op codes are screwed up between 45 and arbitrary
-#ifdef BOOST_POLYGON_MSVC
-#pragma warning (disable: 4127)
-#endif
- if(op_type < 2)
- l45.template applyAdaptiveBoolean_<op_type>(o45, r45);
- else if(op_type == 2)
- l45.template applyAdaptiveBoolean_<3>(o45, r45);
- else
- l45.template applyAdaptiveBoolean_<2>(o45, r45);
-#ifdef BOOST_POLYGON_MSVC
-#pragma warning (default: 4127)
-#endif
- output_.insert(o45);
- } else {
+// if(linput_.downcast(l45) && rinput_.downcast(r45)) {
+// //the op codes are screwed up between 45 and arbitrary
+//#ifdef BOOST_POLYGON_MSVC
+//#pragma warning (disable: 4127)
+//#endif
+// if(op_type < 2)
+// l45.template applyAdaptiveBoolean_<op_type>(o45, r45);
+// else if(op_type == 2)
+// l45.template applyAdaptiveBoolean_<3>(o45, r45);
+// else
+// l45.template applyAdaptiveBoolean_<2>(o45, r45);
+//#ifdef BOOST_POLYGON_MSVC
+//#pragma warning (default: 4127)
+//#endif
+// output_.insert(o45);
+// } else {
       arbitrary_boolean_op<coordinate_type> abo;
       abo.execute(output_, linput_.begin(), linput_.end(),
                   rinput_.begin(), rinput_.end(), op_type);
- }
+// }
   }
 
   template <typename ltype, typename rtype, int op_type>
@@ -205,6 +205,15 @@
   polygon_set_data<coordinate_type>::polygon_set_data(const polygon_set_view<ltype, rtype, op_type>& that) :
     data_(that.value().data_), dirty_(that.value().dirty_), unsorted_(that.value().unsorted_), is_45_(that.value().is_45_) {}
 
+ // equivalence operator
+ template <typename coordinate_type>
+ inline bool polygon_set_data<coordinate_type>::operator==(const polygon_set_data<coordinate_type>& p) const {
+ typedef polygon_set_data<coordinate_type> value_type;
+ value_type output_;
+ execute_boolean_op<value_type, value_type, value_type, 2>(output_, (*this), p);
+ return output_.data_.empty();
+ }
+
   template <typename ltype, typename rtype, int op_type>
   struct geometry_concept<polygon_set_view<ltype, rtype, op_type> > { typedef polygon_set_concept type; };
 }

Modified: trunk/boost/polygon/polygon_set_data.hpp
==============================================================================
--- trunk/boost/polygon/polygon_set_data.hpp (original)
+++ trunk/boost/polygon/polygon_set_data.hpp 2012-08-31 14:17:28 EDT (Fri, 31 Aug 2012)
@@ -270,12 +270,8 @@
     }
 
     // equivalence operator
- inline bool operator==(const polygon_set_data& p) const {
- clean();
- p.clean();
- return data_ == p.data_;
- }
-
+ inline bool operator==(const polygon_set_data& p) const;
+
     // inequivalence operator
     inline bool operator!=(const polygon_set_data& p) const {
       return !((*this) == p);


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk