[Boost-bugs] [Boost C++ Libraries] #7844: bug with unrolling self intersecting polygon

Subject: [Boost-bugs] [Boost C++ Libraries] #7844: bug with unrolling self intersecting polygon
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-01-03 09:30:01


#7844: bug with unrolling self intersecting polygon
---------------------------------------------+------------------------------
 Reporter: rlepere <renaud.lepere@…> | Owner: ljsimons
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: polygon
  Version: Boost 1.52.0 | Severity: Problem
 Keywords: |
---------------------------------------------+------------------------------
 I m tring to remove loops from self intersecting polygon but the following
 example (a triangle A, B, C with some points nearly aligned between B and
 C) fails. IMHO it sould return a triangle.

 {{{
 #include <boost/polygon/polygon.hpp>
 #include <vector>
 #include <iostream>

 using namespace boost::polygon;
 using namespace std;

 typedef point_data< int > point;
 typedef vector< point > points;
 typedef polygon_set_data< int > polygon_set;
 typedef polygon_with_holes_data< int > polygon_with_holes;
 typedef vector< polygon_with_holes > polygons_with_holes;


 /*
   * A triangle A, B, C with some nearly aligned points between B and C.
   *
   * A
   * +
   * |\
   * | \
   * | \
   * | \
   * | \
   * | \
   * | \
   * | \
   * | /-+ C
   * B +---
   */
 polygon_with_holes MakeRawPolygon()
 {
      points ps;
      ps.push_back(point(-181928106,288346744)); // A
      ps.push_back(point(-15311797,-289428209)); // B
      ps.push_back(point(56093690,-270295166));
      ps.push_back(point(24502047,-278760121));
      ps.push_back(point(57745146,-269852659));
      ps.push_back(point(56791908,-270108078));
      ps.push_back(point(-14613579,-289241121));
      ps.push_back(point(82923673,-263106094)); // C
      polygon_with_holes poly;
      set_points(poly, ps.begin(), ps.end());
      return poly;
 }

 int main()
 {
      polygon_with_holes polygon(MakeRawPolygon());
      polygon_set ps;
      ps.insert(polygon);

      // first unrool
      polygons_with_holes unrolled_polygons;
      ps.get(unrolled_polygons);

      if (unrolled_polygons.size() == 0u) {
          std::cout << "error" << endl;
      }
 }


 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7844>
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:11 UTC