File indexing completed on 2025-01-18 09:36:42
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef BOOST_GEOMETRY_STRATEGIES_CARTESIAN_BUFFER_END_FLAT_HPP
0015 #define BOOST_GEOMETRY_STRATEGIES_CARTESIAN_BUFFER_END_FLAT_HPP
0016
0017 #include <boost/geometry/core/coordinate_type.hpp>
0018 #include <boost/geometry/strategies/buffer.hpp>
0019 #include <boost/geometry/strategies/tags.hpp>
0020 #include <boost/geometry/strategies/side.hpp>
0021 #include <boost/geometry/util/math.hpp>
0022 #include <boost/geometry/util/select_most_precise.hpp>
0023
0024 namespace boost { namespace geometry
0025 {
0026
0027
0028 namespace strategy { namespace buffer
0029 {
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050 class end_flat
0051 {
0052
0053 public :
0054
0055 #ifndef DOXYGEN_SHOULD_SKIP_THIS
0056
0057 template <typename Point, typename DistanceStrategy, typename RangeOut>
0058 inline void apply(Point const& penultimate_point,
0059 Point const& perp_left_point,
0060 Point const& ultimate_point,
0061 Point const& perp_right_point,
0062 buffer_side_selector side,
0063 DistanceStrategy const& distance,
0064 RangeOut& range_out) const
0065 {
0066 auto const dist_left = distance.apply(penultimate_point, ultimate_point, buffer_side_left);
0067 auto const dist_right = distance.apply(penultimate_point, ultimate_point, buffer_side_right);
0068
0069 bool const reversed =
0070 (side == buffer_side_left && dist_right < 0 && -dist_right > dist_left)
0071 || (side == buffer_side_right && dist_left < 0 && -dist_left > dist_right);
0072
0073 if (reversed)
0074 {
0075 range_out.push_back(perp_right_point);
0076 range_out.push_back(perp_left_point);
0077 }
0078 else
0079 {
0080 range_out.push_back(perp_left_point);
0081 range_out.push_back(perp_right_point);
0082 }
0083
0084
0085
0086 }
0087
0088 template <typename NumericType>
0089 static inline NumericType max_distance(NumericType const& distance)
0090 {
0091 return distance;
0092 }
0093
0094
0095 static inline piece_type get_piece_type()
0096 {
0097 return buffered_flat_end;
0098 }
0099 #endif
0100 };
0101
0102
0103 }}
0104
0105 }}
0106
0107 #endif