123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- #ifndef BOOST_GEOMETRY_STRATEGIES_CARTESIAN_BUFFER_POINT_SQUARE_HPP
- #define BOOST_GEOMETRY_STRATEGIES_CARTESIAN_BUFFER_POINT_SQUARE_HPP
- #include <cstddef>
- #include <boost/range/value_type.hpp>
- #include <boost/geometry/core/access.hpp>
- #include <boost/geometry/strategies/buffer.hpp>
- #include <boost/geometry/util/math.hpp>
- namespace boost { namespace geometry
- {
- namespace strategy { namespace buffer
- {
- class point_square
- {
- template
- <
- typename Point,
- typename DistanceType,
- typename MultiplierType,
- typename OutputRange
- >
- inline void add_point(Point const& point,
- DistanceType const& distance,
- MultiplierType const& x,
- MultiplierType const& y,
- OutputRange& output_range) const
- {
- typename boost::range_value<OutputRange>::type p;
- set<0>(p, get<0>(point) + x * distance);
- set<1>(p, get<1>(point) + y * distance);
- output_range.push_back(p);
- }
- template
- <
- typename Point,
- typename DistanceType,
- typename OutputRange
- >
- inline void add_points(Point const& point,
- DistanceType const& distance,
- OutputRange& output_range) const
- {
- add_point(point, distance, -1.0, -1.0, output_range);
- add_point(point, distance, -1.0, +1.0, output_range);
- add_point(point, distance, +1.0, +1.0, output_range);
- add_point(point, distance, +1.0, -1.0, output_range);
-
- output_range.push_back(output_range.front());
- }
- public :
- #ifndef DOXYGEN_SHOULD_SKIP_THIS
-
- template
- <
- typename Point,
- typename DistanceStrategy,
- typename OutputRange
- >
- inline void apply(Point const& point,
- DistanceStrategy const& distance_strategy,
- OutputRange& output_range) const
- {
- add_points(point, distance_strategy.apply(point, point,
- strategy::buffer::buffer_side_left), output_range);
- }
- #endif
- };
- }}
- }}
- #endif
|