[Boost-bugs] [Boost C++ Libraries] #12929: linestring with zero points or a single point is not equal to itself

Subject: [Boost-bugs] [Boost C++ Libraries] #12929: linestring with zero points or a single point is not equal to itself
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-03-24 11:01:32


#12929: linestring with zero points or a single point is not equal to itself
---------------------------------------+---------------------------
 Reporter: Michael Maier <m-maier@…> | Owner: barendgehrels
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: geometry
  Version: Boost 1.60.0 | Severity: Problem
 Keywords: |
---------------------------------------+---------------------------
 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.


 {{{
 #!div style="font-size: 80%"
 Example:
   {{{#!c++
 #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';
 }
   }}}
 }}}

 {{{
 #!div style="font-size: 80%"
 Output:
 {{{
 empty == empty := 0
 single_point_linestring == single_point_linestring := 0
 single_point_linestring == single_point_linestring_2 := 0
 }}}
 }}}


 {{{
 #!div style="font-size: 80%"
 Expected:
 {{{
 empty == empty := 1
 single_point_linestring == single_point_linestring := 1
 single_point_linestring == single_point_linestring_2 := 1
 }}}
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12929>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-03-24 11:07:05 UTC