$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r74528 - in sandbox-branches/geometry/index: boost/geometry/extensions/index boost/geometry/extensions/index/algorithms boost/geometry/extensions/index/rtree/visitors tests
From: adam.wulkiewicz_at_[hidden]
Date: 2011-09-22 19:16:21
Author: awulkiew
Date: 2011-09-22 19:16:20 EDT (Thu, 22 Sep 2011)
New Revision: 74528
URL: http://svn.boost.org/trac/boost/changeset/74528
Log:
comparable distance calculating algorithms names changed
Added:
   sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/comparable_distance_centroid.hpp   (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/comparable_distance_far.hpp   (contents, props changed)
   sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/comparable_distance_near.hpp   (contents, props changed)
Removed:
   sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/maxdist.hpp
   sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/mindist.hpp
Text files modified: 
   sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/minmaxdist.hpp  |     3 +                                       
   sandbox-branches/geometry/index/boost/geometry/extensions/index/distance_calc.hpp          |    52 +++++++++++++++++++++++---------------- 
   sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/nearest.hpp |    16 ++++++++---                             
   sandbox-branches/geometry/index/tests/additional_sizes_and_times.cpp                       |     2                                         
   sandbox-branches/geometry/index/tests/rtree_function.hpp                                   |     3 +                                       
   5 files changed, 46 insertions(+), 30 deletions(-)
Added: sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/comparable_distance_centroid.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/comparable_distance_centroid.hpp	2011-09-22 19:16:20 EDT (Thu, 22 Sep 2011)
@@ -0,0 +1,80 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Boost.Index - squared distance between point and centroid of the box or point
+//
+// Copyright 2011 Adam Wulkiewicz.
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_COMPARABLE_DISTANCE_CENTROID_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_COMPARABLE_DISTANCE_CENTROID_HPP
+
+#include <boost/geometry/extensions/index/algorithms/detail/sum_for_indexable.hpp>
+#include <boost/geometry/extensions/index/algorithms/detail/diff_abs.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail {
+
+struct comparable_distance_centroid_tag {};
+
+template <
+    typename Point,
+    typename PointIndexable,
+    size_t N>
+struct sum_for_indexable<Point, PointIndexable, point_tag, comparable_distance_centroid_tag, N>
+{
+    typedef typename geometry::default_distance_result<Point, PointIndexable>::type result_type;
+
+    inline static result_type apply(Point const& pt, PointIndexable const& i)
+    {
+        return geometry::comparable_distance(pt, i);
+    }
+};
+
+template <
+    typename Point,
+    typename BoxIndexable,
+    size_t DimensionIndex>
+struct sum_for_indexable_dimension<Point, BoxIndexable, box_tag, comparable_distance_centroid_tag, DimensionIndex>
+{
+    typedef typename geometry::default_distance_result<Point, BoxIndexable>::type result_type;
+
+    inline static result_type apply(Point const& pt, BoxIndexable const& i)
+    {
+        typedef typename index::traits::coordinate_type<Point>::type point_coord_t;
+        typedef typename index::traits::coordinate_type<BoxIndexable>::type indexable_coord_t;
+
+        point_coord_t pt_c = geometry::get<DimensionIndex>(pt);
+        indexable_coord_t ind_c_min = geometry::get<geometry::min_corner, DimensionIndex>(i);
+        indexable_coord_t ind_c_max = geometry::get<geometry::max_corner, DimensionIndex>(i);
+        
+        indexable_coord_t ind_c_avg = ind_c_min + (ind_c_max - ind_c_min) / 2;
+        // TODO: awulkiew - is (ind_c_min + ind_c_max) / 2 safe?
+
+        result_type diff = detail::diff_abs(ind_c_avg, pt_c);
+
+        return diff * diff;
+    }
+};
+
+} // namespace detail
+
+template <typename Point, typename Indexable>
+typename geometry::default_distance_result<Point, Indexable>::type
+comparable_distance_centroid(Point const& pt, Indexable const& i)
+{
+    return detail::sum_for_indexable<
+        Point,
+        Indexable,
+        typename index::traits::tag<Indexable>::type,
+        detail::comparable_distance_centroid_tag,
+        index::traits::dimension<Indexable>::value
+    >::apply(pt, i);
+}
+
+}}} // namespace boost::geometry::index
+
+#endif // #define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_COMPARABLE_DISTANCE_CENTROID_HPP
+
Added: sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/comparable_distance_far.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/comparable_distance_far.hpp	2011-09-22 19:16:20 EDT (Thu, 22 Sep 2011)
@@ -0,0 +1,69 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Boost.Index - squared distance between point and furthest point of the box or point
+//
+// Copyright 2011 Adam Wulkiewicz.
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_COMPARABLE_DISTANCE_FAR_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_COMPARABLE_DISTANCE_FAR_HPP
+
+#include <boost/geometry/extensions/index/algorithms/detail/diff_abs.hpp>
+#include <boost/geometry/extensions/index/algorithms/detail/sum_for_indexable.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail {
+
+// minmaxdist component
+
+struct comparable_distance_far_tag {};
+
+template <
+    typename Point,
+    typename BoxIndexable,
+    size_t DimensionIndex>
+struct sum_for_indexable_dimension<Point, BoxIndexable, box_tag, comparable_distance_far_tag, DimensionIndex>
+{
+    typedef typename geometry::default_distance_result<Point, BoxIndexable>::type result_type;
+
+    inline static result_type apply(Point const& pt, BoxIndexable const& i)
+    {
+        typedef typename index::traits::coordinate_type<Point>::type point_coord_t;
+        typedef typename index::traits::coordinate_type<BoxIndexable>::type indexable_coord_t;
+
+        point_coord_t pt_c = geometry::get<DimensionIndex>(pt);
+        indexable_coord_t ind_c_min = geometry::get<geometry::min_corner, DimensionIndex>(i);
+        indexable_coord_t ind_c_max = geometry::get<geometry::max_corner, DimensionIndex>(i);
+
+        result_type further_diff = 0;
+
+        if ( (ind_c_min + ind_c_max) / 2 <= pt_c )
+            further_diff = pt_c - ind_c_min;
+        else
+            further_diff = detail::diff_abs(pt_c, ind_c_max); // unsigned values protection
+
+        return further_diff * further_diff;
+    }
+};
+
+} // namespace detail
+
+template <typename Point, typename Indexable>
+typename geometry::default_distance_result<Point, Indexable>::type
+comparable_distance_far(Point const& pt, Indexable const& i)
+{
+    return detail::sum_for_indexable<
+        Point,
+        Indexable,
+        typename index::traits::tag<Indexable>::type,
+        detail::comparable_distance_far_tag,
+        index::traits::dimension<Indexable>::value
+    >::apply(pt, i);
+}
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_COMPARABLE_DISTANCE_FAR_HPP
Added: sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/comparable_distance_near.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/comparable_distance_near.hpp	2011-09-22 19:16:20 EDT (Thu, 22 Sep 2011)
@@ -0,0 +1,80 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Boost.Index - squared distance between point and nearest point of the box or point
+//
+// Copyright 2011 Adam Wulkiewicz.
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_COMPARABLE_DISTANCE_NEAR_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_COMPARABLE_DISTANCE_NEAR_HPP
+
+#include <boost/geometry/extensions/index/algorithms/detail/sum_for_indexable.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail {
+
+struct comparable_distance_near_tag {};
+
+template <
+    typename Point,
+    typename PointIndexable,
+    size_t N>
+struct sum_for_indexable<Point, PointIndexable, point_tag, comparable_distance_near_tag, N>
+{
+    typedef typename geometry::default_distance_result<Point, PointIndexable>::type result_type;
+
+    inline static result_type apply(Point const& pt, PointIndexable const& i)
+    {
+        return geometry::comparable_distance(pt, i);
+    }
+};
+
+template <
+    typename Point,
+    typename BoxIndexable,
+    size_t DimensionIndex>
+struct sum_for_indexable_dimension<Point, BoxIndexable, box_tag, comparable_distance_near_tag, DimensionIndex>
+{
+    typedef typename geometry::default_distance_result<Point, BoxIndexable>::type result_type;
+
+    inline static result_type apply(Point const& pt, BoxIndexable const& i)
+    {
+        typedef typename index::traits::coordinate_type<Point>::type point_coord_t;
+        typedef typename index::traits::coordinate_type<BoxIndexable>::type indexable_coord_t;
+
+        point_coord_t pt_c = geometry::get<DimensionIndex>(pt);
+        indexable_coord_t ind_c_min = geometry::get<geometry::min_corner, DimensionIndex>(i);
+        indexable_coord_t ind_c_max = geometry::get<geometry::max_corner, DimensionIndex>(i);
+
+        result_type diff = 0;
+
+        if ( pt_c < ind_c_min )
+            diff = ind_c_min - pt_c;
+        else if ( ind_c_max < pt_c )
+            diff = pt_c - ind_c_max;
+
+        return diff * diff;
+    }
+};
+
+} // namespace detail
+
+template <typename Point, typename Indexable>
+typename geometry::default_distance_result<Point, Indexable>::type
+comparable_distance_near(Point const& pt, Indexable const& i)
+{
+    return detail::sum_for_indexable<
+        Point,
+        Indexable,
+        typename index::traits::tag<Indexable>::type,
+        detail::comparable_distance_near_tag,
+        index::traits::dimension<Indexable>::value
+    >::apply(pt, i);
+}
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_COMPARABLE_DISTANCE_NEAR_HPP
Deleted: sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/maxdist.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/maxdist.hpp	2011-09-22 19:16:20 EDT (Thu, 22 Sep 2011)
+++ (empty file)
@@ -1,69 +0,0 @@
-// Boost.Geometry (aka GGL, Generic Geometry Library)
-//
-// Boost.Index - maxdist used in R-tree k nearest neighbors query
-//
-// Copyright 2011 Adam Wulkiewicz.
-// Use, modification and distribution is subject to the Boost Software License,
-// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MAXDIST_HPP
-#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MAXDIST_HPP
-
-#include <boost/geometry/extensions/index/algorithms/detail/diff_abs.hpp>
-#include <boost/geometry/extensions/index/algorithms/detail/sum_for_indexable.hpp>
-
-namespace boost { namespace geometry { namespace index {
-
-namespace detail {
-
-// minmaxdist component
-
-struct maxdist_tag {};
-
-template <
-    typename Point,
-    typename BoxIndexable,
-    size_t DimensionIndex>
-struct sum_for_indexable_dimension<Point, BoxIndexable, box_tag, maxdist_tag, DimensionIndex>
-{
-    typedef typename geometry::default_distance_result<Point, BoxIndexable>::type result_type;
-
-    inline static result_type apply(Point const& pt, BoxIndexable const& i)
-    {
-        typedef typename index::traits::coordinate_type<Point>::type point_coord_t;
-        typedef typename index::traits::coordinate_type<BoxIndexable>::type indexable_coord_t;
-
-        point_coord_t pt_c = geometry::get<DimensionIndex>(pt);
-        indexable_coord_t ind_c_min = geometry::get<geometry::min_corner, DimensionIndex>(i);
-        indexable_coord_t ind_c_max = geometry::get<geometry::max_corner, DimensionIndex>(i);
-
-        result_type further_diff = 0;
-
-        if ( (ind_c_min + ind_c_max) / 2 <= pt_c )
-            further_diff = pt_c - ind_c_min;
-        else
-            further_diff = detail::diff_abs(pt_c, ind_c_max); // unsigned values protection
-
-        return further_diff * further_diff;
-    }
-};
-
-} // namespace detail
-
-template <typename Point, typename Indexable>
-typename geometry::default_distance_result<Point, Indexable>::type
-maxdist(Point const& pt, Indexable const& i)
-{
-    return detail::sum_for_indexable<
-        Point,
-        Indexable,
-        typename index::traits::tag<Indexable>::type,
-        detail::maxdist_tag,
-        index::traits::dimension<Indexable>::value
-    >::apply(pt, i);
-}
-
-}}} // namespace boost::geometry::index
-
-#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MAXDIST_HPP
Deleted: sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/mindist.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/mindist.hpp	2011-09-22 19:16:20 EDT (Thu, 22 Sep 2011)
+++ (empty file)
@@ -1,80 +0,0 @@
-// Boost.Geometry (aka GGL, Generic Geometry Library)
-//
-// Boost.Index - mindist used in R-tree k nearest neighbors query
-//
-// Copyright 2011 Adam Wulkiewicz.
-// Use, modification and distribution is subject to the Boost Software License,
-// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MINDIST_HPP
-#define BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MINDIST_HPP
-
-#include <boost/geometry/extensions/index/algorithms/detail/sum_for_indexable.hpp>
-
-namespace boost { namespace geometry { namespace index {
-
-namespace detail {
-
-struct mindist_tag {};
-
-template <
-    typename Point,
-    typename PointIndexable,
-    size_t N>
-struct sum_for_indexable<Point, PointIndexable, point_tag, mindist_tag, N>
-{
-    typedef typename geometry::default_distance_result<Point, PointIndexable>::type result_type;
-
-    inline static result_type apply(Point const& pt, PointIndexable const& i)
-    {
-        return geometry::comparable_distance(pt, i);
-    }
-};
-
-template <
-    typename Point,
-    typename BoxIndexable,
-    size_t DimensionIndex>
-struct sum_for_indexable_dimension<Point, BoxIndexable, box_tag, mindist_tag, DimensionIndex>
-{
-    typedef typename geometry::default_distance_result<Point, BoxIndexable>::type result_type;
-
-    inline static result_type apply(Point const& pt, BoxIndexable const& i)
-    {
-        typedef typename index::traits::coordinate_type<Point>::type point_coord_t;
-        typedef typename index::traits::coordinate_type<BoxIndexable>::type indexable_coord_t;
-
-        point_coord_t pt_c = geometry::get<DimensionIndex>(pt);
-        indexable_coord_t ind_c_min = geometry::get<geometry::min_corner, DimensionIndex>(i);
-        indexable_coord_t ind_c_max = geometry::get<geometry::max_corner, DimensionIndex>(i);
-
-        result_type diff = 0;
-
-        if ( pt_c < ind_c_min )
-            diff = ind_c_min - pt_c;
-        else if ( ind_c_max < pt_c )
-            diff = pt_c - ind_c_max;
-
-        return diff * diff;
-    }
-};
-
-} // namespace detail
-
-template <typename Point, typename Indexable>
-typename geometry::default_distance_result<Point, Indexable>::type
-mindist(Point const& pt, Indexable const& i)
-{
-    return detail::sum_for_indexable<
-        Point,
-        Indexable,
-        typename index::traits::tag<Indexable>::type,
-        detail::mindist_tag,
-        index::traits::dimension<Indexable>::value
-    >::apply(pt, i);
-}
-
-}}} // namespace boost::geometry::index
-
-#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_ALGORITHMS_MINDIST_HPP
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/minmaxdist.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/minmaxdist.hpp	(original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/algorithms/minmaxdist.hpp	2011-09-22 19:16:20 EDT (Thu, 22 Sep 2011)
@@ -39,7 +39,8 @@
         indexable_coord_t ind_c_min = geometry::get<geometry::min_corner, DimensionIndex>(i);
         indexable_coord_t ind_c_max = geometry::get<geometry::max_corner, DimensionIndex>(i);
 
-        indexable_coord_t ind_c_avg = (ind_c_min + ind_c_max) / 2;
+        indexable_coord_t ind_c_avg = ind_c_min + (ind_c_max - ind_c_min) / 2;
+        // TODO: awulkiew - is (ind_c_min + ind_c_max) / 2 safe?
 
         // TODO: awulkiew - optimize! don't calculate 2x pt_c <= ind_c_avg
         // take particular case pt_c == ind_c_avg into account
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/distance_calc.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/distance_calc.hpp	(original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/distance_calc.hpp	2011-09-22 19:16:20 EDT (Thu, 22 Sep 2011)
@@ -160,23 +160,13 @@
 namespace detail
 {
 
-// TODO:
-// to use it properly in case of rtree nodes there must be additional template parameter added: Tag
-// and typedef ... result_type - in case of bounded distance or half-bounded min maxdist must be calculated as well
-
-// distance_calc_result<Point, Indexable>::type or distance_calc<Point, Indexable>::result_type
-// sorting is needed only in rtree nodes so it shouldn't be here, use detail::rtree instead
-// should comp be here or only in detail::rtree?
-
-// in addition, maby don't use Tag, just implement different structure in detail::rtree specialized for rtree?
-// in addition, maby don't use Tag in predicates?
-
-// rename distance_calc -> comparable_distance_calc ? or calculate_comparable_distance or distance_data_calc?
-
 template <typename Point, typename Indexable, typename AlgoTag>
 struct distance_calc_impl
 {
-    // TODO MPL_ASSERT
+    BOOST_MPL_ASSERT_MSG(
+        (false),
+        NOT_IMPLEMENTED_FOR_THIS_TAG_TYPE,
+        (distance_calc_impl));
 };
 
 template <typename Point, typename Indexable>
@@ -186,7 +176,7 @@
 
     static inline result_type apply(Point const& p, Indexable const& i)
     {
-        return index::mindist(p, i);
+        return index::comparable_distance_near(p, i);
     }
 };
 
@@ -197,15 +187,33 @@
 
     static inline result_type apply(Point const& p, Indexable const& i)
     {
-        return index::maxdist(p, i);
+        return index::comparable_distance_far(p, i);
+    }
+};
+
+template <typename Point, typename Indexable>
+struct distance_calc_impl<Point, Indexable, detail::distance_centroid_tag>
+{
+    typedef typename geometry::default_distance_result<Point, Indexable>::type result_type;
+
+    static inline result_type apply(Point const& p, Indexable const& i)
+    {
+        return index::comparable_distance_centroid(p, i);
     }
 };
 
-// TODO distance_calc_impl<Point, Indexable, detail::distance_centroid_tag>
-// rename:
-// mindist -> comparable_distance_near
-// maxdist -> comparable_distance_far
-// add comparable_distance_centroid
+// TODO:
+// to use it properly in case of rtree nodes there must be additional template parameter added: Tag
+// and typedef ... result_type - in case of bounded distance or half-bounded min maxdist must be calculated as well
+
+// distance_calc_result<Point, Indexable>::type or distance_calc<Point, Indexable>::result_type
+// sorting is needed only in rtree nodes so it shouldn't be here, use detail::rtree instead
+// should comp be here or only in detail::rtree?
+
+// in addition, maby don't use Tag, just implement different structure in detail::rtree specialized for rtree?
+// in addition, maby don't use Tag in predicates?
+
+// rename distance_calc -> comparable_distance_calc ? or calculate_comparable_distance or distance_data_calc?
 
 template <typename Point, typename Indexable, typename Tag>
 struct distance_calc
@@ -214,7 +222,7 @@
 
     static inline result_type apply(Point const& p, Indexable const& i)
     {
-        return index::mindist(p, i);
+        return index::comparable_distance_near(p, i);
     }
 };
 
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/nearest.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/nearest.hpp	(original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/nearest.hpp	2011-09-22 19:16:20 EDT (Thu, 22 Sep 2011)
@@ -10,9 +10,9 @@
 #ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_NEAREST_HPP
 #define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_NEAREST_HPP
 
-#include <boost/geometry/extensions/index/algorithms/mindist.hpp>
-#include <boost/geometry/extensions/index/algorithms/minmaxdist.hpp>
-#include <boost/geometry/extensions/index/algorithms/maxdist.hpp>
+#include <boost/geometry/extensions/index/algorithms/comparable_distance_near.hpp>
+#include <boost/geometry/extensions/index/algorithms/comparable_distance_far.hpp>
+#include <boost/geometry/extensions/index/algorithms/comparable_distance_centroid.hpp>
 
 #include <boost/geometry/extensions/index/distance_calc.hpp>
 
@@ -175,7 +175,10 @@
             if ( index::predicates_check<rtree::node_predicates_tag>(m_pred, it->first) )
             {
                 active_branch_list.push_back(
-                    std::make_pair(index::mindist(m_point_data, it->first), it->second)
+                    std::make_pair(
+                        index::comparable_distance_near(m_point_data, it->first),
+                        it->second
+                    )
                 );
             }
         }
@@ -212,7 +215,10 @@
             if ( index::predicates_check<rtree::value_predicates_tag>(m_pred, m_tr(*it)) )
             {
                 // store value
-                m_result.store(*it, index::mindist(m_point_data, m_tr(*it)));
+                m_result.store(
+                    *it,
+                    index::comparable_distance_near(m_point_data, m_tr(*it))
+                );
             }
         }
     }
Modified: sandbox-branches/geometry/index/tests/additional_sizes_and_times.cpp
==============================================================================
--- sandbox-branches/geometry/index/tests/additional_sizes_and_times.cpp	(original)
+++ sandbox-branches/geometry/index/tests/additional_sizes_and_times.cpp	2011-09-22 19:16:20 EDT (Thu, 22 Sep 2011)
@@ -273,7 +273,7 @@
                 it != v.end();
                 ++it )
             {
-                distance_type cd = bgi::mindist(P(x, y), it->first);
+                distance_type cd = bgi::comparable_distance_near(P(x, y), it->first);
 
                 if ( cd < dist )
                 {
Modified: sandbox-branches/geometry/index/tests/rtree_function.hpp
==============================================================================
--- sandbox-branches/geometry/index/tests/rtree_function.hpp	(original)
+++ sandbox-branches/geometry/index/tests/rtree_function.hpp	2011-09-22 19:16:20 EDT (Thu, 22 Sep 2011)
@@ -182,7 +182,8 @@
         template <typename Value>
         bool operator()(Value const& v1, Value const& v2)
         {
-            return boost::geometry::index::mindist(pt, tr(v1)) < boost::geometry::index::mindist(pt, tr(v2));
+            return boost::geometry::index::comparable_distance_near(pt, tr(v1))
+                < boost::geometry::index::comparable_distance_near(pt, tr(v2));
         }
 
         Point const& pt;