Skip to content

Commit b1f1e16

Browse files
author
Cristian Pallarés
committed
Merge with 6.4.2
1 parent ec7c6ba commit b1f1e16

File tree

197 files changed

+16756
-1015
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

197 files changed

+16756
-1015
lines changed

C#/clipper_library/clipper.cs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/*******************************************************************************
22
* *
33
* Author : Angus Johnson *
4-
* Version : 6.4.0 *
5-
* Date : 2 July 2015 *
4+
* Version : 6.4.2 *
5+
* Date : 27 February 2017 *
66
* Website : http://www.angusj.com *
7-
* Copyright : Angus Johnson 2010-2015 *
7+
* Copyright : Angus Johnson 2010-2017 *
88
* *
99
* License: *
1010
* Use, modification & distribution is subject to Boost Software License Ver 1. *
@@ -2126,7 +2126,7 @@ private OutPt AddLocalMinPoly(TEdge e1, TEdge e2, IntPoint pt)
21262126
prevE = e.PrevInAEL;
21272127
}
21282128

2129-
if (prevE != null && prevE.OutIdx >= 0)
2129+
if (prevE != null && prevE.OutIdx >= 0 && prevE.Top.Y < pt.Y && e.Top.Y < pt.Y)
21302130
{
21312131
cInt xPrev = TopX(prevE, pt.Y);
21322132
cInt xE = TopX(e, pt.Y);
@@ -2788,6 +2788,11 @@ private void ProcessHorizontal(TEdge horzEdge)
27882788

27892789
if (horzEdge.OutIdx >= 0 && !IsOpen) //note: may be done multiple times
27902790
{
2791+
#if use_xyz
2792+
if (dir == Direction.dLeftToRight) SetZ(ref e.Curr, horzEdge, e);
2793+
else SetZ(ref e.Curr, e, horzEdge);
2794+
#endif
2795+
27912796
op1 = AddOutPt(horzEdge, e.Curr);
27922797
TEdge eNextHorz = m_SortedEdges;
27932798
while (eNextHorz != null)
@@ -3194,8 +3199,12 @@ private void ProcessEdgesAtTopOfScanbeam(cInt topY)
31943199
{
31953200
e.Curr.X = TopX( e, topY );
31963201
e.Curr.Y = topY;
3202+
#if use_xyz
3203+
if (e.Top.Y == topY) e.Curr.Z = e.Top.Z;
3204+
else if (e.Bot.Y == topY) e.Curr.Z = e.Bot.Z;
3205+
else e.Curr.Z = 0;
3206+
#endif
31973207
}
3198-
31993208
//When StrictlySimple and 'e' is being touched by another edge, then
32003209
//make sure both edges have a vertex here ...
32013210
if (StrictlySimple)
@@ -3904,7 +3913,7 @@ private void FixupFirstLefts3(OutRec OldOutRec, OutRec NewOutRec)
39043913
foreach (OutRec outRec in m_PolyOuts)
39053914
{
39063915
OutRec firstLeft = ParseFirstLeft(outRec.FirstLeft);
3907-
if (outRec.Pts != null && outRec.FirstLeft == OldOutRec)
3916+
if (outRec.Pts != null && firstLeft == OldOutRec)
39083917
outRec.FirstLeft = NewOutRec;
39093918
}
39103919
}

Delphi/clipper.pas

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
(*******************************************************************************
44
* *
55
* Author : Angus Johnson *
6-
* Version : 6.4.0 *
7-
* Date : 2 July 2015 *
6+
* Version : 6.4.2 *
7+
* Date : 27 February 2017 *
88
* Website : http://www.angusj.com *
9-
* Copyright : Angus Johnson 2010-2015 *
9+
* Copyright : Angus Johnson 2010-2017 *
1010
* *
1111
* License: *
1212
* Use, modification & distribution is subject to Boost Software License Ver 1. *
@@ -1544,7 +1544,7 @@ function FindNextLocMin(E: PEdge): PEdge; {$IFDEF INLINING} inline; {$ENDIF}
15441544

15451545
function GetUnitNormal(const Pt1, Pt2: TIntPoint): TDoublePoint;
15461546
var
1547-
Dx, Dy, F: Single;
1547+
Dx, Dy, F: Double;
15481548
begin
15491549
if (Pt2.X = Pt1.X) and (Pt2.Y = Pt1.Y) then
15501550
begin
@@ -2622,7 +2622,8 @@ function TClipper.AddLocalMinPoly(E1, E2: PEdge; const Pt: TIntPoint): POutPt;
26222622
prevE := E.PrevInAEL;
26232623
end;
26242624

2625-
if Assigned(prevE) and (prevE.OutIdx >= 0) then
2625+
if Assigned(prevE) and (prevE.OutIdx >= 0) and
2626+
(prevE.Top.Y < Pt.Y) and (E.Top.Y < Pt.Y) then
26262627
begin
26272628
X1 := TopX(prevE, Pt.Y);
26282629
X2 := TopX(E, Pt.Y);
@@ -3629,6 +3630,10 @@ procedure TClipper.ProcessHorizontal(HorzEdge: PEdge);
36293630

36303631
if (HorzEdge.OutIdx >= 0) and not IsOpen then //may be done multiple times
36313632
begin
3633+
{$IFDEF use_xyz}
3634+
if (Direction = dLeftToRight) then SetZ(E.Curr, HorzEdge, E, FZFillCallback)
3635+
else SetZ(E.Curr, E, HorzEdge, FZFillCallback);
3636+
{$ENDIF}
36323637
Op1 := AddOutPt(HorzEdge, E.Curr);
36333638
eNextHorz := FSortedEdges;
36343639
while Assigned(eNextHorz) do
@@ -3949,6 +3954,11 @@ procedure TClipper.ProcessEdgesAtTopOfScanbeam(const TopY: cInt);
39493954
begin
39503955
E.Curr.X := TopX(E, TopY);
39513956
E.Curr.Y := TopY;
3957+
{$IFDEF use_xyz}
3958+
if E.Top.Y = TopY then e.Curr.Z := e.Top.Z
3959+
else if (E.Bot.Y = TopY) then e.Curr.Z := E.Bot.Z else
3960+
e.Curr.Z := 0;
3961+
{$ENDIF}
39523962
end;
39533963

39543964
//When StrictlySimple and 'e' is being touched by another edge, then
@@ -4153,7 +4163,7 @@ procedure TClipper.FixupOutPolygon(OutRec: POutRec);
41534163
begin
41544164
if (PP = PP.Prev) or (PP.Next = PP.Prev) then
41554165
begin
4156-
Dispose(PP);
4166+
DisposePolyPts(PP);
41574167
OutRec.Pts := nil;
41584168
Exit;
41594169
end;
@@ -5185,18 +5195,13 @@ procedure TClipperOffset.AddPoint(const Pt: TIntPoint);
51855195
//------------------------------------------------------------------------------
51865196

51875197
procedure TClipperOffset.DoSquare(J, K: Integer);
5188-
var
5189-
A, Dx: Double;
51905198
begin
5191-
//see offset_triginometry.svg in the documentation folder ...
5192-
A := ArcTan2(FSinA, FNorms[K].X * FNorms[J].X + FNorms[K].Y * FNorms[J].Y);
5193-
Dx := tan(A/4);
51945199
AddPoint(IntPoint(
5195-
round(FInP[J].X + FDelta * (FNorms[K].X - FNorms[K].Y *Dx)),
5196-
round(FInP[J].Y + FDelta * (FNorms[K].Y + FNorms[K].X *Dx))));
5200+
round(FInP[J].X + FDelta * (FNorms[K].X - FNorms[K].Y)),
5201+
round(FInP[J].Y + FDelta * (FNorms[K].Y + FNorms[K].X))));
51975202
AddPoint(IntPoint(
5198-
round(FInP[J].X + FDelta * (FNorms[J].X + FNorms[J].Y *Dx)),
5199-
round(FInP[J].Y + FDelta * (FNorms[J].Y - FNorms[J].X *Dx))));
5203+
round(FInP[J].X + FDelta * (FNorms[J].X + FNorms[J].Y)),
5204+
round(FInP[J].Y + FDelta * (FNorms[J].Y - FNorms[J].X))));
52005205
end;
52015206
//------------------------------------------------------------------------------
52025207

0 commit comments

Comments
 (0)