|
Boost : |
Subject: [boost] [geometry] distance on multiline with spherical coordinates
From: Karsten Ahnert (karsten.ahnert_at_[hidden])
Date: 2012-06-25 14:39:35
Hi,
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
This looks like a bug. The distance to the second segment can not be
smaller than that to the first one. If I change the coordinate system to
cartesian coordinates everything works as expected. Do I miss some major
points?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk