File indexing completed on 2025-01-18 09:36:41
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_GEOMETRY_STRATEGIES_AGNOSTIC_BUFFER_DISTANCE_SYMMETRIC_HPP
0010 #define BOOST_GEOMETRY_STRATEGIES_AGNOSTIC_BUFFER_DISTANCE_SYMMETRIC_HPP
0011
0012
0013 #include <boost/core/ignore_unused.hpp>
0014
0015 #include <boost/geometry/strategies/buffer.hpp>
0016 #include <boost/geometry/util/math.hpp>
0017
0018
0019 namespace boost { namespace geometry
0020 {
0021
0022 namespace strategy { namespace buffer
0023 {
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046 template<typename NumericType>
0047 class distance_symmetric
0048 {
0049 public :
0050
0051
0052 explicit inline distance_symmetric(NumericType const& distance)
0053 : m_distance(distance)
0054 {}
0055
0056 #ifndef DOXYGEN_SHOULD_SKIP_THIS
0057
0058 template <typename Point>
0059 inline NumericType apply(Point const& , Point const& ,
0060 buffer_side_selector ) const
0061 {
0062 return negative() ? geometry::math::abs(m_distance) : m_distance;
0063 }
0064
0065
0066 inline int factor() const
0067 {
0068 return negative() ? -1 : 1;
0069 }
0070
0071
0072 inline bool negative() const
0073 {
0074 return m_distance < 0;
0075 }
0076
0077 inline bool empty(buffer_side_selector ) const
0078 {
0079 return m_distance == 0;
0080 }
0081
0082
0083 template <typename JoinStrategy, typename EndStrategy>
0084 inline NumericType max_distance(JoinStrategy const& join_strategy,
0085 EndStrategy const& end_strategy) const
0086 {
0087 boost::ignore_unused(join_strategy, end_strategy);
0088
0089 NumericType const dist = geometry::math::abs(m_distance);
0090 return (std::max)(join_strategy.max_distance(dist),
0091 end_strategy.max_distance(dist));
0092 }
0093
0094
0095
0096 inline NumericType simplify_distance() const
0097 {
0098 return geometry::math::abs(m_distance) / 1000.0;
0099 }
0100 #endif
0101
0102 private :
0103 NumericType m_distance;
0104 };
0105
0106
0107 }}
0108
0109
0110 }}
0111
0112 #endif