mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-11 13:34:10 +00:00
[buffer] add empty side type
This commit is contained in:
parent
e5613cb8ad
commit
9f33365496
@ -291,7 +291,7 @@ struct buffer_range
|
||||
robust_policy, strategies);
|
||||
}
|
||||
|
||||
collection.add_side_piece(*prev, *it, generated_side, first);
|
||||
collection.add_side_piece(*prev, *it, generated_side, first, distance_strategy.empty(side));
|
||||
|
||||
if (first && mark_flat)
|
||||
{
|
||||
|
@ -917,12 +917,16 @@ struct buffered_piece_collection
|
||||
template <typename Range>
|
||||
inline void add_side_piece(point_type const& original_point1,
|
||||
point_type const& original_point2,
|
||||
Range const& range, bool first)
|
||||
Range const& range, bool is_first, bool is_empty)
|
||||
{
|
||||
BOOST_GEOMETRY_ASSERT(boost::size(range) >= 2u);
|
||||
|
||||
piece& pc = create_piece(strategy::buffer::buffered_segment, ! first);
|
||||
add_range_to_piece(pc, range, first);
|
||||
auto const piece_type = is_empty
|
||||
? strategy::buffer::buffered_empty_side
|
||||
: strategy::buffer::buffered_segment;
|
||||
|
||||
piece& pc = create_piece(piece_type, ! is_first);
|
||||
add_range_to_piece(pc, range, is_first);
|
||||
|
||||
// Add the four points of the side, starting with the last point of the
|
||||
// range, and reversing the order of the originals to keep it clockwise
|
||||
|
@ -138,6 +138,11 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
if (piece.type == geometry::strategy::buffer::buffered_empty_side)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (piece.type == geometry::strategy::buffer::buffered_point)
|
||||
{
|
||||
// Optimization for a buffer around points: if distance from center
|
||||
|
@ -76,6 +76,11 @@ public :
|
||||
return m_left < 0 && m_right < 0;
|
||||
}
|
||||
|
||||
inline bool empty(buffer_side_selector side) const
|
||||
{
|
||||
return side == buffer_side_left ? m_left == 0 : m_right == 0;
|
||||
}
|
||||
|
||||
//! Returns the max distance distance up to the buffer will reach
|
||||
template <typename JoinStrategy, typename EndStrategy>
|
||||
inline NumericType max_distance(JoinStrategy const& join_strategy,
|
||||
|
@ -74,6 +74,11 @@ public :
|
||||
return m_distance < 0;
|
||||
}
|
||||
|
||||
inline bool empty(buffer_side_selector ) const
|
||||
{
|
||||
return m_distance == 0;
|
||||
}
|
||||
|
||||
//! Returns the max distance distance up to the buffer will reach
|
||||
template <typename JoinStrategy, typename EndStrategy>
|
||||
inline NumericType max_distance(JoinStrategy const& join_strategy,
|
||||
|
@ -67,6 +67,7 @@ enum piece_type
|
||||
buffered_flat_end,
|
||||
buffered_point,
|
||||
buffered_concave, // always on the inside
|
||||
buffered_empty_side, // for one-sided buffers
|
||||
piece_type_unknown
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user