cartesian.hpp 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // Boost.Geometry
  2. // Copyright (c) 2020-2023, Oracle and/or its affiliates.
  3. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
  4. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  5. // Licensed under the Boost Software License version 1.0.
  6. // http://www.boost.org/users/license.html
  7. #ifndef BOOST_GEOMETRY_STRATEGIES_CONVEX_HULL_CARTESIAN_HPP
  8. #define BOOST_GEOMETRY_STRATEGIES_CONVEX_HULL_CARTESIAN_HPP
  9. #include <boost/geometry/strategies/cartesian/point_in_point.hpp>
  10. #include <boost/geometry/strategies/convex_hull/services.hpp>
  11. #include <boost/geometry/strategies/compare.hpp>
  12. #include <boost/geometry/strategies/detail.hpp>
  13. #include <boost/geometry/strategies/side.hpp>
  14. #include <boost/geometry/strategy/cartesian/side_robust.hpp>
  15. #include <boost/geometry/util/type_traits.hpp>
  16. namespace boost { namespace geometry
  17. {
  18. namespace strategies { namespace convex_hull
  19. {
  20. template <typename CalculationType = void>
  21. class cartesian : public strategies::detail::cartesian_base
  22. {
  23. public:
  24. template <typename Geometry1, typename Geometry2>
  25. static auto relate(Geometry1 const&, Geometry2 const&,
  26. std::enable_if_t
  27. <
  28. util::is_pointlike<Geometry1>::value
  29. && util::is_pointlike<Geometry2>::value
  30. > * = nullptr)
  31. {
  32. return strategy::within::cartesian_point_point();
  33. }
  34. static auto side()
  35. {
  36. using side_strategy_type
  37. = strategy::side::side_robust<CalculationType, strategy::side::fp_equals_policy>;
  38. return side_strategy_type();
  39. }
  40. template <typename ComparePolicy, typename EqualsPolicy>
  41. using compare_type = typename strategy::compare::cartesian
  42. <
  43. ComparePolicy,
  44. EqualsPolicy,
  45. -1
  46. >;
  47. };
  48. namespace services
  49. {
  50. template <typename Geometry>
  51. struct default_strategy<Geometry, cartesian_tag>
  52. {
  53. using type = strategies::convex_hull::cartesian<>;
  54. };
  55. } // namespace services
  56. }} // namespace strategies::convex_hull
  57. }} // namespace boost::geometry
  58. #endif // BOOST_GEOMETRY_STRATEGIES_CONVEX_HULL_CARTESIAN_HPP