123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- #ifndef BOOST_GEOMETRY_STRATEGIES_CARTESIAN_BUFFER_END_FLAT_HPP
- #define BOOST_GEOMETRY_STRATEGIES_CARTESIAN_BUFFER_END_FLAT_HPP
- #include <boost/geometry/core/coordinate_type.hpp>
- #include <boost/geometry/strategies/buffer.hpp>
- #include <boost/geometry/strategies/tags.hpp>
- #include <boost/geometry/strategies/side.hpp>
- #include <boost/geometry/util/math.hpp>
- #include <boost/geometry/util/select_most_precise.hpp>
- namespace boost { namespace geometry
- {
- namespace strategy { namespace buffer
- {
- class end_flat
- {
- public :
- #ifndef DOXYGEN_SHOULD_SKIP_THIS
-
- template <typename Point, typename DistanceStrategy, typename RangeOut>
- inline void apply(Point const& penultimate_point,
- Point const& perp_left_point,
- Point const& ultimate_point,
- Point const& perp_right_point,
- buffer_side_selector side,
- DistanceStrategy const& distance,
- RangeOut& range_out) const
- {
- auto const dist_left = distance.apply(penultimate_point, ultimate_point, buffer_side_left);
- auto const dist_right = distance.apply(penultimate_point, ultimate_point, buffer_side_right);
- bool const reversed =
- (side == buffer_side_left && dist_right < 0 && -dist_right > dist_left)
- || (side == buffer_side_right && dist_left < 0 && -dist_left > dist_right);
- if (reversed)
- {
- range_out.push_back(perp_right_point);
- range_out.push_back(perp_left_point);
- }
- else
- {
- range_out.push_back(perp_left_point);
- range_out.push_back(perp_right_point);
- }
-
-
-
- }
- template <typename NumericType>
- static inline NumericType max_distance(NumericType const& distance)
- {
- return distance;
- }
-
- static inline piece_type get_piece_type()
- {
- return buffered_flat_end;
- }
- #endif
- };
- }}
- }}
- #endif
|