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

Function DoErrorTest1_internal

CPP/BenchMark/PointInPolygonBenchmark.cpp:317–345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

315/////////////////////////////////////////////////////////
316
317static void DoErrorTest1_internal(const Path64& pts_of_int, const Paths64& paths,
318 PipFunction pip_func, PointInPolygonResult expected)
319{
320 Path64 error_points;
321
322 for (Point64 poi : pts_of_int)
323 {
324 size_t inside_cnt = 0;
325 for (const Path64& path : paths)
326 if (pip_func(poi, path) == PointInPolygonResult::IsInside) ++inside_cnt;
327 switch (expected)
328 {
329 case PointInPolygonResult::IsInside:
330 if (inside_cnt != 1) error_points.push_back(poi); break;
331 case PointInPolygonResult::IsOutside:
332 if (inside_cnt) error_points.push_back(poi); break;
333 }
334 }
335
336 if (error_points.size())
337 {
338 size_t high_error = error_points.size() - 1;
339 std::cout << SetConsoleTextColor(red_bold) << " Errors at ";
340 for (size_t i = 0; i < high_error; ++i) std::cout << "(" << error_points[i] << "), ";
341 std::cout << "(" << error_points[high_error] << ")." << SetConsoleTextColor(reset) << std::endl;
342 }
343 else
344 std::cout << " No errors found." << std::endl;
345}
346
347static void DoErrorTest1(int index)
348{

Callers 1

DoErrorTest1Function · 0.85

Calls 1

SetConsoleTextColorClass · 0.70

Tested by

no test coverage detected