src/geo2d/rel/cc/lib.hpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "../../dis/pp_p/lib.hpp" | ||
| 4 | #include "../../ds/c/lib.hpp" | ||
| 5 | |||
| 6 | namespace tifa_libs { | ||
| 7 | |||
| 8 | // relation between circle and circle | ||
| 9 | // clang-format off | ||
| 10 | enum class RELCC : u8 { lyingin, touchin, intersect, touchex, lyingout }; | ||
| 11 | // clang-format on | ||
| 12 | |||
| 13 | template <class FP> | ||
| 14 | 18928441 | CEXP RELCC relation_CC(circle<FP> CR c1, circle<FP> CR c2) NE { | |
| 15 |
2/2✓ Branch 1 taken 2622938 times.
✓ Branch 2 taken 16305503 times.
|
18928441 | if (const auto d1 = comp_distp(c1.o, c2.o, c1.r + c2.r); d1 > 0) return RELCC::lyingout; |
| 16 |
2/2✓ Branch 0 taken 11908 times.
✓ Branch 1 taken 16293595 times.
|
16305503 | else if (d1 == 0) return RELCC::touchex; |
| 17 |
2/2✓ Branch 2 taken 5577087 times.
✓ Branch 3 taken 10716508 times.
|
16293595 | if (const auto d2 = comp_distp(c1.o, c2.o, abs(c1.r - c2.r)); d2 > 0) return RELCC::intersect; |
| 18 |
2/2✓ Branch 0 taken 18004 times.
✓ Branch 1 taken 10698504 times.
|
10716508 | else if (d2 == 0) return RELCC::touchin; |
| 19 | 10698504 | return RELCC::lyingin; | |
| 20 | } | ||
| 21 | |||
| 22 | } // namespace tifa_libs | ||
| 23 |