Opened 7 years ago

Last modified 7 years ago

#11580 assigned Bugs

invalid buffer result

Reported by: Marios Visvardis <visvardis.marios@…> Owned by: Barend Gehrels
Milestone: To Be Determined Component: geometry
Version: Boost 1.59.0 Severity: Showstopper
Keywords: Cc:

Description

The following code example produces invalid results. Reducing the distance e.g. from 2.37 to 1 produces correct results. I have tested this code with boost 1.57 and boost 1.59 with the same results.

#include <boost/geometry.hpp>
#include <boost/geometry/geometries/geometries.hpp>

namespace bg = boost::geometry;

int main()
{
	typedef bg::model::point<double, 2, bg::cs::cartesian> point;
	typedef bg::model::polygon<point> polygon;

	polygon poly;
	bg::read_wkt("POLYGON((14.02 474.96,14.02 494.96,14.022 494.96,14.022 486.24,14.02 474.96))", poly);

        bg::strategy::buffer::distance_symmetric<double> distance_strategy(2.37);
	bg::strategy::buffer::side_straight side_strategy;
	bg::strategy::buffer::join_miter join_strategy;
	bg::strategy::buffer::end_flat end_strategy;
	bg::strategy::buffer::point_circle point_strategy;

	bg::model::multi_polygon<Polygon> grown;
	bg::buffer(poly, grown, distance_strategy, side_strategy, join_strategy,
			   end_strategy, point_strategy);

	std::cout << bg::wkt(grown) << std::endl;
	return 0;
}

The returned shape is:

MULTIPOLYGON(((16.39 474.96,16.3842 474.795,16.3669 474.63,16.3382 474.467,16.2982 474.307,16.2471 474.149,16.1851 473.996,16.1126 473.847,16.0299 473.704,15.9374 473.567,15.8355 473.437,15.7248 473.314,15.6058 473.199,15.4791 473.092,15.3453 472.995,15.205 472.908,15.0589 472.83,14.9078 472.763,14.7524 472.706,14.5934 472.66,14.4315 472.626,14.2677 472.603,14.1027 472.591,13.9373 472.591,13.7723 472.603,13.6085 472.626,13.4466 472.66,13.2876 472.706,13.1322 472.763,12.9811 472.83,12.835 472.908,12.6947 472.995,12.5609 473.092,12.4342 473.199,12.3152 473.314,12.2045 473.437,12.1026 473.567,12.0101 473.704,11.9274 473.847,11.8549 473.996,11.7929 474.149,11.7418 474.307,11.7018 474.467,11.6731 474.63,11.6558 474.795,11.65 474.96,11.6558 475.125,11.6731 475.29,11.7018 475.453,11.7418 475.613,11.7929 475.771,11.8549 475.924,11.9274 476.073,12.0101 476.216,12.1026 476.353,12.2045 476.483,12.3152 476.606,12.4342 476.721,12.5609 476.828,12.6947 476.925,12.835 477.012,12.9811 477.09,13.1322 477.157,13.2876 477.214,13.4466 477.26,13.6085 477.294,13.7723 477.317,13.9373 477.329,14.1027 477.329,14.2677 477.317,14.4315 477.294,14.5934 477.26,14.7524 477.214,14.9078 477.157,15.0589 477.09,15.205 477.012,15.3453 476.925,15.4791 476.828,15.6058 476.721,15.7248 476.606,15.8355 476.483,15.9374 476.353,16.0299 476.216,16.1126 476.073,16.1851 475.924,16.2471 475.771,16.2982 475.613,16.3382 475.453,16.3669 475.29,16.3842 475.125,16.39 474.96)))

Change History (1)

comment:1 by Barend Gehrels, 7 years ago

Status: newassigned

I can still reproduce this. Thanks for the report, sorry for the late reaction. Will be looked at.

Note: See TracTickets for help on using tickets.