[Boost-bugs] [Boost C++ Libraries] #10976: Problem with polygon library versions 1.56 and 1.57

Subject: [Boost-bugs] [Boost C++ Libraries] #10976: Problem with polygon library versions 1.56 and 1.57
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-01-28 08:59:03


#10976: Problem with polygon library versions 1.56 and 1.57
---------------------------------------+----------------------
 Reporter: Uwe Keller <Uwe.Keller@…> | Owner: ljsimons
     Type: Bugs | Status: new
Milestone: Boost 1.58.0 | Component: polygon
  Version: Boost 1.56.0 | Severity: Problem
 Keywords: |
---------------------------------------+----------------------
 It seems that the problem is due to the change of polygon of boost version
 1.56. The function is question is
     insert_vertex_sequence in polygon_set_data.hpp

 In the modified function in version 1.56 the check if the data submitted
 to the function refer to a hole is missing, as well as the corresponding
 inversion of the multiplier.
 Since the attribute is_hole is still present in the argument list of the
 function I presume that the check was lost. Insertion of this check
 produces the expected results.

 --- snip --------------------------------------------------------------
     template <class iT>
     inline void insert_vertex_sequence(iT begin_vertex, iT end_vertex,
 direction_1d winding, bool is_hole) {
       if (begin_vertex == end_vertex) {
         // No edges to insert.
         return;
       }
       // Current edge endpoints.
       iT vertex0 = begin_vertex;
       iT vertex1 = begin_vertex;
       if (++vertex1 == end_vertex) {
         // No edges to insert.
         return;
       }
       int wmultiplier = (winding == COUNTERCLOCKWISE) ? 1 : -1;
       if(is_hole) wmultiplier *= -1; // <-------------------------patch
 with respect to 1.55
       dirty_ = true;
       unsorted_ = true;
       while (vertex0 != end_vertex) {
         point_type p0, p1;
         assign(p0, *vertex0);
         assign(p1, *vertex1);
         if (p0 != p1) {
           int hmultiplier = (p0.get(HORIZONTAL) == p1.get(HORIZONTAL)) ?
 -1 : 1;
           element_type elem(edge_type(p0, p1), hmultiplier * wmultiplier);
           insert_clean(elem);
         }
         ++vertex0;
         ++vertex1;
         if (vertex1 == end_vertex) {
           vertex1 = begin_vertex;
         }
       }
     }
 --- snap --------------------------------------------------------------

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10976>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:17 UTC