Modify

Opened 5 years ago

Closed 5 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)

geom_distance.patch (2.4 KB) - added by anonymous 5 years ago.

Download all attachments as: .zip

Change History (3)

Changed 5 years ago by anonymous

Attachment: geom_distance.patch added

comment:1 Changed 5 years ago by anonymous

Patch added!

comment:2 Changed 5 years ago by Barend Gehrels

Milestone: To Be DeterminedBoost 1.51.0
Resolution: fixed
Status: newclosed

Thanks for your patch (second one, sent off-list). It is applied.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Barend Gehrels.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.