123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- #ifndef BOOST_GEOMETRY_STRATEGIES_AGNOSTIC_BUFFER_DISTANCE_SYMMETRIC_HPP
- #define BOOST_GEOMETRY_STRATEGIES_AGNOSTIC_BUFFER_DISTANCE_SYMMETRIC_HPP
- #include <boost/core/ignore_unused.hpp>
- #include <boost/geometry/strategies/buffer.hpp>
- #include <boost/geometry/util/math.hpp>
- namespace boost { namespace geometry
- {
- namespace strategy { namespace buffer
- {
- template<typename NumericType>
- class distance_symmetric
- {
- public :
-
-
- explicit inline distance_symmetric(NumericType const& distance)
- : m_distance(distance)
- {}
- #ifndef DOXYGEN_SHOULD_SKIP_THIS
-
- template <typename Point>
- inline NumericType apply(Point const& , Point const& ,
- buffer_side_selector ) const
- {
- return negative() ? geometry::math::abs(m_distance) : m_distance;
- }
-
- inline int factor() const
- {
- return negative() ? -1 : 1;
- }
-
- inline bool negative() const
- {
- return m_distance < 0;
- }
- inline bool empty(buffer_side_selector ) const
- {
- return m_distance == 0;
- }
-
- template <typename JoinStrategy, typename EndStrategy>
- inline NumericType max_distance(JoinStrategy const& join_strategy,
- EndStrategy const& end_strategy) const
- {
- boost::ignore_unused(join_strategy, end_strategy);
- NumericType const dist = geometry::math::abs(m_distance);
- return (std::max)(join_strategy.max_distance(dist),
- end_strategy.max_distance(dist));
- }
-
- inline NumericType simplify_distance() const
- {
- return geometry::math::abs(m_distance) / 1000.0;
- }
- #endif
- private :
- NumericType m_distance;
- };
- }}
- }}
- #endif
|