When the polygon is a axis-aligned-box "POLYGON((0 0,1 0,1 1,0 1))", then union_() won't give a correct result, just empty output. Actually, union_() of any polygon should not be empty.
But if you change the polygon green from axis-aligned-box to "POLYGON((2 1.3,2.4 1.7,2.8 1.8))", then there comes out a meaningful output (not empty).
Is it a bug of boost union_()?
Many thanks
int main()
{
typedef boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double> > polygon;
polygon green, blue;
boost::geometry::read_wkt(
"POLYGON((0 0,1 0,1 1,0 1))",
green);
boost::geometry::read_wkt(
"POLYGON((2 1.3,2.4 1.7,2.8 1.8))",
blue);
std::deque<polygon> output;
boost::geometry::union_(green, blue, output);
int i = 0;
std::cout << "green && blue:" << std::endl;
BOOST_FOREACH(polygon const& p, output)
{
std::cout << i++ << ": " << boost::geometry::area(p) << std::endl;
}
return 0;
}