Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:36:44

0001 // Boost.Geometry
0002 
0003 // Copyright (c) 2021, Oracle and/or its affiliates.
0004 
0005 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0006 
0007 // Licensed under the Boost Software License version 1.0.
0008 // http://www.boost.org/users/license.html
0009 
0010 #ifndef BOOST_GEOMETRY_STRATEGIES_DISCRETE_DISTANCE_CARTESIAN_HPP
0011 #define BOOST_GEOMETRY_STRATEGIES_DISCRETE_DISTANCE_CARTESIAN_HPP
0012 
0013 
0014 #include <boost/geometry/strategies/cartesian/distance_pythagoras.hpp>
0015 
0016 #include <boost/geometry/strategies/detail.hpp>
0017 #include <boost/geometry/strategies/discrete_distance/services.hpp>
0018 #include <boost/geometry/strategies/distance/comparable.hpp>
0019 #include <boost/geometry/strategies/distance/detail.hpp>
0020 
0021 #include <boost/geometry/util/type_traits.hpp>
0022 
0023 
0024 namespace boost { namespace geometry
0025 {
0026 
0027 namespace strategies { namespace discrete_distance
0028 {
0029 
0030 template <typename CalculationType = void>
0031 struct cartesian
0032     : public strategies::detail::cartesian_base
0033 {
0034     template <typename Geometry1, typename Geometry2>
0035     static auto distance(Geometry1 const&, Geometry2 const&,
0036                          distance::detail::enable_if_pp_t<Geometry1, Geometry2> * = nullptr)
0037     {
0038         return strategy::distance::pythagoras<CalculationType>();
0039     }
0040 };
0041 
0042 
0043 namespace services
0044 {
0045 
0046 template <typename Geometry1, typename Geometry2>
0047 struct default_strategy<Geometry1, Geometry2, cartesian_tag, cartesian_tag>
0048 {
0049     using type = strategies::discrete_distance::cartesian<>;
0050 };
0051 
0052 
0053 template <typename CT>
0054 struct strategy_converter<strategy::distance::pythagoras<CT> >
0055 {
0056     static auto get(strategy::distance::pythagoras<CT> const&)
0057     {
0058         return strategies::discrete_distance::cartesian<CT>();
0059     }
0060 };
0061 
0062 template <typename CT>
0063 struct strategy_converter<strategy::distance::comparable::pythagoras<CT> >
0064 {
0065     static auto get(strategy::distance::comparable::pythagoras<CT> const&)
0066     {
0067         return strategies::distance::detail::make_comparable(
0068                 strategies::discrete_distance::cartesian<CT>());
0069     }
0070 };
0071 
0072 
0073 } // namespace services
0074 
0075 }} // namespace strategies::discrete_distance
0076 
0077 }} // namespace boost::geometry
0078 
0079 #endif // BOOST_GEOMETRY_STRATEGIES_DISCRETE_DISTANCE_CARTESIAN_HPP