src/geo2d/make_c/rpl/lib.hpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "../../dis/pl/lib.hpp" | ||
| 4 | #include "../../ins/cl/lib.hpp" | ||
| 5 | |||
| 6 | namespace tifa_libs { | ||
| 7 | |||
| 8 | // make circle by radius, a point passed through and a tagante lines | ||
| 9 | // maybe duplicate | ||
| 10 | template <class FP> | ||
| 11 | 104 | CEXP auto make_C_rPL(FP r, point<FP> CR p, line<FP> CR l) NE { | |
| 12 | 104 | std::optional<ptt<circle<FP>>> ret; | |
| 13 | 104 | FP dis = dist_PL(p, l); | |
| 14 |
2/2✓ Branch 1 taken 25 times.
✓ Branch 2 taken 79 times.
|
104 | if (is_pos(dis - r * 2)) return ret; |
| 15 | 79 | point dir = l.direction(); | |
| 16 | 79 | dir *= r / dir.norm(); | |
| 17 | 79 | const point dirl = rot90(dir), dirr = rot270(dir); | |
| 18 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 2 taken 78 times.
|
79 | if (is_zero(dis)) { |
| 19 | 1 | ret.emplace(circle{p + dirl, r}, circle{p + dirr, r}); | |
| 20 | 1 | return ret; | |
| 21 | } | ||
| 22 | 78 | const circle c{p, r}; | |
| 23 | 78 | auto ps = ins_CL(c, {l.l + dirl, l.r + dirl}); | |
| 24 |
4/6✓ Branch 1 taken 35 times.
✓ Branch 2 taken 43 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 35 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 78 times.
|
78 | if (!ps && !(ps = ins_CL(c, {l.l + dirr, l.r + dirr}))) return ret; |
| 25 | 78 | ret.emplace(circle{ps->first, r}, circle{ps->second, r}); | |
| 26 | 78 | return ret; | |
| 27 | } | ||
| 28 | |||
| 29 | } // namespace tifa_libs | ||
| 30 |