Apply bug fix from upstream clipper

Clipper fix in commit [r463] for bug repport #92 (http://sourceforge.net/p/polyclipping/code/463/tree//trunk/cpp/clipper.cpp?diff=504b9404fd48f873331e913b:462)
is applied here.
This commit is contained in:
Petr Ledvina 2014-04-22 15:19:35 +02:00
parent c4bfe64fb8
commit c30040b691

View File

@ -1030,10 +1030,20 @@ TEdge* ClipperBase::ProcessBound(TEdge* E, bool IsClockwise)
cInt StartX; cInt StartX;
if (IsHorizontal(*E)) if (IsHorizontal(*E))
{ {
//it's possible for adjacent overlapping horz edges to start heading left //first we need to be careful here with open paths because this
//before finishing right, so ... //may not be a true local minima (ie may be following a skip edge).
if (IsClockwise) StartX = E->Prev->Bot.X; //also, watch for adjacent horz edges to start heading left
else StartX = E->Next->Bot.X; //before finishing right ...
if (IsClockwise)
{
if (E->Prev->Bot.Y == E->Bot.Y) StartX = E->Prev->Bot.X;
else StartX = E->Prev->Top.X;
}
else
{
if (E->Next->Bot.Y == E->Bot.Y) StartX = E->Next->Bot.X;
else StartX = E->Next->Top.X;
}
if (E->Bot.X != StartX) ReverseHorizontal(*E); if (E->Bot.X != StartX) ReverseHorizontal(*E);
} }