Buffer() Seg Faults with Ring as Input #370

Closed
xmrflipflop opened this Issue Dec 1, 2016 · 3 comments

Comments

Projects
None yet
3 participants

On boost version 1.58.0 and C++14, boost geometry buffer with strategies fails when the input geometry given is a ring. Changing the type to a polygon behaves as expected.

I don't have newer boost versions available for testing unfortunately.

Test code below.

        std::cout << "Using Boost "
                  << BOOST_VERSION / 100000     << "."  // major version
                  << BOOST_VERSION / 100 % 1000 << "."  // minor version
                  << BOOST_VERSION % 100                // patch level
                  << std::endl;

        // Set up boost geometry types
        namespace bg = boost::geometry;
        using point_type = bg::model::point<float, 2, bg::cs::cartesian>;
        using polygon_type = bg::model::polygon<point_type>;
        using ring_type = bg::model::ring<point_type>;

        // Declare strategies
        constexpr float buffer_distance = 0.5F;
        const int points_per_circle = 36;
        bg::strategy::buffer::distance_symmetric<float> distance_strategy(buffer_distance);
        bg::strategy::buffer::join_round join_strategy(points_per_circle);
        bg::strategy::buffer::end_round end_strategy(points_per_circle);
        bg::strategy::buffer::point_circle circle_strategy(points_per_circle);
        bg::strategy::buffer::side_straight side_strategy;

        bg::model::multi_polygon<polygon_type> bufferedPolygon;
        ring_type originalPolygon;
//        polygon_type originalPolygon;

        bg::append(originalPolygon, point_type { 14.4980001F, 10.5F });
        bg::append(originalPolygon, point_type { 14.4980001F, 12.420001F });
        bg::append(originalPolygon, point_type { 15.9980001F, 12.420001F });
        bg::append(originalPolygon, point_type { 15.9980001F, 10.5F });
        bg::append(originalPolygon, point_type { 14.4980001F, 10.5F });

        bg::correct(originalPolygon);

        bg::buffer(originalPolygon, bufferedPolygon, distance_strategy, side_strategy,
            join_strategy, end_strategy, circle_strategy);

xmrflipflop changed the title from Buffer Throws Abort with Ring to Buffer() Aborts with Ring as Input Dec 1, 2016

xmrflipflop changed the title from Buffer() Aborts with Ring as Input to Buffer() Seg Faults with Ring as Input Dec 1, 2016

Can confirm same behaviour with C++11 and current geometry-develop branch.

barendgehrels self-assigned this Dec 1, 2016

Collaborator

barendgehrels commented Dec 1, 2016

I can reproduce this. Will look at it next Wednesday.

Collaborator

barendgehrels commented Mar 26, 2017

Sorry, it was not next Wednesday, but (hopefully) still in time to make it for 1.64.
It is now fixed by b320ddf

awulkiew added the bug label Apr 4, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment