Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75564 - trunk/boost/geometry/algorithms/detail/overlay
From: barend.gehrels_at_[hidden]
Date: 2011-11-20 06:50:07


Author: barendgehrels
Date: 2011-11-20 06:50:06 EST (Sun, 20 Nov 2011)
New Revision: 75564
URL: http://svn.boost.org/trac/boost/changeset/75564

Log:
Linestring/polygon overlay, third phase (including segments along polygon's border)
Text files modified:
   trunk/boost/geometry/algorithms/detail/overlay/follow.hpp | 48 +++++++++++++++++++--------------------
   1 files changed, 23 insertions(+), 25 deletions(-)

Modified: trunk/boost/geometry/algorithms/detail/overlay/follow.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/detail/overlay/follow.hpp (original)
+++ trunk/boost/geometry/algorithms/detail/overlay/follow.hpp 2011-11-20 06:50:06 EST (Sun, 20 Nov 2011)
@@ -64,7 +64,17 @@
     template <typename Turn, typename Operation>
     static inline bool is_entering(Turn const& turn, Operation const& op)
     {
- return op.operation == operation_intersection;
+ // (Blocked means: blocked for polygon/polygon intersection, because
+ // they are reversed. But for polygon/line it is similar to continue)
+ switch(op.operation)
+ {
+ case operation_intersection :
+ case operation_continue :
+ case operation_blocked :
+ return true;
+ }
+
+ return false;
     }
 
     template <typename Turn, typename Operation>
@@ -74,20 +84,10 @@
     {
         if (op.operation == operation_union)
         {
- if (turn.method == method_crosses)
- {
- return true;
- }
-
- if (entered)
- {
- return true;
- }
- if (first)
- {
- // Check if first point of line is inside polygon
- return geometry::within(linestring[0], polygon);
- }
+ return entered
+ || turn.method == method_crosses
+ || (first && geometry::within(linestring[0], polygon))
+ ;
         }
         return false;
     }
@@ -100,21 +100,19 @@
     {
         if (turn.method == method_crosses)
         {
+ // The normal case, this is completely covered with entering/leaving
+ // so stay out of this time consuming "within"
             return false;
         }
 
- if (op.operation == operation_intersection)
+ switch(op.operation)
         {
- if (entered)
- {
- return true;
- }
- if (first)
- {
- // Check if first point of line is inside polygon
- return geometry::within(linestring[0], polygon);
- }
+ case operation_intersection :
+ case operation_continue :
+ case operation_blocked :
+ return entered || (first && geometry::within(linestring[0], polygon));
         }
+
         return false;
     }
 


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