Boost C++ Libraries: Ticket #7030: distance of point to linestring with cs::spherical_equatorial gives wrong result https://svn.boost.org/trac10/ticket/7030 <p> The following code produces some strange results: </p> <p> typedef cs::spherical_equatorial&lt; boost::geometry::degree &gt; cs_type; typedef model::point&lt; double , 2, cs_type &gt; point_type; typedef model::linestring&lt; point_type &gt; linestring_type; </p> <p> 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 ) ); </p> <p> cout &lt;&lt; "Distance : " &lt;&lt; boost::geometry::distance( p , l ) &lt;&lt; endl; </p> <p> for( size_t i=1 ; i&lt;l.size() ; ++i ) { </p> <blockquote> <p> linestring_type l_tmp; l_tmp.push_back( l[i-1] ); l_tmp.push_back( l[i] ); cout &lt;&lt; "Point distance : " &lt;&lt; boost::geometry::distance( p , l_tmp </p> </blockquote> <p> ) &lt;&lt; endl; } </p> <p> The output is </p> <p> Distance : 0.0174373 </p> <p> Point distance : 0.0174586 Point distance : 0.0174373 </p> <p> 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. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7030 Trac 1.4.3 anonymous Wed, 27 Jun 2012 09:47:16 GMT attachment set https://svn.boost.org/trac10/ticket/7030 https://svn.boost.org/trac10/ticket/7030 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">geom_distance.patch</span> </li> </ul> Ticket anonymous Wed, 27 Jun 2012 09:47:35 GMT <link>https://svn.boost.org/trac10/ticket/7030#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7030#comment:1</guid> <description> <p> Patch added! </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Barend Gehrels</dc:creator> <pubDate>Sun, 01 Jul 2012 16:00:09 GMT</pubDate> <title>status, milestone changed; resolution set https://svn.boost.org/trac10/ticket/7030#comment:2 https://svn.boost.org/trac10/ticket/7030#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.51.0</span> </li> </ul> <p> Thanks for your patch (second one, sent off-list). It is applied. </p> Ticket