GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 12 / 0 / 12
Functions: 100.0% 1 / 0 / 1
Branches: 92.9% 13 / 0 / 14

src/geo2d/tan/cc_ex/lib.hpp
Line Branch Exec Source
1 #pragma once
2
3 #include "../../ds/c/lib.hpp"
4 #include "../../ds/l/lib.hpp"
5 #include "../cp/lib.hpp"
6
7 namespace tifa_libs {
8
9 // external tagante lines of 2 circles
10 // maybe duplicate
11 template <class FP>
12 40 CEXP auto extan_CC(circle<FP> CR c1, circle<FP> CR c2) NE {
13 40 std::optional<ptt<line<FP>>> ret;
14
6/6
✓ Branch 1 taken 9 times.
✓ Branch 2 taken 31 times.
✓ Branch 4 taken 1 time.
✓ Branch 5 taken 8 times.
✓ Branch 6 taken 1 time.
✓ Branch 7 taken 39 times.
40 if (is_eq(c1.o.x, c2.o.x) && is_eq(c1.o.y, c2.o.y)) return ret;
15
2/2
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 32 times.
39 if (is_eq(c1.r, c2.r)) {
16 7 point dr = (c2.o - c1.o).do_unit().do_rot90() * c1.r;
17 7 ret.emplace(line{c1.o + dr, c2.o + dr}, line{c1.o - dr, c2.o - dr});
18 7 return ret;
19 }
20 32 const point p = (c2.o * c1.r - c1.o * c2.r) / (c1.r - c2.r);
21 32 const auto ps = tan_CP(c1, p), qs = tan_CP(c2, p);
22
5/6
✓ Branch 1 taken 30 times.
✓ Branch 2 taken 2 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 30 times.
✓ Branch 6 taken 2 times.
✓ Branch 7 taken 30 times.
32 if (!ps || !qs) return ret;
23 // c1 counter-clock wise
24 30 ret.emplace(line{ps->first, qs->first}, line{ps->second, qs->second});
25 30 return ret;
26 }
27
28 } // namespace tifa_libs
29