Opened 6 years ago
#12929 new Bugs
linestring with zero points or a single point is not equal to itself
Reported by: | Owned by: | Barend Gehrels | |
---|---|---|---|
Milestone: | To Be Determined | Component: | geometry |
Version: | Boost 1.60.0 | Severity: | Problem |
Keywords: | Cc: |
Description
I expect a linestring with zero points or a single point is equal to itself. However, this is not the case for boost::geometry::equals
even though the documentation says
Checks if a geometry are spatially equal.
Spatially equal means that the same point set is included.
I expect a linestring with zero points to be equal to all empty point sets. I expect a linestring with a single point to be equal to all single point sets where the single points are equal.
Example:
#include <iostream> #include <boost/geometry.hpp> namespace bg = boost::geometry; using point = bg::model::point<double, 2, bg::cs::cartesian>; using linestring = bg::model::linestring<point>; int main() { linestring empty; linestring single_point_linestring {{0.0, 0.0}}; linestring single_point_linestring_2 {{0.0, 0.0}}; std::cout << "empty == empty := " << bg::equals(empty, empty) << '\n'; std::cout << "single_point_linestring == single_point_linestring := " << bg::equals(single_point_linestring, single_point_linestring) << '\n'; std::cout << "single_point_linestring == single_point_linestring_2 := " << bg::equals(single_point_linestring, single_point_linestring_2) << '\n'; }
Output:
empty == empty := 0 single_point_linestring == single_point_linestring := 0 single_point_linestring == single_point_linestring_2 := 0
Expected:
empty == empty := 1 single_point_linestring == single_point_linestring := 1 single_point_linestring == single_point_linestring_2 := 1
Note:
See TracTickets
for help on using tickets.