Boost logo

Geometry :

Subject: [geometry] polygon intersection possible issue
From: joan (joan.abadie_at_[hidden])
Date: 2013-10-24 04:57:58


Hello,

I'm trying to compute the intersection of 2 polygons that should produce a 2
polygons result.
<http://boost-geometry.203548.n3.nabble.com/file/n4025686/Capture.png>
Unfortunately my result size is 0 and should be 2.
Do I have something wrong ?

Joan

This is the code used :

        typedef double coordinate_type;
        typedef boost::geometry::model::d2::point_xy<coordinate_type> point_type;
        typedef boost::geometry::model::polygon<point_type> polygon;
        typedef boost::geometry::model::multi_polygon<polygon> multipolygon;

        polygon green, blue;

        boost::geometry::read_wkt("POLYGON((0 0,4 0,4 4, 0 4, 0 0))", green);
        boost::geometry::read_wkt("POLYGON((-2 0, 2 1, -1 2, 2 3, -2 4, -2 0))",
blue);

        multipolygon result;
        boost::geometry::intersection(green, blue, result);

        // Investigate results
        create_svg("intersect_output.svg", green, blue, result);
        cout << result.size() << endl;

--
View this message in context: http://boost-geometry.203548.n3.nabble.com/polygon-intersection-possible-issue-tp4025686.html
Sent from the Boost Geometry mailing list archive at Nabble.com.

Geometry list run by mateusz at loskot.net