123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- #ifndef BOOST_GEOMETRY_STRATEGY_CARTESIAN_POINT_IN_POINT_HPP
- #define BOOST_GEOMETRY_STRATEGY_CARTESIAN_POINT_IN_POINT_HPP
- #include <cstddef>
- #include <boost/geometry/core/access.hpp>
- #include <boost/geometry/core/coordinate_dimension.hpp>
- #include <boost/geometry/core/tags.hpp>
- #include <boost/geometry/util/math.hpp>
- #include <boost/geometry/strategies/covered_by.hpp>
- #include <boost/geometry/strategies/within.hpp>
- namespace boost { namespace geometry
- {
- #ifndef DOXYGEN_NO_DETAIL
- namespace detail { namespace within
- {
- template <std::size_t Dimension, std::size_t DimensionCount>
- struct point_point_generic
- {
- template <typename Point1, typename Point2>
- static inline bool apply(Point1 const& p1, Point2 const& p2)
- {
- if (! geometry::math::equals(get<Dimension>(p1), get<Dimension>(p2)))
- {
- return false;
- }
- return
- point_point_generic<Dimension + 1, DimensionCount>::apply(p1, p2);
- }
- };
- template <std::size_t DimensionCount>
- struct point_point_generic<DimensionCount, DimensionCount>
- {
- template <typename Point1, typename Point2>
- static inline bool apply(Point1 const&, Point2 const& )
- {
- return true;
- }
- };
- }}
- #endif
- namespace strategy { namespace within
- {
- struct cartesian_point_point
- {
- typedef cartesian_tag cs_tag;
- template <typename Point1, typename Point2>
- static inline bool apply(Point1 const& point1, Point2 const& point2)
- {
- return geometry::detail::within::point_point_generic
- <
- 0, dimension<Point1>::type::value
- >::apply(point1, point2);
- }
- };
- #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
- namespace services
- {
- template <typename PointLike1, typename PointLike2, typename Tag1, typename Tag2>
- struct default_strategy<PointLike1, PointLike2, Tag1, Tag2, pointlike_tag, pointlike_tag, cartesian_tag, cartesian_tag>
- {
- typedef strategy::within::cartesian_point_point type;
- };
- }
- #endif
- }}
- #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
- namespace strategy { namespace covered_by { namespace services
- {
- template <typename PointLike1, typename PointLike2, typename Tag1, typename Tag2>
- struct default_strategy<PointLike1, PointLike2, Tag1, Tag2, pointlike_tag, pointlike_tag, cartesian_tag, cartesian_tag>
- {
- typedef strategy::within::cartesian_point_point type;
- };
- }}}
- #endif
- }}
- #endif
|