src/geo2d/pred/is_ins_ss/lib.hpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "../../ds/l/lib.hpp" | ||
| 4 | |||
| 5 | namespace tifa_libs { | ||
| 6 | |||
| 7 | // judge if two segments are intersected | ||
| 8 | template <class FP, bool contain_endpoints = true> | ||
| 9 | 11466 | CEXP bool is_ins_SS(line<FP> CR s1, line<FP> CR s2) NE { | |
| 10 | if CEXP (contain_endpoints) | ||
| 11 |
2/2✓ Branch 1 taken 2930 times.
✓ Branch 2 taken 2466 times.
|
16862 | return is_intersect(s1.l.x, s1.r.x, s2.l.x, s2.r.x) && |
| 12 | 5396 | is_intersect(s1.l.y, s1.r.y, s2.l.y, s2.r.y) && | |
| 13 |
4/4✓ Branch 0 taken 5396 times.
✓ Branch 1 taken 6070 times.
✓ Branch 4 taken 1934 times.
✓ Branch 5 taken 996 times.
|
18796 | s1.toleft(s2.l) * s1.toleft(s2.r) <= 0 && |
| 14 |
2/2✓ Branch 2 taken 1114 times.
✓ Branch 3 taken 820 times.
|
13400 | s2.toleft(s1.l) * s2.toleft(s1.r) <= 0; |
| 15 | else return s1.toleft(s2.l) * s1.toleft(s2.r) < 0 && | ||
| 16 | s2.toleft(s1.l) * s2.toleft(s1.r) < 0; | ||
| 17 | } | ||
| 18 | |||
| 19 | } // namespace tifa_libs | ||
| 20 |