Boost logo

Geometry :

Subject: Re: [geometry] Issue with geometry::buffer / geometry::intersects
From: joan (joan.abadie_at_[hidden])
Date: 2014-12-09 04:45:15


More precisions :

I have a workflow where I build a buffer from a single linestring.
The result polygon is self intersecting (geometry::intersects() returns
true).

Note that using the old boost::geometry::buffer_inserter<Polygon_type> (pre
1.56 boost release) works fine.
Should I make a ticket for this one ?

Here is an easier sample code :

         typedef double Coordinate_type;
        typedef boost::geometry::model::d2::point_xy<Coordinate_type,
boost::geometry::cs::cartesian> Point_type;
        typedef boost::geometry::model::polygon<Point_type, true, true>
Polygon_type;///CW closed cartesian polygon
        typedef boost::geometry::model::linestring<Point_type> LineString_type;

        LineString_type inputLineString;
        std::string st1 = "LINESTRING(44.835506434 4.393861271, 131.525179093
7.791774087, 293.465776263 5.506371843, 333.119856587 5.761837763,
372.534114486 5.773729692)";
        boost::geometry::read_wkt(st1, inputLineString);

        // Declare strategies
        const int points_per_circle = 36;
        boost::geometry::strategy::buffer::distance_symmetric<Coordinate_type>
distance_strategy(1);
        boost::geometry::strategy::buffer::join_round
join_strategy(points_per_circle);
        boost::geometry::strategy::buffer::end_round
end_strategy(points_per_circle);
        boost::geometry::strategy::buffer::point_circle
circle_strategy(points_per_circle);
        boost::geometry::strategy::buffer::side_straight side_strategy;

        // Declare output
        boost::geometry::model::multi_polygon<Polygon_type> result;

        // Do the buffer
        boost::geometry::buffer(inputLineString, result, distance_strategy,
side_strategy, join_strategy, end_strategy, circle_strategy);

        cout << "intersect : " << boost::geometry::intersects(result.front()) <<
endl;
        cout << "is_valid : " << boost::geometry::is_valid(result.front()) << endl;
        cout << "is_simple : " << boost::geometry::is_simple(result.front()) <<
endl;

--
View this message in context: http://boost-geometry.203548.n3.nabble.com/Issue-with-geometry-buffer-geometry-intersects-tp4026387p4026399.html
Sent from the Boost Geometry mailing list archive at Nabble.com.

Geometry list run by mateusz at loskot.net