[geometry] distance on multiline with spherical coordinates

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?

Hi Karsten, On 25-6-2012 20:39, Karsten Ahnert wrote:
Hi,
the following code produces some strange results:
Which version do you use? Could you try 1.50 (or Trunk)? It might be that it has been solved (possibility, I did not yet have the time to check your case). Thanks, Barend

Hi, I tried with 1.50 beta as well as with the trunk, both without success. It still produces the same results. On 06/26/2012 07:59 AM, Barend Gehrels wrote:
Hi Karsten,
On 25-6-2012 20:39, Karsten Ahnert wrote:
Hi,
the following code produces some strange results:
Which version do you use? Could you try 1.50 (or Trunk)? It might be that it has been solved (possibility, I did not yet have the time to check your case).
Thanks, Barend
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Hi Karsten, On 26-6-2012 20:08, Karsten Ahnert wrote:
On 06/26/2012 07:59 AM, Barend Gehrels wrote:
Hi Karsten,
On 25-6-2012 20:39, Karsten Ahnert wrote:
Hi,
the following code produces some strange results:
Which version do you use? Could you try 1.50 (or Trunk)? It might be that it has been solved (possibility, I did not yet have the time to check your case).
I tried with 1.50 beta as well as with the trunk, both without success. It still produces the same results.
OK, so I have to look at that. Could you file a ticket? That can be done here: https://svn.boost.org/trac/boost/ (either anonymous or you can, IIRC, register - to get updates by email automatically) I did not ask this before on this list, but as the rate of questions and reports grows and I cannot keep with it last time, it is safe to do this to avoid it being forgotten. Thanks for the report and for trying these versions. Regards, Barend

Ok, I have created a ticket. On 06/26/2012 08:29 PM, Barend Gehrels wrote:
Hi Karsten,
On 26-6-2012 20:08, Karsten Ahnert wrote:
On 06/26/2012 07:59 AM, Barend Gehrels wrote:
Hi Karsten,
On 25-6-2012 20:39, Karsten Ahnert wrote:
Hi,
the following code produces some strange results:
Which version do you use? Could you try 1.50 (or Trunk)? It might be that it has been solved (possibility, I did not yet have the time to check your case).
I tried with 1.50 beta as well as with the trunk, both without success. It still produces the same results.
OK, so I have to look at that.
Could you file a ticket? That can be done here: https://svn.boost.org/trac/boost/ (either anonymous or you can, IIRC, register - to get updates by email automatically)
I did not ask this before on this list, but as the rate of questions and reports grows and I cannot keep with it last time, it is safe to do this to avoid it being forgotten.
Thanks for the report and for trying these versions.
Regards, Barend
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
-- Dr. Karsten Ahnert Ambrosys GmbH - Gesellschaft für Management komplexer Systeme Geschwister-Scholl-Str. 63a D-14471 Potsdam Tel: +4917682001688 Fax: +493319791300 Ambrosys GmbH - Gesellschaft für Management komplexer Systems Gesellschaft mit beschränkter Haftung Sitz der Gesellschaft: Geschwister-Scholl-Str. 63a, 14471 Potsdam Registergericht: Amtsgericht Potsdam, HRB 21228 P Geschäftsführer: Dr. Karsten Ahnert, Dr. Markus Abel

Hi, I think I found the problem, see the attached patch. The projection in strategies/spherical/distance_cross_track.hpp is calculated for the line spanned by the current segment, not the segment itself. I will add the patch to the issue too. On 06/26/2012 08:29 PM, Barend Gehrels wrote:
Hi Karsten,
On 26-6-2012 20:08, Karsten Ahnert wrote:
On 06/26/2012 07:59 AM, Barend Gehrels wrote:
Hi Karsten,
On 25-6-2012 20:39, Karsten Ahnert wrote:
Hi,
the following code produces some strange results:
Which version do you use? Could you try 1.50 (or Trunk)? It might be that it has been solved (possibility, I did not yet have the time to check your case).
I tried with 1.50 beta as well as with the trunk, both without success. It still produces the same results.
OK, so I have to look at that.
Could you file a ticket? That can be done here: https://svn.boost.org/trac/boost/ (either anonymous or you can, IIRC, register - to get updates by email automatically)
I did not ask this before on this list, but as the rate of questions and reports grows and I cannot keep with it last time, it is safe to do this to avoid it being forgotten.
Thanks for the report and for trying these versions.
Regards, Barend
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Hi Karsten, On 27-6-2012 11:44, Karsten Ahnert wrote:
Hi,
I think I found the problem, see the attached patch.
The projection in strategies/spherical/distance_cross_track.hpp is calculated for the line spanned by the current segment, not the segment itself. I will add the patch to the issue too.
OK, great! I'll have a look and test, hopefully today, and will apply it. Thanks, Barend

On 27-6-2012 11:44, Karsten Ahnert wrote:
Hi,
I think I found the problem, see the attached patch.
The projection in strategies/spherical/distance_cross_track.hpp is calculated for the line spanned by the current segment, not the segment itself. I will add the patch to the issue too.
Hi Karsten, Thanks a lot. Your diagnosis was right. Your patch (the second one - sent off-list) is applied, and I added a unit test. Regards, Barend
participants (2)
-
Barend Gehrels
-
Karsten Ahnert