Modify

Ticket #7030 (closed Bugs: fixed)

Opened 22 months ago

Last modified 22 months ago

distance of point to linestring with cs::spherical_equatorial gives wrong result

Reported by: anonymous Owned by: barendgehrels
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

geom_distance.patch Download (2.4 KB) - added by anonymous 22 months ago.

Change History

Changed 22 months ago by anonymous

comment:1 Changed 22 months ago by anonymous

Patch added!

comment:2 Changed 22 months ago by barendgehrels

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone changed from To Be Determined to Boost 1.51.0

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

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


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

 
Note: See TracTickets for help on using tickets.