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_POINT_SQUARE_HPP
0015 #define BOOST_GEOMETRY_STRATEGIES_CARTESIAN_BUFFER_POINT_SQUARE_HPP
0016
0017 #include <cstddef>
0018
0019 #include <boost/range/value_type.hpp>
0020
0021 #include <boost/geometry/core/access.hpp>
0022 #include <boost/geometry/strategies/buffer.hpp>
0023 #include <boost/geometry/util/math.hpp>
0024
0025 namespace boost { namespace geometry
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
0051 class point_square
0052 {
0053 template
0054 <
0055 typename Point,
0056 typename DistanceType,
0057 typename MultiplierType,
0058 typename OutputRange
0059 >
0060 inline void add_point(Point const& point,
0061 DistanceType const& distance,
0062 MultiplierType const& x,
0063 MultiplierType const& y,
0064 OutputRange& output_range) const
0065 {
0066 typename boost::range_value<OutputRange>::type p;
0067 set<0>(p, get<0>(point) + x * distance);
0068 set<1>(p, get<1>(point) + y * distance);
0069 output_range.push_back(p);
0070 }
0071
0072 template
0073 <
0074 typename Point,
0075 typename DistanceType,
0076 typename OutputRange
0077 >
0078 inline void add_points(Point const& point,
0079 DistanceType const& distance,
0080 OutputRange& output_range) const
0081 {
0082 add_point(point, distance, -1.0, -1.0, output_range);
0083 add_point(point, distance, -1.0, +1.0, output_range);
0084 add_point(point, distance, +1.0, +1.0, output_range);
0085 add_point(point, distance, +1.0, -1.0, output_range);
0086
0087
0088 output_range.push_back(output_range.front());
0089 }
0090
0091 public :
0092
0093 #ifndef DOXYGEN_SHOULD_SKIP_THIS
0094
0095 template
0096 <
0097 typename Point,
0098 typename DistanceStrategy,
0099 typename OutputRange
0100 >
0101 inline void apply(Point const& point,
0102 DistanceStrategy const& distance_strategy,
0103 OutputRange& output_range) const
0104 {
0105 add_points(point, distance_strategy.apply(point, point,
0106 strategy::buffer::buffer_side_left), output_range);
0107 }
0108 #endif
0109
0110 };
0111
0112
0113 }}
0114
0115 }}
0116
0117 #endif