/usr/include/boost/geometry/index/detail/algorithms
NameSizeModeActions
bounds.hpp64570644editdlrm
comparable_distance_centroid.hpp27950644editdlrm
comparable_distance_far.hpp23950644editdlrm
comparable_distance_near.hpp26550644editdlrm
content.hpp23800644editdlrm
diff_abs.hpp11460644editdlrm
intersection_content.hpp29120644editdlrm
is_valid.hpp21760644editdlrm
margin.hpp52610644editdlrm
minmaxdist.hpp41030644editdlrm
nth_element.hpp17490644editdlrm
path_intersection.hpp46090644editdlrm
segment_intersection.hpp53040644editdlrm
smallest_for_indexable.hpp24420644editdlrm
sum_for_indexable.hpp22370644editdlrm
union_content.hpp11030644editdlrm
Edit: /usr/include/boost/geometry/index/detail/algorithms/comparable_distance_centroid.hpp (2795B)
// Boost.Geometry Index // // squared distance between point and centroid of the box or point // // Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland. // // 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_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_CENTROID_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_CENTROID_HPP #include #include 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 { typedef typename geometry::default_comparable_distance_result::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 { typedef typename geometry::default_comparable_distance_result::type result_type; inline static result_type apply(Point const& pt, BoxIndexable const& i) { typedef typename coordinate_type::type point_coord_t; typedef typename coordinate_type::type indexable_coord_t; point_coord_t pt_c = geometry::get(pt); indexable_coord_t ind_c_min = geometry::get(i); indexable_coord_t ind_c_max = geometry::get(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; } }; template typename geometry::default_comparable_distance_result::type comparable_distance_centroid(Point const& pt, Indexable const& i) { return detail::sum_for_indexable< Point, Indexable, typename tag::type, detail::comparable_distance_centroid_tag, dimension::value >::apply(pt, i); } }}}} // namespace boost::geometry::index::detail #endif // #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_COMPARABLE_DISTANCE_CENTROID_HPP