Skip to content

Commit

Permalink
[buffer][fix] Avoid check neighbors on the border for inside, that
Browse files Browse the repository at this point in the history
should not be the case (but might, by rounding errors)
  • Loading branch information
barendgehrels committed Jul 27, 2014
1 parent 9467d5d commit d99d6ed
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class turn_in_piece_visitor
return;
}

bool neighbour = false;
for (int i = 0; i < 2; i++)
{
// Don't compare against one of the two source-pieces
Expand All @@ -141,15 +142,16 @@ class turn_in_piece_visitor

typename boost::range_value<Pieces>::type const& pc
= m_pieces[turn.operations[i].piece_index];
if (pc.type == strategy::buffer::buffered_flat_end)
if (pc.left_index == piece.index
|| pc.right_index == piece.index)
{
if (pc.left_index == piece.index
|| pc.right_index == piece.index)
if (pc.type == strategy::buffer::buffered_flat_end)
{
// If it is a flat end, don't compare against its neighbor:
// it will always be located on one of the helper segments
return;
}
neighbour = true;
}
}

Expand All @@ -161,8 +163,11 @@ class turn_in_piece_visitor
}

Turn& mutable_turn = m_turns[turn.turn_index];
if (geometry_code == 0)
if (geometry_code == 0 && ! neighbour)
{
// If it is on the border and they are neighbours, it should be
// on the offsetted ring

if (! on_offsetted(turn.robust_point, piece))
{
// It is on the border but not on the offsetted ring.
Expand Down

0 comments on commit d99d6ed

Please sign in to comment.