MCPcopy Create free account
hub / github.com/AngusJohnson/Clipper2 / TrianglesTest

Method TrianglesTest

CSharp/Examples/ConsoleDemo/Main.cs:70–96  ·  view source on GitHub ↗
(bool test_polytree = false)

Source from the content-addressed store, hash-verified

68 }
69
70 public static void TrianglesTest(bool test_polytree = false)
71 {
72 Path64 tri1 = Clipper.MakePath(new int[] { 0,0, 20,0, 10,20 });
73 Path64 tri2 = Clipper.MakePath(new int[] { 20,0, 10,20, 30,20 });
74
75 Paths64 subjects = new(), solution;
76 Random rand = new();
77 for (int i = 0; i < 600 / 10 / 2; ++i)
78 {
79 for (int j = 0; j < 800 / 10 / 2; ++j)
80 {
81 if (rand.Next(4) != 0) subjects.Add(tri1);
82 if (rand.Next(4) != 0) subjects.Add(tri2);
83 tri1 = Clipper.TranslatePath(tri1, 20, 0);
84 tri2 = Clipper.TranslatePath(tri2, 20, 0);
85
86 }
87 tri1 = Clipper.TranslatePath(tri1, (-800 / 10) * 10, 20);
88 tri2 = Clipper.TranslatePath(tri2, (-800 / 10) * 10, 20);
89 }
90
91 if (test_polytree)
92 solution = Polytree_Union(subjects, FillRule.NonZero);
93 else
94 solution = Clipper.Union(subjects, FillRule.NonZero);
95 DisplayAsSvgImage("Triangles", FillRule.NonZero, subjects, null, solution);
96 }
97
98 public static void DiamondsTest(bool test_polytree = false)
99 {

Callers

nothing calls this directly

Calls 6

MakePathMethod · 0.80
NextMethod · 0.80
TranslatePathMethod · 0.80
UnionMethod · 0.80
DisplayAsSvgImageFunction · 0.50
AddMethod · 0.45

Tested by

no test coverage detected