Opened 10 years ago
Closed 10 years ago
#7030 closed Bugs (fixed)
distance of point to linestring with cs::spherical_equatorial gives wrong result
Reported by: | anonymous | Owned by: | Barend Gehrels |
---|---|---|---|
Milestone: | Boost 1.51.0 | Component: | geometry |
Version: | Boost Development Trunk | Severity: | Problem |
Keywords: | Cc: |
Description
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.
Attachments (1)
Change History (3)
by , 10 years ago
Attachment: | geom_distance.patch added |
---|
comment:1 by , 10 years ago
comment:2 by , 10 years ago
Milestone: | To Be Determined → Boost 1.51.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Thanks for your patch (second one, sent off-list). It is applied.
Patch added!