mirror of
https://github.com/boostorg/geometry.git
synced 2026-02-09 11:12:21 +00:00
[buffer] use passed first
This commit is contained in:
@@ -159,23 +159,14 @@ struct buffer_range
|
||||
|
||||
point_type penultimate_point, ultimate_point; // last two points from begin/end
|
||||
|
||||
|
||||
for (Iterator prev = it++; it != end; ++it)
|
||||
{
|
||||
if (! detail::equals::equals_point_point(*prev, *it))
|
||||
{
|
||||
output_point_type p1, p2;
|
||||
penultimate_point = *prev;
|
||||
ultimate_point = *it;
|
||||
generate_side(*prev, *it, side, distance_strategy, p1, p2);
|
||||
|
||||
if (first)
|
||||
{
|
||||
first = false;
|
||||
first_p1 = p1;
|
||||
first_p2 = p2;
|
||||
}
|
||||
else
|
||||
if (! first)
|
||||
{
|
||||
add_join(collection,
|
||||
*prev, previous_p1, previous_p2,
|
||||
@@ -183,11 +174,20 @@ struct buffer_range
|
||||
side,
|
||||
distance_strategy, join_strategy, robust_policy);
|
||||
}
|
||||
collection.add_piece(strategy::buffer::buffered_segment, *prev, *it, p1, p2);
|
||||
collection.add_piece(strategy::buffer::buffered_segment,
|
||||
*prev, *it, p1, p2, first);
|
||||
|
||||
penultimate_point = *prev;
|
||||
ultimate_point = *it;
|
||||
previous_p1 = p1;
|
||||
previous_p2 = p2;
|
||||
prev = it;
|
||||
if (first)
|
||||
{
|
||||
first = false;
|
||||
first_p1 = p1;
|
||||
first_p2 = p2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -590,13 +590,8 @@ struct buffered_piece_collection
|
||||
}
|
||||
|
||||
inline void add_piece(strategy::buffer::piece_type type, point_type const& p1, point_type const& p2,
|
||||
point_type const& b1, point_type const& b2)
|
||||
point_type const& b1, point_type const& b2, bool first)
|
||||
{
|
||||
// For the first segment, add starting point, else skip that and
|
||||
// decrease next segment_index because it uses the last one
|
||||
bool const first = m_pieces.empty()
|
||||
|| m_pieces.back().first_seg_id.multi_index != current_segment_id.multi_index;
|
||||
|
||||
piece& pc = add_piece(type, ! first);
|
||||
|
||||
// If it follows a non-join (so basically the same piece-type) point b1 should be added.
|
||||
|
||||
Reference in New Issue
Block a user