Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

intersection returns an extra point in the output #1235

Open
vissarion opened this issue Jan 29, 2024 · 0 comments
Open

intersection returns an extra point in the output #1235

vissarion opened this issue Jan 29, 2024 · 0 comments
Assignees

Comments

@vissarion
Copy link
Member

The following program returns an extra point in 1.84 and develop while that was not the case in 1.77

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

int main() {
    using Point = boost::geometry::model::d2::point_xy<double>;
    using MultiPoint = boost::geometry::model::multi_point<Point>;
    using Polygon = boost::geometry::model::polygon<Point, false>;
    using Linestring = boost::geometry::model::linestring<Point>;
    using MultiPolygon = boost::geometry::model::multi_polygon<Polygon>;
    using MultiLinestring = boost::geometry::model::multi_linestring<Linestring>;

    Polygon p;
    boost::geometry::read_wkt("POLYGON((6 7,18 14,-8 1,0 0,18 -8,6 7),(6 0,-4 3,5 3,6 0))", p);

    MultiPolygon mp;
    boost::geometry::read_wkt("MULTIPOLYGON(((2 3,-3 5,-10 -1,2 3)))", mp);

    std::tuple<MultiPoint, MultiLinestring, MultiPolygon> result;
    boost::geometry::intersection(p, mp, result);

    std::cout << boost::geometry::wkt(std::get<0>(result)) << std::endl;
    std::cout << boost::geometry::wkt(std::get<1>(result)) << std::endl;
    std::cout << boost::geometry::wkt(std::get<2>(result)) << std::endl;

    std::cout << boost::geometry::is_valid(p) << std::endl;
    std::cout << boost::geometry::is_valid(mp) << std::endl;
    std::cout << boost::geometry::is_valid(std::get<2>(result)) << std::endl;
}

In particular:

In 1.84

MULTIPOINT((-7.2 1.4))
MULTILINESTRING()
MULTIPOLYGON(((-5.09091 0.636364,-0.842105 2.05263,-4 3,-7.2 1.4,-7.70909 0.963636,-5.09091 0.636364)),((-1.33333 4.33333,-4 3,2 3,-1.33333 4.33333)))

In 1.77

MULTIPOINT()
MULTILINESTRING()
MULTIPOLYGON(((-5.09091 0.636364,-0.842105 2.05263,-4 3,-7.2 1.4,-7.70909 0.963636,-5.09091 0.636364)),((-1.33333 4.33333,-4 3,2 3,-1.33333 4.33333)))
@vissarion vissarion self-assigned this Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant