[Boost-bugs] [Boost C++ Libraries] #9756: boost::geometry::union_ no result

Subject: [Boost-bugs] [Boost C++ Libraries] #9756: boost::geometry::union_ no result
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-03-07 21:27:35


#9756: boost::geometry::union_ no result
------------------------------+---------------------------
 Reporter: yurkiko.iota@… | Owner: barendgehrels
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: geometry
  Version: Boost 1.54.0 | Severity: Problem
 Keywords: union_ |
------------------------------+---------------------------
 I'm trying to merge some polygons using boost::geometry::union_ but the
 output vector is empty for some entries.

 here is an example :
 {{{
 #include <iostream>
 #include <vector>

 #include <boost/geometry.hpp>
 #include <boost/geometry/geometries/point_xy.hpp>
 #include <boost/geometry/geometries/polygon.hpp>
 #include <boost/geometry/io/wkt/wkt.hpp>

 #include <boost/foreach.hpp>

 int main()
 {
     typedef
 boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
> polygon;

 polygon green, blue;

 boost::geometry::read_wkt(
     "POLYGON((440820.110024126 4047009.80267429, 440806.545727707
 4046942.39533656, 440797.171880196 4046895.8425726, 440804.202135392
 4046888.73092639, 440813.573458131 4046935.27114371, 440827.140279322
 4047002.69102807))", green);

 boost::geometry::read_wkt(
     "POLYGON((440855.857887967 4046932.1248641, 440813.740724389
 4046942.21109839, 440806.376538684 4046935.44583646, 440848.493702262
 4046925.35960217))", blue);


 if(boost::geometry::area(green) < 0) boost::geometry::reverse(green);
 if(boost::geometry::area(blue) < 0 ) boost::geometry::reverse(blue);


 std::vector<polygon> output;
 boost::geometry::union_(green, blue, output);

 std::cout << " output size is : " << output.size() << std::endl;

 int i = 0;
 std::cout << "green || blue:" << std::endl;

 BOOST_FOREACH(polygon const& p, output)
 {
     std::cout << i++ << ": " << boost::geometry::area(p) << std::endl;
 }

 system("pause");
 return 0;
 }
 }}}
 when I drew the two polygons I obtained : (attached image)

 but the result of the code above was :

 output size is : 0

 green | | blue:

 Press any key to continue . . .

 is this a bug in this function or there is a mistake in my code ?

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