[Boost-bugs] [Boost C++ Libraries] #13593: intersects assertion failure for linestrings in spherical_equatorial coordinates

Subject: [Boost-bugs] [Boost C++ Libraries] #13593: intersects assertion failure for linestrings in spherical_equatorial coordinates
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2018-06-13 09:31:59


#13593: intersects assertion failure for linestrings in spherical_equatorial
coordinates
-------------------------------------------------+-------------------------
 Reporter: swordvetal@… | Owner: Barend
                                                 | Gehrels
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: geometry
  Version: Boost 1.67.0 | Severity: Problem
 Keywords: geometry, intersects, |
  spherical_equatorial, linestrings |
-------------------------------------------------+-------------------------
 I have found a specific case when boost::geometry::intersects fails with
 assertion "lhs.denominator() != 0" on linestrings with equal (or very
 close) segments in spherical_equatorial coordinate system. Here is the
 test example:

 {{{
 #include <iostream>

 #include <boost/geometry.hpp>
 #include <boost/geometry/geometries/linestring.hpp>
 #include <boost/geometry/geometries/point_xy.hpp>
 #include <boost/version.hpp>

 int main()
 {
     using GeoCoordSystem =
 boost::geometry::cs::spherical_equatorial<boost::geometry::degree>;
     using GeoPoint = boost::geometry::model::d2::point_xy<double,
 GeoCoordSystem>;
     boost::geometry::model::linestring<GeoPoint> line1, line2;

     boost::geometry::read_wkt("linestring(11.5800734 48.2523631, 11.580114
 48.2524051, 11.5801572 48.2524435)", line1);
     boost::geometry::read_wkt("linestring(11.5800734 48.2523631, 11.580114
 48.2524051, 11.5801572 48.2524434)", line2);

     std::cout << "Using boost v" << BOOST_VERSION << std::endl;

     const bool b = boost::geometry::intersects(line1, line2);

     std::cout << "Intersects: " << (b ? "YES" : "NO") << std::endl;

     return 0;
 }
 }}}

 Program output is the following:
 {{{
 Using boost v106700
 a.out:
 /opt/Storage/Install/boost_1_67_0/boost/geometry/policies/robustness/segment_ratio.hpp:54:
 static bool boost::geometry::detail::segment_ratio::less<Type,
 false>::apply(const Ratio&, const Ratio&) [with Ratio =
 boost::geometry::segment_ratio<double>; Type = double]: Assertion
 `lhs.denominator() != 0' failed.
 Aborted (core dumped)
 }}}

 The issue is reproducible in both boost v1.63 and latest v1.67.

-- 
Ticket URL: <https://svn.boost.org/trac10/ticket/13593>
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 : 2018-06-13 09:36:27 UTC