diff --git a/include/boost/geometry/strategies/cartesian/distance_comparable_to_regular.hpp b/include/boost/geometry/strategies/cartesian/distance_comparable_to_regular.hpp new file mode 100644 index 000000000..2d13b7a75 --- /dev/null +++ b/include/boost/geometry/strategies/cartesian/distance_comparable_to_regular.hpp @@ -0,0 +1,106 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2014, Oracle and/or its affiliates. + +// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle + +// Licensed under the Boost Software License version 1.0. +// http://www.boost.org/users/license.html + +#ifndef BOOST_GEOMETRY_STRATEGIES_CARTESIAN_DISTANCE_COMPARABLE_TO_REGULAR_HPP +#define BOOST_GEOMETRY_STRATEGIES_CARTESIAN_DISTANCE_COMPARABLE_TO_REGULAR_HPP + + +#include +#include +#include + +namespace boost { namespace geometry +{ + +namespace strategy { namespace distance +{ + + + +#ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS +namespace services +{ + + +template +< + typename ComparableStrategy, + typename Strategy, + typename Geometry1, + typename Geometry2 +> +struct comparable_to_regular + < + ComparableStrategy, Strategy, + Geometry1, Geometry2, + cartesian_tag, cartesian_tag + > +{ + typedef typename return_type + < + Strategy, + typename point_type::type, + typename point_type::type + >::type calculation_type; + + typedef typename return_type + < + ComparableStrategy, + typename point_type::type, + typename point_type::type + >::type comparable_calculation_type; + + static inline calculation_type apply(comparable_calculation_type const& cd) + { + return sqrt( boost::numeric_cast(cd) ); + } +}; + + + +template +struct comparable_to_regular + < + ComparableStrategy, + ComparableStrategy, + Geometry1, + Geometry2, + cartesian_tag, + cartesian_tag + > +{ + typedef typename return_type + < + ComparableStrategy, + typename point_type::type, + typename point_type::type + >::type comparable_calculation_type; + + static inline comparable_calculation_type + apply(comparable_calculation_type const& cd) + { + return cd; + } +}; + + + + + + + +} // namespace services +#endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS + + +}} // namespace strategy::distance + +}} // namespace boost::geometry + +#endif // BOOST_GEOMETRY_STRATEGIES_CARTESIAN_DISTANCE_COMPARABLE_TO_REGULAR_HPP diff --git a/include/boost/geometry/strategies/distance_comparable_to_regular.hpp b/include/boost/geometry/strategies/distance_comparable_to_regular.hpp new file mode 100644 index 000000000..88f51eb15 --- /dev/null +++ b/include/boost/geometry/strategies/distance_comparable_to_regular.hpp @@ -0,0 +1,53 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2014, Oracle and/or its affiliates. + +// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle + +// Licensed under the Boost Software License version 1.0. +// http://www.boost.org/users/license.html + +#ifndef BOOST_GEOMETRY_STRATEGIES_DISTANCE_COMPARABLE_TO_REGULAR_HPP +#define BOOST_GEOMETRY_STRATEGIES_DISTANCE_COMPARABLE_TO_REGULAR_HPP + +#include +#include +#include + + +namespace boost { namespace geometry +{ + +namespace strategy { namespace distance +{ + + + +#ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS +namespace services +{ + + +template +< + typename ComparableStrategy, + typename Strategy, + typename Geometry1, + typename Geometry2, + typename CsTag1 = typename cs_tag::type, + typename CsTag2 = typename cs_tag::type +> +struct comparable_to_regular + : geometry::not_implemented +{}; + + +} // namespace services +#endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS + + +}} // namespace strategy::distance + +}} // namespace boost::geometry + +#endif // BOOST_GEOMETRY_STRATEGIES_DISTANCE_COMPARABLE_TO_REGULAR_HPP