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

Function test4

CPP/Examples/VariableOffset/VariableOffset.cpp:104–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104void test4() {
105
106 int64_t const scale = 100;
107 Paths64 solution;
108 Paths64 subject = { Ellipse(ScaleRect<int64_t,int64_t>(Rect64(10, 10, 50, 50), scale)) };
109
110 ClipperOffset co;
111 co.AddPaths(subject, JoinType::Round, EndType::Round);
112 co.Execute(
113 [scale](const Path64& path,
114 const PathD& path_norms, size_t curr_idx, size_t prev_idx) {
115 //double vertex_sin_a = CrossProduct(path_norms[curr_idx], path_norms[prev_idx]);
116 //double vertex_cos_a = DotProduct(path_norms[curr_idx], path_norms[prev_idx]);
117 //double vertex_angle = std::atan2(vertex_sin_a, vertex_cos_a);
118 //double edge_angle = std::atan2(path_norms[curr_idx].y, path_norms[curr_idx].x);
119 double sin_edge = path_norms[curr_idx].y;
120 return Sqr(sin_edge) * 3 * scale; }
121 , solution);
122
123 std::string filename = "test4.svg";
124 SvgWriter svg;
125 SvgAddOpenSubject(svg, subject, FillRule::NonZero);
126 SvgAddSolution(svg, solution, FillRule::NonZero, false);
127 SvgSaveToFile(svg, filename, 400, 400);
128 System(filename);
129}
130
131void test5() {
132

Callers 1

mainFunction · 0.85

Calls 9

EllipseFunction · 0.85
Rect64Class · 0.85
SqrFunction · 0.85
SvgAddOpenSubjectFunction · 0.85
SvgAddSolutionFunction · 0.85
SvgSaveToFileFunction · 0.85
SystemFunction · 0.70
AddPathsMethod · 0.45
ExecuteMethod · 0.45

Tested by

no test coverage detected