spherical.hpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // Boost.Geometry
  2. // Copyright (c) 2021, Oracle and/or its affiliates.
  3. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
  4. // Licensed under the Boost Software License version 1.0.
  5. // http://www.boost.org/users/license.html
  6. #ifndef BOOST_GEOMETRY_STRATEGIES_CLOSEST_POINTS_SPHERICAL_HPP
  7. #define BOOST_GEOMETRY_STRATEGIES_CLOSEST_POINTS_SPHERICAL_HPP
  8. #include <boost/geometry/strategies/spherical/closest_points_pt_seg.hpp>
  9. #include <boost/geometry/strategies/detail.hpp>
  10. #include <boost/geometry/strategies/distance/detail.hpp>
  11. #include <boost/geometry/strategies/closest_points/services.hpp>
  12. #include <boost/geometry/strategies/distance/spherical.hpp>
  13. #include <boost/geometry/util/type_traits.hpp>
  14. namespace boost { namespace geometry
  15. {
  16. namespace strategies { namespace closest_points
  17. {
  18. template
  19. <
  20. typename RadiusTypeOrSphere = double,
  21. typename CalculationType = void
  22. >
  23. class spherical
  24. : public strategies::distance::spherical<RadiusTypeOrSphere, CalculationType>
  25. {
  26. using base_t = strategies::distance::spherical<RadiusTypeOrSphere, CalculationType>;
  27. public:
  28. spherical() = default;
  29. template <typename RadiusOrSphere>
  30. explicit spherical(RadiusOrSphere const& radius_or_sphere)
  31. : base_t(radius_or_sphere)
  32. {}
  33. template <typename Geometry1, typename Geometry2>
  34. auto closest_points(Geometry1 const&, Geometry2 const&,
  35. distance::detail::enable_if_ps_t<Geometry1, Geometry2> * = nullptr) const
  36. {
  37. return strategy::closest_points::cross_track<CalculationType>(base_t::radius());
  38. }
  39. };
  40. namespace services
  41. {
  42. template <typename Geometry1, typename Geometry2>
  43. struct default_strategy
  44. <
  45. Geometry1,
  46. Geometry2,
  47. spherical_equatorial_tag,
  48. spherical_equatorial_tag
  49. >
  50. {
  51. using type = strategies::closest_points::spherical<>;
  52. };
  53. } // namespace services
  54. }} // namespace strategies::closest_points
  55. }} // namespace boost::geometry
  56. #endif // BOOST_GEOMETRY_STRATEGIES_CLOSEST_POINTS_SPHERICAL_HPP