Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58820 - sandbox/gtl/boost/polygon/detail
From: lucanus.j.simonson_at_[hidden]
Date: 2010-01-08 16:57:40


Author: ljsimons
Date: 2010-01-08 16:57:39 EST (Fri, 08 Jan 2010)
New Revision: 58820
URL: http://svn.boost.org/trac/boost/changeset/58820

Log:
fixed bug in segment intersection
Text files modified:
   sandbox/gtl/boost/polygon/detail/polygon_arbitrary_formation.hpp | 29 +----------------------------
   sandbox/gtl/boost/polygon/detail/scan_arbitrary.hpp | 10 ++++++----
   2 files changed, 7 insertions(+), 32 deletions(-)

Modified: sandbox/gtl/boost/polygon/detail/polygon_arbitrary_formation.hpp
==============================================================================
--- sandbox/gtl/boost/polygon/detail/polygon_arbitrary_formation.hpp (original)
+++ sandbox/gtl/boost/polygon/detail/polygon_arbitrary_formation.hpp 2010-01-08 16:57:39 EST (Fri, 08 Jan 2010)
@@ -730,7 +730,7 @@
           } else {
             //the segments can't cross so elm2 is on whatever side of elm1 that one of its ends is
             int pt3_oab = on_above_or_below(elm2.pt, half_edge(elm1.pt, elm1.other_pt));
- if(pt2_oab == 1)
+ if(pt3_oab == 1)
               retval = true; //elm1's point is above elm1
           }
         } else {
@@ -798,33 +798,6 @@
           }
         }
         return retval;
- typedef typename high_precision_type<Unit>::type high_precision;
- high_precision y1 = elm1.evalAtX(*x_);
- high_precision y2 = elm2.evalAtX(*x_);
- if(y1 < y2) {
- if(retval != true) {
- check(elm1, elm2);
- std::cout << "retval != true!\n";
- }
- return true;
- }
- if(y1 == y2) {
- //if justBefore is true we invert the result of the comparison of slopes
- bool result = less_slope(elm1.other_pt.get(HORIZONTAL) - elm1.pt.get(HORIZONTAL),
- elm1.other_pt.get(VERTICAL) - elm1.pt.get(VERTICAL),
- elm2.other_pt.get(HORIZONTAL) - elm2.pt.get(HORIZONTAL),
- elm2.other_pt.get(VERTICAL) - elm2.pt.get(VERTICAL));
- result = ((*justBefore_) != 0) ^ result;
- if(retval != result) {
- std::cout << "retval != result!\n";
- }
- return result;
- }
- if(retval != false) {
- check(elm1, elm2);
- std::cout << "retval != false!\n";
- }
- return false;
       }
     };
 

Modified: sandbox/gtl/boost/polygon/detail/scan_arbitrary.hpp
==============================================================================
--- sandbox/gtl/boost/polygon/detail/scan_arbitrary.hpp (original)
+++ sandbox/gtl/boost/polygon/detail/scan_arbitrary.hpp 2010-01-08 16:57:39 EST (Fri, 08 Jan 2010)
@@ -169,14 +169,16 @@
         for(typename std::vector<std::pair<half_edge, segment_id> >::iterator inner = outer;
             inner != data.end(); ++inner) {
           const half_edge& he2 = (*inner).first;
- if(have_first_y || he2.first.y() >= min_y && he2.second.y() >= min_y) {
+ if(have_first_y || (he2.first.y() >= min_y && he2.second.y() >= min_y)) {
             //at least one segment has a low y value within the range
             if(he1 == he2) continue;
- if(he2.first.get(HORIZONTAL) >=
- he1.second.get(HORIZONTAL))
+ if((std::min)(he2. first.get(HORIZONTAL),
+ he2.second.get(HORIZONTAL)) >=
+ (std::max)(he1.second.get(HORIZONTAL),
+ he1.first.get(HORIZONTAL)))
               break;
             if(he1.first == he2.first || he1.second == he2.second)
- break;
+ continue;
             Point intersection;
             if(pack_.compute_intersection(intersection, he1, he2)) {
               //their intersection point


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