1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_APPROXIMATELY_EQUALS_HPP
- #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_APPROXIMATELY_EQUALS_HPP
- #include <boost/geometry/core/access.hpp>
- #include <boost/geometry/util/math.hpp>
- #include <boost/geometry/util/select_coordinate_type.hpp>
- #include <boost/geometry/util/select_most_precise.hpp>
- namespace boost { namespace geometry
- {
- #ifndef DOXYGEN_NO_DETAIL
- namespace detail { namespace overlay
- {
- template <typename T>
- struct common_approximately_equals_epsilon_multiplier
- {
- static T value()
- {
-
-
-
-
-
-
-
-
-
-
-
-
-
- return T(100);
- }
- };
- template <typename Point1, typename Point2, typename E>
- inline bool approximately_equals(Point1 const& a, Point2 const& b,
- E const& epsilon_multiplier)
- {
- using coor_t = typename select_coordinate_type<Point1, Point2>::type;
- using calc_t = typename geometry::select_most_precise<coor_t, E>::type;
- calc_t const& a0 = geometry::get<0>(a);
- calc_t const& b0 = geometry::get<0>(b);
- calc_t const& a1 = geometry::get<1>(a);
- calc_t const& b1 = geometry::get<1>(b);
- math::detail::equals_factor_policy<calc_t> policy(a0, b0, a1, b1);
- policy.multiply_epsilon(epsilon_multiplier);
- return math::detail::equals_by_policy(a0, b0, policy)
- && math::detail::equals_by_policy(a1, b1, policy);
- }
- }}
- #endif
- }}
- #endif
|