| 46 | } |
| 47 | |
| 48 | void test2() { |
| 49 | |
| 50 | int64_t const scale = 10; |
| 51 | double delta = 10 * scale; |
| 52 | |
| 53 | ClipperOffset co; |
| 54 | co.SetDeltaCallback([delta](const Path64& path, |
| 55 | const PathD& path_norms, size_t curr_idx, size_t prev_idx) { |
| 56 | // calculate offset based on distance from the middle of the path |
| 57 | double mid_idx = static_cast<double>(path.size()) / 2.0; |
| 58 | return delta * (1.0 - 0.70 * (std::fabs(curr_idx - mid_idx) / mid_idx)); |
| 59 | }); |
| 60 | |
| 61 | Paths64 subject{ Ellipse(Rect64(0, 0, 200 * scale, 180 * scale)) }; |
| 62 | subject[0].resize(subject[0].size() * 0.9); |
| 63 | |
| 64 | co.AddPaths(subject, JoinType::Miter, EndType::Round); |
| 65 | Paths64 solution; |
| 66 | co.Execute(1.0, solution); |
| 67 | |
| 68 | std::string filename = "test2.svg"; |
| 69 | SvgWriter svg; |
| 70 | SvgAddOpenSubject(svg, subject, FillRule::NonZero); |
| 71 | SvgAddSolution(svg, solution, FillRule::NonZero, false); |
| 72 | SvgSaveToFile(svg, filename, 400, 400); |
| 73 | System(filename); |
| 74 | } |
| 75 | |
| 76 | void test3() { |
| 77 |
no test coverage detected