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

Function DoBenchmark

CPP/Examples/Benchmarks/Benchmarks.cpp:81–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79}
80
81void DoBenchmark(int edge_cnt_start, int edge_cnt_end,
82 int increment, bool test_polytree)
83{
84 ClipType ct = ClipType::Intersection;
85 FillRule fr = FillRule::NonZero;//EvenOdd;//Positive;//
86
87 Paths64 subject, clip, solution;
88 PolyTree64 polytree;
89 std::cout << std::endl << "Complex Polygons Benchmark: " << std::endl;
90 for (int i = edge_cnt_start; i <= edge_cnt_end; i += increment)
91 {
92 subject.clear();
93 clip.clear();
94 subject.push_back(MakeRandomPoly(800, 600, i));
95 clip.push_back(MakeRandomPoly(800, 600, i));
96 SaveTest( "benchmark_test.txt", false, &subject, nullptr, &clip, 0, 0, ct, fr);
97
98 std::cout << "Edge Count: " << i << " = ";
99 {
100 if (test_polytree)
101 {
102 polytree.Clear();
103 Timer t;
104 BooleanOp(ct, fr, subject, clip, polytree);
105 if (!polytree.Count()) break;
106 }
107 else
108 {
109 Timer t;
110 solution = BooleanOp(ct, fr, subject, clip);
111 if (solution.empty()) break;
112 }
113 }
114 }
115
116 if (test_polytree) solution = PolyTreeToPaths64(polytree);
117
118 SvgWriter svg;
119 SvgAddSubject(svg, subject, fr);
120 SvgAddClip(svg, clip, fr);
121 SvgAddSolution(svg, solution, fr, false);
122 SvgSaveToFile(svg, "solution3.svg", display_width, display_height, 20);
123 System("solution3.svg");
124}
125
126void System(const std::string &filename)
127{

Callers 1

mainFunction · 0.85

Calls 11

SaveTestFunction · 0.85
BooleanOpFunction · 0.85
PolyTreeToPaths64Function · 0.85
SvgAddSubjectFunction · 0.85
SvgAddClipFunction · 0.85
SvgAddSolutionFunction · 0.85
SvgSaveToFileFunction · 0.85
MakeRandomPolyFunction · 0.70
SystemFunction · 0.70
ClearMethod · 0.45
CountMethod · 0.45

Tested by

no test coverage detected