-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Another minor bugfix in GetIntersectPoint(). (#568)
And a minor code tidy.
- Loading branch information
1 parent
5f1699d
commit 562ef2d
Showing
9 changed files
with
160 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/******************************************************************************* | ||
* Author : Angus Johnson * | ||
* Date : 24 January 2023 * | ||
* Website : http://www.angusj.com * | ||
* Copyright : Angus Johnson 2010-2023 * | ||
* License : http://www.boost.org/LICENSE_1_0.txt * | ||
*******************************************************************************/ | ||
|
||
using System.Collections.Generic; | ||
using System.Reflection; | ||
using System.IO; | ||
using System; | ||
using System.Security.Cryptography; | ||
using System.Xml.Linq; | ||
using System.Runtime.InteropServices; | ||
using System.Diagnostics; | ||
|
||
using Clipper2Lib; | ||
|
||
public class Application | ||
{ | ||
public class MyCallbacks | ||
{ | ||
public void MyCallback64(Point64 bot1, Point64 top1, | ||
Point64 bot2, Point64 top2, ref Point64 intersectPt) | ||
{ | ||
intersectPt.Z = 1; | ||
} | ||
|
||
public void MyCallbackD(PointD bot1, PointD top1, | ||
PointD bot2, PointD top2, ref PointD intersectPt) | ||
{ | ||
intersectPt.z = 1; | ||
} | ||
} | ||
|
||
public static void Main() | ||
{ | ||
PathsD solution = new PathsD(); | ||
PathsD subject = new PathsD(); | ||
subject.Add(Clipper.MakePath(new double[] { 100, 50, 10, 79, 65, 2, 65, 98, 10, 21 })); | ||
|
||
ClipperD clipperD = new ClipperD(); | ||
MyCallbacks cb = new MyCallbacks(); | ||
clipperD.ZCallback = cb.MyCallbackD; | ||
clipperD.AddSubject(subject); | ||
clipperD.Execute(ClipType.Union, FillRule.NonZero, solution); | ||
|
||
|
||
Console.WriteLine(solution.ToString(0)); | ||
|
||
SvgWriter svg= new SvgWriter(FillRule.NonZero); | ||
SvgUtils.AddSubject(svg, subject); | ||
SvgUtils.AddSolution(svg, solution, false); | ||
|
||
PathsD ellipses = new PathsD(); | ||
for (int i = 0; i < solution[0].Count; i++) | ||
{ | ||
if (solution[0][i].z == 1) | ||
ellipses.Add(Clipper.Ellipse( | ||
new PointD(solution[0][i].x, solution[0][i].y), 4)); | ||
} | ||
svg.AddClosedPaths(ellipses, 0x20FF0000, 0xFFFF0000, 1); | ||
svg.SaveToFile("usingz.svg", 300, 300); | ||
OpenFileWithDefaultApp("usingz.svg"); | ||
} | ||
|
||
public static void OpenFileWithDefaultApp(string filename) | ||
{ | ||
string path = Path.GetFullPath(filename); | ||
if (!File.Exists(path)) return; | ||
Process p = new Process() | ||
{ | ||
StartInfo = new ProcessStartInfo(path) { UseShellExecute = true } | ||
}; | ||
p.Start(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> | ||
<DefineConstants>$(DefineConstants);USINGZ</DefineConstants> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\USINGZ\Clipper2LibZ.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Compile Include="..\Utils\SVG\Clipper.SVG.cs" Link="Clipper.SVG.cs" /> | ||
<Compile Include="..\Utils\SVG\Clipper.SVG.Utils.cs" Link="Clipper.SVG.Utils.cs" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.4.33205.214 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UsingZTestApp", "UsingZTestApp.csproj", "{34A93225-8048-4A5A-8741-BC619C13C7B0}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Clipper2LibZ", "..\USINGZ\Clipper2LibZ.csproj", "{C50EB9B5-CE07-49DE-B147-941DBFB4FA4E}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{34A93225-8048-4A5A-8741-BC619C13C7B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{34A93225-8048-4A5A-8741-BC619C13C7B0}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{34A93225-8048-4A5A-8741-BC619C13C7B0}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{34A93225-8048-4A5A-8741-BC619C13C7B0}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{C50EB9B5-CE07-49DE-B147-941DBFB4FA4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{C50EB9B5-CE07-49DE-B147-941DBFB4FA4E}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{C50EB9B5-CE07-49DE-B147-941DBFB4FA4E}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{C50EB9B5-CE07-49DE-B147-941DBFB4FA4E}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {0E1221D6-32D4-4974-9205-DE97EC5F4937} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters