Subject: [Boost-bugs] [Boost C++ Libraries] #7030: distance of point to linestring with cs::spherical_equatorial gives wrong result
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-06-26 18:40:46
#7030: distance of point to linestring with cs::spherical_equatorial gives wrong
result
-------------------------------------+--------------------------------------
Reporter: anonymous | Owner: barendgehrels
Type: Bugs | Status: new
Milestone: To Be Determined | Component: geometry
Version: Boost Development Trunk | Severity: Problem
Keywords: |
-------------------------------------+--------------------------------------
The following code produces some strange results:
typedef cs::spherical_equatorial< boost::geometry::degree > cs_type;
typedef model::point< double , 2, cs_type > point_type;
typedef model::linestring< point_type > linestring_type;
point_type p( 1.0 , 1.0 );
linestring_type l;
l.push_back( point_type( 0.0 , 2.0 ) );
l.push_back( point_type( 2.0 , 2.0 ) );
l.push_back( point_type( 4.0 , 2.0 ) );
cout << "Distance : " << boost::geometry::distance( p , l ) << endl;
for( size_t i=1 ; i<l.size() ; ++i )
{
linestring_type l_tmp;
l_tmp.push_back( l[i-1] );
l_tmp.push_back( l[i] );
cout << "Point distance : " << boost::geometry::distance( p , l_tmp
) << endl;
}
The output is
Distance : 0.0174373
Point distance : 0.0174586
Point distance : 0.0174373
The distance to the second segment can not be smaller than that to the
first one. If the the coordinate system is changed to cartesian
coordinates everything works as expected.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/7030> 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-02-16 18:50:09 UTC