C# refactored Path64, Paths64, PathD & PathsD to derived List classes
Updated framework to .NET5.0
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
RandomPolygons.txt
|
||||
.*
|
||||
|
||||
@@ -6,9 +6,6 @@ using BenchmarkDotNet.Jobs;
|
||||
|
||||
namespace Clipper2Lib.Benchmark
|
||||
{
|
||||
using Path64 = List<Point64>;
|
||||
using Paths64 = List<List<Point64>>;
|
||||
|
||||
public class FastConfig : ManualConfig
|
||||
{
|
||||
public FastConfig()
|
||||
@@ -16,7 +13,7 @@ namespace Clipper2Lib.Benchmark
|
||||
Add(DefaultConfig.Instance);
|
||||
AddJob(Job.Default
|
||||
.WithLaunchCount(1)
|
||||
.WithWarmupCount(1)
|
||||
.WithWarmupCount(1)
|
||||
.WithIterationCount(1)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<EnableNETAnalyzers>false</EnableNETAnalyzers>
|
||||
<ApplicationIcon>Clipper2.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Author : Angus Johnson *
|
||||
* Date : 17 July 2022 *
|
||||
* Website : http://www.angusj.com *
|
||||
@@ -14,10 +13,6 @@ using Clipper2Lib;
|
||||
|
||||
namespace ClipperDemo1
|
||||
{
|
||||
|
||||
using Path64 = List<Point64>;
|
||||
using Paths64 = List<List<Point64>>;
|
||||
|
||||
public class Application
|
||||
{
|
||||
|
||||
@@ -71,7 +66,6 @@ namespace ClipperDemo1
|
||||
ClipperFileIO.OpenFileWithDefaultApp("..\\..\\..\\clipperD.svg");
|
||||
}
|
||||
|
||||
|
||||
public static Paths64 LoadPathsFromResource(string resourceName)
|
||||
{
|
||||
using Stream stream = Assembly.GetExecutingAssembly().
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<EnableNETAnalyzers>false</EnableNETAnalyzers>
|
||||
<ApplicationIcon>Clipper2.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Author : Angus Johnson *
|
||||
* Date : 16 May 2022 *
|
||||
* Date : 16 September 2022 *
|
||||
* Website : http://www.angusj.com *
|
||||
* Copyright : Angus Johnson 2010-2022 *
|
||||
* License : http://www.boost.org/LICENSE_1_0.txt *
|
||||
@@ -15,10 +14,6 @@ using Clipper2Lib;
|
||||
namespace ClipperDemo1
|
||||
{
|
||||
|
||||
using Paths64 = List<List<Point64>>;
|
||||
using PathD = List<PointD>;
|
||||
using PathsD = List<List<PointD>>;
|
||||
|
||||
public class Application
|
||||
{
|
||||
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Clipper2Lib.UnitTests
|
||||
{
|
||||
using Paths64 = List<List<Point64>>;
|
||||
|
||||
[TestClass]
|
||||
public class TestLines
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Clipper2Lib.UnitTests
|
||||
{
|
||||
using Paths64 = List<List<Point64>>;
|
||||
|
||||
[TestClass]
|
||||
public class TestPolygons
|
||||
@@ -43,9 +40,9 @@ namespace Clipper2Lib.UnitTests
|
||||
}
|
||||
|
||||
if (count > 0 && Math.Abs(solution.Count - count) > 2 &&
|
||||
(double)Math.Abs(solution.Count - count)/count > 0.02)
|
||||
(double)Math.Abs(solution.Count - count)/count > 0.03)
|
||||
{
|
||||
Assert.IsTrue(Math.Abs(solution.Count - count) < 4,
|
||||
Assert.IsTrue(Math.Abs(solution.Count - count) <= 4,
|
||||
string.Format("Incorrect count in test {0}", i));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Clipper2Lib.UnitTests
|
||||
{
|
||||
using Path64 = List<Point64>;
|
||||
using Paths64 = List<List<Point64>>;
|
||||
|
||||
[TestClass]
|
||||
public class TestPolytree
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
// USINGZ compiler directive should have been set in project properties
|
||||
|
||||
namespace Clipper2Lib.UnitTests
|
||||
{
|
||||
using Paths64 = List<List<Point64>>;
|
||||
using PathsD = List<List<PointD>>;
|
||||
|
||||
[TestClass]
|
||||
public class TestingZ_1
|
||||
@@ -141,12 +136,12 @@ namespace Clipper2Lib.UnitTests
|
||||
public void TestMysteryD()
|
||||
{
|
||||
ClipperD c = new ClipperD(5);
|
||||
var bitePoly = new List<PointD>()
|
||||
var bitePoly = new PathD()
|
||||
{
|
||||
new PointD(5, 5, 5), new PointD(10, 5, 5), new PointD(10, 10, 5), new PointD(5, 10, 5)
|
||||
};
|
||||
|
||||
var surfacePoly = new List<PointD>()
|
||||
var surfacePoly = new PathD()
|
||||
{
|
||||
new PointD(0, 0, 5), new PointD(15, 0, 5), new PointD(15, 15, 5), new PointD(0, 15, 5)
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* Author : Angus Johnson *
|
||||
* Version : Clipper2 - ver.1.0.3 *
|
||||
* Date : 23 August 2022 *
|
||||
* Version : Clipper2 - ver.1.0.4 *
|
||||
* Date : 16 September 2022 *
|
||||
* Website : http://www.angusj.com *
|
||||
* Copyright : Angus Johnson 2010-2022 *
|
||||
* Purpose : Core structures and functions for the Clipper Library *
|
||||
@@ -340,9 +340,9 @@ namespace Clipper2Lib
|
||||
rec.top >= top && rec.bottom <= bottom;
|
||||
}
|
||||
|
||||
public List<Point64> AsPath()
|
||||
public Path64 AsPath()
|
||||
{
|
||||
List < Point64 > result = new List<Point64>(4);
|
||||
Path64 result = new Path64(4);
|
||||
result.Add(new Point64(left, top));
|
||||
result.Add(new Point64(right, top));
|
||||
result.Add(new Point64(right, bottom));
|
||||
@@ -405,6 +405,30 @@ namespace Clipper2Lib
|
||||
|
||||
}
|
||||
|
||||
public class Path64 : List<Point64>
|
||||
{
|
||||
public Path64(int reserve = 0) : base(reserve) { }
|
||||
public Path64(Path64 path) : base(path) { }
|
||||
}
|
||||
public class Paths64 : List<Path64>
|
||||
{
|
||||
public Paths64(int reserve = 0) : base(reserve) { }
|
||||
public Paths64(Paths64 paths) : base(paths) { }
|
||||
}
|
||||
|
||||
public class PathD : List<PointD>
|
||||
{
|
||||
public PathD(int reserve = 0) : base(reserve) { }
|
||||
public PathD(PathD path) : base(path) { }
|
||||
}
|
||||
|
||||
public class PathsD : List<PathD>
|
||||
{
|
||||
public PathsD(int reserve = 0) : base(reserve) { }
|
||||
public PathsD(PathsD paths) : base(paths) { }
|
||||
}
|
||||
|
||||
|
||||
// Note: all clipping operations except for Difference are commutative.
|
||||
public enum ClipType
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* Author : Angus Johnson *
|
||||
* Version : Clipper2 - ver.1.0.4 *
|
||||
* Date : 15 September 2022 *
|
||||
* Date : 16 September 2022 *
|
||||
* Website : http://www.angusj.com *
|
||||
* Copyright : Angus Johnson 2010-2022 *
|
||||
* Purpose : This is the main polygon clipping module *
|
||||
@@ -10,7 +10,6 @@
|
||||
* License : http://www.boost.org/LICENSE_1_0.txt *
|
||||
*******************************************************************************/
|
||||
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -19,11 +18,6 @@ using System.Runtime.CompilerServices;
|
||||
namespace Clipper2Lib
|
||||
{
|
||||
|
||||
using Path64 = List<Point64>;
|
||||
using Paths64 = List<List<Point64>>;
|
||||
using PathD = List<PointD>;
|
||||
using PathsD = List<List<PointD>>;
|
||||
|
||||
// Vertex: a pre-clipping data structure. It is used to separate polygons
|
||||
// into ascending and descending 'bounds' (or sides) that start at local
|
||||
// minima and ascend to a local maxima, before descending again.
|
||||
@@ -173,7 +167,7 @@ namespace Clipper2Lib
|
||||
|
||||
public Joiner(OutPt op1, OutPt? op2, Joiner? nextH)
|
||||
{
|
||||
this.idx = -1;
|
||||
idx = -1;
|
||||
this.nextH = nextH;
|
||||
this.op1 = op1;
|
||||
this.op2 = op2;
|
||||
@@ -451,7 +445,7 @@ namespace Clipper2Lib
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private Vertex PrevPrevVertex(Active ae)
|
||||
private static Vertex PrevPrevVertex(Active ae)
|
||||
{
|
||||
if (ae.windDx > 0)
|
||||
return ae.vertexTop!.prev!.prev!;
|
||||
@@ -471,7 +465,7 @@ namespace Clipper2Lib
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private Active? GetMaximaPair(Active ae)
|
||||
private static Active? GetMaximaPair(Active ae)
|
||||
{
|
||||
Active? ae2;
|
||||
ae2 = ae.nextInAEL;
|
||||
@@ -518,7 +512,7 @@ namespace Clipper2Lib
|
||||
{
|
||||
public int Compare(IntersectNode a, IntersectNode b)
|
||||
{
|
||||
var cmp = b.pt.Y.CompareTo(a.pt.Y); //sorting Y dsc
|
||||
int cmp = b.pt.Y.CompareTo(a.pt.Y); //sorting Y dsc
|
||||
if (cmp == 0) return a.pt.X.CompareTo(b.pt.X); //sorting X asc
|
||||
return cmp;
|
||||
}
|
||||
@@ -607,7 +601,7 @@ namespace Clipper2Lib
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private bool OutrecIsAscending(Active hotEdge)
|
||||
private static bool OutrecIsAscending(Active hotEdge)
|
||||
{
|
||||
return (hotEdge == hotEdge.outrec!.frontEdge);
|
||||
}
|
||||
@@ -1037,7 +1031,7 @@ namespace Clipper2Lib
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private bool IsValidAelOrder(Active resident, Active newcomer)
|
||||
private static bool IsValidAelOrder(Active resident, Active newcomer)
|
||||
{
|
||||
if (newcomer.curX != resident.curX)
|
||||
return newcomer.curX > resident.curX;
|
||||
@@ -1108,7 +1102,7 @@ namespace Clipper2Lib
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void InsertRightEdge(Active ae, Active ae2)
|
||||
private static void InsertRightEdge(Active ae, Active ae2)
|
||||
{
|
||||
ae2.nextInAEL = ae.nextInAEL;
|
||||
if (ae.nextInAEL != null) ae.nextInAEL.prevInAEL = ae2;
|
||||
@@ -1262,7 +1256,7 @@ namespace Clipper2Lib
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private bool TestJoinWithPrev1(Active e)
|
||||
private static bool TestJoinWithPrev1(Active e)
|
||||
{
|
||||
// this is marginally quicker than TestJoinWithPrev2
|
||||
// but can only be used when e.PrevInAEL.currX is accurate
|
||||
@@ -1273,7 +1267,7 @@ namespace Clipper2Lib
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private bool TestJoinWithPrev2(Active e, Point64 currPt)
|
||||
private static bool TestJoinWithPrev2(Active e, Point64 currPt)
|
||||
{
|
||||
return IsHotEdge(e) && !IsOpen(e) &&
|
||||
(e.prevInAEL != null) && !IsOpen(e.prevInAEL) &&
|
||||
@@ -1283,7 +1277,7 @@ namespace Clipper2Lib
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private bool TestJoinWithNext1(Active e)
|
||||
private static bool TestJoinWithNext1(Active e)
|
||||
{
|
||||
// this is marginally quicker than TestJoinWithNext2
|
||||
// but can only be used when e.NextInAEL.currX is accurate
|
||||
@@ -1294,7 +1288,7 @@ namespace Clipper2Lib
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private bool TestJoinWithNext2(Active e, Point64 currPt)
|
||||
private static bool TestJoinWithNext2(Active e, Point64 currPt)
|
||||
{
|
||||
return IsHotEdge(e) && !IsOpen(e) &&
|
||||
(e.nextInAEL != null) && !IsOpen(e.nextInAEL) &&
|
||||
@@ -1405,7 +1399,7 @@ namespace Clipper2Lib
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void JoinOutrecPaths(Active ae1, Active ae2)
|
||||
private static void JoinOutrecPaths(Active ae1, Active ae2)
|
||||
{
|
||||
// join ae2 outrec path onto ae1 outrec path and then delete ae2 outrec path
|
||||
// pointers. (NB Only very rarely do the joining ends share the same coords.)
|
||||
@@ -1464,7 +1458,7 @@ namespace Clipper2Lib
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private OutPt AddOutPt(Active ae, Point64 pt)
|
||||
private static OutPt AddOutPt(Active ae, Point64 pt)
|
||||
{
|
||||
OutPt newOp;
|
||||
|
||||
@@ -1535,7 +1529,7 @@ namespace Clipper2Lib
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private Active? FindEdgeWithMatchingLocMin(Active e)
|
||||
private static Active? FindEdgeWithMatchingLocMin(Active e)
|
||||
{
|
||||
Active? result = e.nextInAEL;
|
||||
while (result != null)
|
||||
@@ -1915,7 +1909,7 @@ namespace Clipper2Lib
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private Active? ExtractFromSEL(Active ae)
|
||||
private static Active? ExtractFromSEL(Active ae)
|
||||
{
|
||||
Active? res = ae.nextInSEL;
|
||||
if (res != null)
|
||||
@@ -1925,7 +1919,7 @@ namespace Clipper2Lib
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void Insert1Before2InSEL(Active ae1, Active ae2)
|
||||
private static void Insert1Before2InSEL(Active ae1, Active ae2)
|
||||
{
|
||||
ae1.prevInSEL = ae2.prevInSEL;
|
||||
if (ae1.prevInSEL != null)
|
||||
@@ -2054,7 +2048,7 @@ namespace Clipper2Lib
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private bool ResetHorzDirection(Active horz, Active? maxPair,
|
||||
private static bool ResetHorzDirection(Active horz, Active? maxPair,
|
||||
out long leftX, out long rightX)
|
||||
{
|
||||
if (horz.bot.X == horz.top.X)
|
||||
@@ -2079,14 +2073,14 @@ namespace Clipper2Lib
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private bool HorzIsSpike(Active horz)
|
||||
private static bool HorzIsSpike(Active horz)
|
||||
{
|
||||
Point64 nextPt = NextVertex(horz).pt;
|
||||
return (horz.bot.X < horz.top.X) != (horz.top.X < nextPt.X);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void TrimHorz(Active horzEdge, bool preserveCollinear)
|
||||
private static void TrimHorz(Active horzEdge, bool preserveCollinear)
|
||||
{
|
||||
bool wasTrimmed = false;
|
||||
Point64 pt = NextVertex(horzEdge).pt;
|
||||
@@ -2543,7 +2537,7 @@ namespace Clipper2Lib
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private Joiner? GetHorzTrialParent(OutPt op)
|
||||
private static Joiner? GetHorzTrialParent(OutPt op)
|
||||
{
|
||||
Joiner? joiner = op.joiner;
|
||||
while (joiner != null)
|
||||
@@ -2565,7 +2559,7 @@ namespace Clipper2Lib
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private bool OutPtInTrialHorzList(OutPt op)
|
||||
private static bool OutPtInTrialHorzList(OutPt op)
|
||||
{
|
||||
return op.joiner != null &&
|
||||
((op.joiner.idx < 0) || GetHorzTrialParent(op) != null);
|
||||
@@ -2733,7 +2727,7 @@ namespace Clipper2Lib
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private bool GetHorzExtendedHorzSeg(ref OutPt op, out OutPt op2)
|
||||
private static bool GetHorzExtendedHorzSeg(ref OutPt op, out OutPt op2)
|
||||
{
|
||||
OutRec outRec = GetRealOutRec(op.outrec)!;
|
||||
op2 = op;
|
||||
@@ -2826,9 +2820,8 @@ namespace Clipper2Lib
|
||||
// don't waste time trying to join adjacent vertices
|
||||
((op1.next == op2) && (op1 != op1.outrec.pts)) ||
|
||||
((op2.next == op1) && (op2 != op1.outrec.pts)))) return;
|
||||
|
||||
Joiner joiner = new Joiner(op1, op2, null);
|
||||
joiner.idx = _joinerList.Count;
|
||||
|
||||
Joiner joiner = new Joiner(op1, op2, null) {idx = _joinerList.Count};
|
||||
_joinerList.Add(joiner);
|
||||
}
|
||||
|
||||
@@ -3204,8 +3197,7 @@ namespace Clipper2Lib
|
||||
|
||||
if (_using_polytree)
|
||||
{
|
||||
if (outrec.splits == null)
|
||||
outrec.splits = new List<OutRec>();
|
||||
outrec.splits ??= new List<OutRec>();
|
||||
outrec.splits.Add(newOr);
|
||||
}
|
||||
|
||||
@@ -3336,7 +3328,7 @@ namespace Clipper2Lib
|
||||
}
|
||||
}
|
||||
|
||||
internal bool BuildPath(OutPt op, bool reverse, bool isOpen, Path64 path)
|
||||
internal static bool BuildPath(OutPt op, bool reverse, bool isOpen, Path64 path)
|
||||
{
|
||||
if (op.next == op || (!isOpen && op.next == op.prev)) return false;
|
||||
path.Clear();
|
||||
@@ -3401,7 +3393,7 @@ namespace Clipper2Lib
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private bool Path1InsidePath2(OutRec or1, OutRec or2)
|
||||
private static bool Path1InsidePath2(OutRec or1, OutRec or2)
|
||||
{
|
||||
PointInPolygonResult result;
|
||||
OutPt op = or1.pts!;
|
||||
@@ -3417,7 +3409,7 @@ namespace Clipper2Lib
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private Rect64 GetBounds(Path64 path)
|
||||
private static Rect64 GetBounds(Path64 path)
|
||||
{
|
||||
if (path.Count == 0) return new Rect64();
|
||||
Rect64 result = new Rect64(long.MaxValue, long.MaxValue, -long.MaxValue, -long.MaxValue);
|
||||
@@ -3920,7 +3912,7 @@ namespace Clipper2Lib
|
||||
public double Area()
|
||||
{
|
||||
double result = Polygon == null ? 0 : Clipper.Area(Polygon);
|
||||
foreach (var polyPathBase in _childs)
|
||||
foreach (PolyPathBase polyPathBase in _childs)
|
||||
{
|
||||
PolyPath64 child = (PolyPath64) polyPathBase;
|
||||
result += child.Area();
|
||||
@@ -3960,7 +3952,7 @@ namespace Clipper2Lib
|
||||
public double Area()
|
||||
{
|
||||
double result = Polygon == null ? 0 : Clipper.Area(Polygon);
|
||||
foreach (var polyPathBase in _childs)
|
||||
foreach (PolyPathBase polyPathBase in _childs)
|
||||
{
|
||||
PolyPathD child = (PolyPathD) polyPathBase;
|
||||
result += child.Area();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* Author : Angus Johnson *
|
||||
* Version : Clipper2 - ver.1.0.0 *
|
||||
* Date : 3 August 2022 *
|
||||
* Version : Clipper2 - ver.1.0.4 *
|
||||
* Date : 16 September 2022 *
|
||||
* Website : http://www.angusj.com *
|
||||
* Copyright : Angus Johnson 2010-2022 *
|
||||
* Purpose : Minkowski Sum and Difference *
|
||||
@@ -14,10 +14,6 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Clipper2Lib
|
||||
{
|
||||
using Path64 = List<Point64>;
|
||||
using Paths64 = List<List<Point64>>;
|
||||
using PathD = List<PointD>;
|
||||
using PathsD = List<List<PointD>>;
|
||||
public class Minkowski
|
||||
{
|
||||
private static Paths64 MinkowskiInternal(Path64 pattern, Path64 path, bool isSum, bool isClosed)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* Author : Angus Johnson *
|
||||
* Version : Clipper2 - ver.1.0.4 *
|
||||
* Date : 14 September 2022 *
|
||||
* Date : 16 September 2022 *
|
||||
* Website : http://www.angusj.com *
|
||||
* Copyright : Angus Johnson 2010-2022 *
|
||||
* Purpose : Path Offset (Inflate/Shrink) *
|
||||
@@ -14,11 +14,6 @@ using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Clipper2Lib
|
||||
{
|
||||
|
||||
using Path64 = List<Point64>;
|
||||
using Paths64 = List<List<Point64>>;
|
||||
using PathD = List<PointD>;
|
||||
using PathsD = List<List<PointD>>;
|
||||
public enum JoinType
|
||||
{
|
||||
Square,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* Author : Angus Johnson *
|
||||
* Version : Clipper2 - ver.1.0.4 *
|
||||
* Date : 5 September 2022 *
|
||||
* Date : 16 September 2022 *
|
||||
* Website : http://www.angusj.com *
|
||||
* Copyright : Angus Johnson 2010-2022 *
|
||||
* Purpose : This module contains simple functions that will likely cover *
|
||||
@@ -12,7 +12,6 @@
|
||||
* License : http://www.boost.org/LICENSE_1_0.txt *
|
||||
*******************************************************************************/
|
||||
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
@@ -23,11 +22,6 @@ namespace Clipper2Lib
|
||||
// PRE-COMPILER CONDITIONAL ...
|
||||
// USINGZ: For user defined Z-coordinates. See Clipper.SetZ
|
||||
|
||||
using Path64 = List<Point64>;
|
||||
using Paths64 = List<List<Point64>>;
|
||||
using PathD = List<PointD>;
|
||||
using PathsD = List<List<PointD>>;
|
||||
|
||||
public static class Clipper
|
||||
{
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>8</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>8</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,24 +1,18 @@
|
||||
/*******************************************************************************
|
||||
* Author : Angus Johnson *
|
||||
* Date : 3 July 2022 *
|
||||
* Date : 16 September 2022 *
|
||||
* Website : http://www.angusj.com *
|
||||
* Copyright : Angus Johnson 2010-2022 *
|
||||
* License: *
|
||||
* Use, modification & distribution is subject to Boost Software License Ver 1. *
|
||||
* http://www.boost.org/LICENSE_1_0.txt *
|
||||
* License : http://www.boost.org/LICENSE_1_0.txt *
|
||||
*******************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Clipper2Lib
|
||||
{
|
||||
|
||||
using Path64 = List<Point64>;
|
||||
using Paths64 = List<List<Point64>>;
|
||||
|
||||
public static class ClipperFileIO
|
||||
{
|
||||
public static Paths64 PathFromStr(string s)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
/*******************************************************************************
|
||||
* Author : Angus Johnson *
|
||||
* Date : 3 July 2022 *
|
||||
* Date : 16 September 2022 *
|
||||
* Website : http://www.angusj.com *
|
||||
* Copyright : Angus Johnson 2010-2022 *
|
||||
* License: *
|
||||
* Use, modification & distribution is subject to Boost Software License Ver 1. *
|
||||
* http://www.boost.org/LICENSE_1_0.txt *
|
||||
* License : http://www.boost.org/LICENSE_1_0.txt *
|
||||
*******************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
@@ -14,9 +12,6 @@ using System.IO;
|
||||
namespace Clipper2Lib
|
||||
{
|
||||
|
||||
using Paths64 = List<List<Point64>>;
|
||||
using PathsD = List<List<PointD>>;
|
||||
|
||||
public static class SvgUtils
|
||||
{
|
||||
|
||||
@@ -34,18 +29,32 @@ namespace Clipper2Lib
|
||||
svg.AddPaths(paths, false, 0x1800009C, 0xCCB3B3DA, 0.8);
|
||||
}
|
||||
|
||||
public static void AddSubject(SimpleSvgWriter svg, PathsD paths,
|
||||
bool is_closed = true, bool is_joined = true)
|
||||
{
|
||||
if (!is_closed)
|
||||
svg.AddPaths(paths, !is_joined, 0x0, 0xCCB3B3DA, 0.8);
|
||||
else
|
||||
svg.AddPaths(paths, false, 0x1800009C, 0xCCB3B3DA, 0.8);
|
||||
}
|
||||
|
||||
public static void AddClip(SimpleSvgWriter svg, Paths64 paths)
|
||||
{
|
||||
svg.AddPaths(paths, false, 0x129C0000, 0xCCFFA07A, 0.8);
|
||||
}
|
||||
|
||||
public static void AddClip(SimpleSvgWriter svg, PathsD paths)
|
||||
{
|
||||
svg.AddPaths(paths, false, 0x129C0000, 0xCCFFA07A, 0.8);
|
||||
}
|
||||
|
||||
public static void AddSolution(SimpleSvgWriter svg, Paths64 paths,
|
||||
bool show_coords, bool is_closed = true, bool is_joined = true)
|
||||
{
|
||||
if (!is_closed)
|
||||
svg.AddPaths(paths, !is_joined, 0x0, 0xFF003300, 0.8, show_coords);
|
||||
else
|
||||
svg.AddPaths(paths, false, 0xFF80ff9C, 0xFF003300, 0.8, show_coords);
|
||||
svg.AddPaths(paths, false, 0x4080ff9C, 0xFF003300, 0.8, show_coords);
|
||||
}
|
||||
|
||||
public static void AddSolution(SimpleSvgWriter svg, PathsD paths,
|
||||
@@ -54,7 +63,7 @@ namespace Clipper2Lib
|
||||
if (!is_closed)
|
||||
svg.AddPaths(paths, !is_joined, 0x0, 0xFF003300, 0.8, show_coords);
|
||||
else
|
||||
svg.AddPaths(paths, false, 0xFF80ff9C, 0xFF003300, 0.8, show_coords);
|
||||
svg.AddPaths(paths, false, 0x8080ff9C, 0xFF003300, 0.8, show_coords);
|
||||
}
|
||||
|
||||
public static void SaveToFile(SimpleSvgWriter svg,
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
/*******************************************************************************
|
||||
* Author : Angus Johnson *
|
||||
* Date : 6 April 2022 *
|
||||
* Date : 16 September 2022 *
|
||||
* Website : http://www.angusj.com *
|
||||
* Copyright : Angus Johnson 2010-2022 *
|
||||
* License: *
|
||||
* Use, modification & distribution is subject to Boost Software License Ver 1. *
|
||||
* http://www.boost.org/LICENSE_1_0.txt *
|
||||
* License : http://www.boost.org/LICENSE_1_0.txt *
|
||||
*******************************************************************************/
|
||||
|
||||
using System;
|
||||
@@ -15,11 +13,6 @@ using System.IO;
|
||||
|
||||
namespace Clipper2Lib
|
||||
{
|
||||
|
||||
using PathD = List<PointD>;
|
||||
using Paths64 = List<List<Point64>>;
|
||||
using PathsD = List<List<PointD>>;
|
||||
|
||||
public class SimpleSvgWriter
|
||||
{
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user