()
| 40 | } |
| 41 | |
| 42 | public static void Main() |
| 43 | { |
| 44 | PathsD solution = new(); |
| 45 | PathsD subject = new() |
| 46 | { |
| 47 | Clipper.MakePathZ(new double[] { 100,50,1, 10,79,2, 65,2,3, 65,98,4, 10,21,5 }) |
| 48 | }; |
| 49 | |
| 50 | subject = Clipper.ScalePaths(subject, 3); |
| 51 | ClipperD clipperD = new (); |
| 52 | MyCallbacks cb = new (); |
| 53 | clipperD.ZCallback = cb.MyCallbackD; |
| 54 | clipperD.AddSubject(subject); |
| 55 | clipperD.Execute(ClipType.Union, FillRule.NonZero, solution); |
| 56 | |
| 57 | solution = Clipper.InflatePaths(solution, 12, JoinType.Miter, EndType.Polygon, 6); |
| 58 | Console.WriteLine(solution.ToString(0)); |
| 59 | |
| 60 | SvgWriter svg = new (FillRule.NonZero); |
| 61 | SvgUtils.AddSubject(svg, subject); |
| 62 | SvgUtils.AddSolution(svg, solution, true); |
| 63 | |
| 64 | PathsD ellipses = new (); |
| 65 | for (int i = 0; i < solution[0].Count; i++) |
| 66 | { |
| 67 | if (solution[0][i].z < 0) |
| 68 | ellipses.Add(Clipper.Ellipse( |
| 69 | new PointD(solution[0][i].x, solution[0][i].y), 4)); |
| 70 | if (solution[0][i].z > 0) |
| 71 | svg.AddText(solution[0][i].z.ToString(), |
| 72 | solution[0][i].x -11, solution[0][i].y + 10, 14, 0xFF000000); |
| 73 | } |
| 74 | svg.AddClosedPaths(ellipses, 0x20FF0000, 0xFFFF0000, 1); |
| 75 | svg.SaveToFile("usingz.svg", 500, 500, 50); |
| 76 | OpenFileWithDefaultApp("usingz.svg"); |
| 77 | } |
| 78 | |
| 79 | public static void OpenFileWithDefaultApp(string filename) |
| 80 | { |
nothing calls this directly
no test coverage detected