geometry icon indicating copy to clipboard operation
geometry copied to clipboard

within returns a wrong result with multi-linestrings

Open vissarion opened this issue 1 year ago • 0 comments

The following program returns true while this is clearly not the case.

#include <boost/geometry.hpp>

int main() {
    using Point = boost::geometry::model::d2::point_xy<double>;
    using Linestring = boost::geometry::model::linestring<Point>;
    using MultiLinestring = boost::geometry::model::multi_linestring<Linestring>;

    MultiLinestring ml1, ml2;
    boost::geometry::read_wkt("MULTILINESTRING((10 10, 20 20 ), (15 15 , 30 15))", ml1);
    boost::geometry::read_wkt("MULTILINESTRING((10 10, 20 20), (60 -60, 30 15))", ml2);

    std::cout << boost::geometry::within(ml2, ml1) << std::endl;

    return 0;
}

vissarion avatar Feb 05 '24 15:02 vissarion