Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r70495 - branches/release/boost/polygon
From: lucanus.j.simonson_at_[hidden]
Date: 2011-03-24 02:50:08


Author: ljsimons
Date: 2011-03-24 02:50:06 EDT (Thu, 24 Mar 2011)
New Revision: 70495
URL: http://svn.boost.org/trac/boost/changeset/70495

Log:
fixed snap to 45 and general contains bugs
Text files modified:
   branches/release/boost/polygon/polygon_traits.hpp | 21 ++++++++++++++++-----
   1 files changed, 16 insertions(+), 5 deletions(-)

Modified: branches/release/boost/polygon/polygon_traits.hpp
==============================================================================
--- branches/release/boost/polygon/polygon_traits.hpp (original)
+++ branches/release/boost/polygon/polygon_traits.hpp 2011-03-24 02:50:06 EDT (Thu, 24 Mar 2011)
@@ -758,7 +758,10 @@
     if(pts.size() < 3) { pts.clear(); return; }
     Point firstPt = pts.front();
     Point prevPt = firstPt;
- std::unique(pts.begin(), pts.end());
+ typename std::vector<point_data<Unit> >::iterator endLocation = std::unique(pts.begin(), pts.end());
+ if(endLocation != pts.end()){
+ pts.resize(endLocation - pts.begin());
+ }
     if(pts.back() == pts[0]) pts.pop_back();
     //iterate over point triplets
     int numPts = pts.size();
@@ -1348,10 +1351,18 @@
           if(oabedge == 0) return consider_touch;
           if(oabedge == 1) ++above;
         } else if(x(point) == xmax) {
- Point tmppt;
- assign(tmppt, point);
- if( edge_utils<Unit>::on_above_or_below(tmppt, he) == 0 ) {
- return consider_touch;
+ if(x(point) == xmin) {
+ Unit ymin = (std::min)(y(he.first), y(he.second));
+ Unit ymax = (std::max)(y(he.first), y(he.second));
+ Unit ypt = y(point);
+ if(ypt <= ymax && ypt >= ymin)
+ return consider_touch;
+ } else {
+ Point tmppt;
+ assign(tmppt, point);
+ if( edge_utils<Unit>::on_above_or_below(tmppt, he) == 0 ) {
+ return consider_touch;
+ }
           }
         }
       }


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