File indexing completed on 2025-01-18 09:35:05
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_INTERSECTS_ANTIMERIDIAN_HPP
0012 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_INTERSECTS_ANTIMERIDIAN_HPP
0013
0014 #include <boost/geometry/core/access.hpp>
0015 #include <boost/geometry/core/coordinate_system.hpp>
0016
0017 #include <boost/geometry/util/math.hpp>
0018
0019 #include <boost/geometry/algorithms/detail/normalize.hpp>
0020
0021
0022 namespace boost { namespace geometry
0023 {
0024
0025 namespace detail { namespace envelope
0026 {
0027
0028
0029 struct intersects_antimeridian
0030 {
0031 template <typename Units, typename CoordinateType>
0032 static inline bool apply(CoordinateType const& lon1,
0033 CoordinateType const& lat1,
0034 CoordinateType const& lon2,
0035 CoordinateType const& lat2)
0036 {
0037 typedef math::detail::constants_on_spheroid
0038 <
0039 CoordinateType, Units
0040 > constants;
0041
0042 return
0043 math::equals(math::abs(lat1), constants::max_latitude())
0044 ||
0045 math::equals(math::abs(lat2), constants::max_latitude())
0046 ||
0047 math::larger(math::abs(lon1 - lon2), constants::half_period());
0048 }
0049
0050 template <typename Segment>
0051 static inline bool apply(Segment const& segment)
0052 {
0053 return apply(detail::indexed_point_view<Segment, 0>(segment),
0054 detail::indexed_point_view<Segment, 1>(segment));
0055 }
0056
0057 template <typename Point>
0058 static inline bool apply(Point const& p1, Point const& p2)
0059 {
0060 Point p1_normalized = detail::return_normalized<Point>(p1);
0061 Point p2_normalized = detail::return_normalized<Point>(p2);
0062
0063 return apply
0064 <
0065 typename coordinate_system<Point>::type::units
0066 >(geometry::get<0>(p1_normalized),
0067 geometry::get<1>(p1_normalized),
0068 geometry::get<0>(p2_normalized),
0069 geometry::get<1>(p2_normalized));
0070 }
0071 };
0072
0073
0074 }}
0075
0076 }}
0077
0078 #endif