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

Function TestingZ_Double

CPP/Examples/UsingZ/UsingZ.cpp:73–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73void TestingZ_Double()
74{
75 PathsD subject, solution;
76 MyClass mc;
77 ClipperD c;
78
79 subject.push_back(MakePathD({ 100, 50, 10, 79, 65, 2, 65, 98, 10, 21 }));
80 c.AddSubject(subject);
81 c.SetZCallback(
82 std::bind(&MyClass::myZCBD, mc, std::placeholders::_1,
83 std::placeholders::_2, std::placeholders::_3,
84 std::placeholders::_4, std::placeholders::_5));
85 c.Execute(ClipType::Union, FillRule::NonZero, solution);
86
87 SvgWriter svg;
88 SvgAddSubject(svg, subject, FillRule::NonZero);
89 if (solution.size() > 0)
90 {
91 // draw circles around intersection points
92 PathsD ellipses;
93 double r = 3.0;
94 for (const PointD& pt : solution[0])
95 if (pt.z == 1)
96 ellipses.push_back(Ellipse(RectD(pt.x - r, pt.y - r,
97 pt.x + r, pt.y + r), 11));
98
99 SvgAddSolution(svg, ellipses, FillRule::NonZero, false);
100 }
101 SvgSaveToFile(svg, "usingz_double.svg", 320, 320, 0);
102 System("usingz_double.svg");
103}
104
105void System(const std::string &filename)
106{

Callers 1

mainFunction · 0.85

Calls 10

MakePathDFunction · 0.85
SvgAddSubjectFunction · 0.85
EllipseFunction · 0.85
RectDClass · 0.85
SvgAddSolutionFunction · 0.85
SvgSaveToFileFunction · 0.85
SystemFunction · 0.70
AddSubjectMethod · 0.45
SetZCallbackMethod · 0.45
ExecuteMethod · 0.45

Tested by

no test coverage detected