src/geo2d/ains/cc/lib.hpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "../../ds/c/lib.hpp" | ||
| 4 | #include "../../rel/cc/lib.hpp" | ||
| 5 | |||
| 6 | namespace tifa_libs { | ||
| 7 | |||
| 8 | template <class FP> | ||
| 9 | 40 | CEXP FP area_CC(circle<FP> CR c1, circle<FP> CR c2) NE { | |
| 10 | 40 | const auto relation = relation_CC(c1, c2); | |
| 11 |
4/4✓ Branch 0 taken 37 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 32 times.
|
40 | if (relation == RELCC::lyingout || relation == RELCC::touchex) return FP{}; |
| 12 |
4/4✓ Branch 0 taken 27 times.
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 23 times.
|
32 | if (relation == RELCC::lyingin || relation == RELCC::touchin) return min(c1.area(), c2.area()); |
| 13 | 23 | const FP d = dist_PP(c1.o, c2.o); | |
| 14 | 23 | return c1.crown_area(std::acos((c1.r * c1.r - c2.r * c2.r + d * d) / (2 * c1.r * d)) * 2) + | |
| 15 | 23 | c2.crown_area(std::acos((c2.r * c2.r - c1.r * c1.r + d * d) / (2 * c2.r * d)) * 2); | |
| 16 | } | ||
| 17 | |||
| 18 | } // namespace tifa_libs | ||
| 19 |