Re: [Boost-bugs] [Boost C++ Libraries] #10421: Wrong Pt/Box distance/comparable_distance results in spherical CS

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #10421: Wrong Pt/Box distance/comparable_distance results in spherical CS
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-08-29 13:18:21


#10421: Wrong Pt/Box distance/comparable_distance results in spherical CS
-------------------------------+---------------------------
  Reporter: awulkiew | Owner: barendgehrels
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: geometry
   Version: Boost 1.56.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+---------------------------
Description changed by awulkiew:

Old description:

> distance(Pt, Box) and comparable_distance(Pt, Box) returns invalid
> results in some cases, or at least not-corresponding to the Pt/Pt
> versions. E.g. for:
>

> {{{
> point target(10.932501600000000, 59.922640600000001);
> point pt(10.7535660, 59.9131705);
> point pmin(10.187599199999999, 59.747306700000003);
> point pmax(10.753619700000000, 59.917844000000002);
> box bounding_box(pmin, pmax);
>
> bool target_inside_box = bg::covered_by(target, bounding_box);
> bool point_inside_box = bg::covered_by(pt, bounding_box);
> // the same for bg::comparable_distance()
> double dp = bg::distance(target, pt);
> double db = bg::distance(target, bounding_box);
> double dm = bg::distance(target, pmax);
> }}}
>
> The results are:
>
> {{{
> target inside box = FALSE
> point inside box = TRUE
> target to point = 0.00157408
> target to box = 0.178946
> target to max = 0.00156704
> }}}
>
> Since the point lies inside the box and target outside the box the
> distance from target to box should be smaller than from target to point.
>
> This bug affects the R-tree and is related with this ticket:
> [https://svn.boost.org/trac/boost/ticket/9759
> boost::geometry::index::rtree does not work properly
> spherical_equatorial].

New description:

 distance(Pt, Box) and comparable_distance(Pt, Box) returns invalid results
 in some cases, or at least not-corresponding to the Pt/Pt versions. E.g.
 for:


 {{{
     point target(10.932501600000000, 59.922640600000001);
     point pt(10.7535660, 59.9131705);
     point pmin(10.187599199999999, 59.747306700000003);
     point pmax(10.753619700000000, 59.917844000000002);
     box bounding_box(pmin, pmax);

     bool target_inside_box = bg::covered_by(target, bounding_box);
     bool point_inside_box = bg::covered_by(pt, bounding_box);
     // the same for bg::comparable_distance()
     double dp = bg::distance(target, pt);
     double db = bg::distance(target, bounding_box);
     double dm = bg::distance(target, pmax);
 }}}

 The results are:

 {{{
     target inside box = FALSE
     point inside box = TRUE
     target to point = 0.00157408
     target to box = 0.178946
     target to max = 0.00156704
 }}}

 Since the point lies inside the box and target outside the box the
 distance from target to box should be smaller than from target to point.

 This bug affects the R-tree and is related with this ticket:
 [https://svn.boost.org/trac/boost/ticket/9759
 boost::geometry::index::rtree does not work properly
 spherical_equatorial].

 EDIT: The algorithm uses the cartesian pythagoras_point_box strategy to
 calculate the distance.

--
-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10421#comment:1>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:16 UTC