GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 11 / 0 / 11
Functions: 100.0% 1 / 0 / 1
Branches: 100.0% 18 / 0 / 18

src/geo2d/rel/pop/lib.hpp
Line Branch Exec Source
1 #pragma once
2
3 #include "../../ds/po/lib.hpp"
4 #include "../../pred/is_on_s/lib.hpp"
5
6 namespace tifa_libs {
7
8 // relation between polygon and point
9 // clang-format off
10 enum class RELPoP : u8 { outside, onborder, onendpoint, inside };
11 // clang-format on
12
13 template <class FP>
14 7732 CEXP RELPoP relation_PoP(polygon<FP> CR po, point<FP> CR p) NE {
15
2/2
✓ Branch 5 taken 391377 times.
✓ Branch 6 taken 7519 times.
398896 for (auto&& now : po.vs)
16
2/2
✓ Branch 1 taken 213 times.
✓ Branch 2 taken 391164 times.
391377 if (now == p) return RELPoP::onendpoint;
17 7519 bool result = false;
18
2/2
✓ Branch 1 taken 378756 times.
✓ Branch 2 taken 7215 times.
385971 flt_ (u32, i, 0, po.size()) {
19 378756 point u = po.vs[i], v = po.vs[po.next(i)];
20
2/2
✓ Branch 2 taken 304 times.
✓ Branch 3 taken 378452 times.
378756 if (is_on_S({u, v}, p)) return RELPoP::onborder;
21
2/2
✓ Branch 1 taken 238577 times.
✓ Branch 2 taken 139875 times.
378452 if (!is_gt(u.y, v.y)) swap(u, v);
22
6/6
✓ Branch 1 taken 220490 times.
✓ Branch 2 taken 157962 times.
✓ Branch 4 taken 175693 times.
✓ Branch 5 taken 44797 times.
✓ Branch 6 taken 333655 times.
✓ Branch 7 taken 44797 times.
378452 if (is_gt(p.y, u.y) || !is_gt(p.y, v.y)) continue;
23 44797 result ^= sgn_cross(p, u, v) > 0;
24 }
25
2/2
✓ Branch 0 taken 2938 times.
✓ Branch 1 taken 4277 times.
7215 retif_((result), RELPoP::inside, RELPoP::outside);
26 }
27
28 } // namespace tifa_libs
29