diff --git a/include/boost/polygon/polygon_traits.hpp b/include/boost/polygon/polygon_traits.hpp index e9edc34..041321d 100755 --- a/include/boost/polygon/polygon_traits.hpp +++ b/include/boost/polygon/polygon_traits.hpp @@ -758,7 +758,10 @@ namespace boost { namespace polygon{ if(pts.size() < 3) { pts.clear(); return; } Point firstPt = pts.front(); Point prevPt = firstPt; - std::unique(pts.begin(), pts.end()); + typename std::vector >::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 @@ namespace boost { namespace polygon{ if(oabedge == 0) return consider_touch; if(oabedge == 1) ++above; } else if(x(point) == xmax) { - Point tmppt; - assign(tmppt, point); - if( edge_utils::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::on_above_or_below(tmppt, he) == 0 ) { + return consider_touch; + } } } }