src/geo2d/dis/ps/lib.hpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "../../dis/pp_p/lib.hpp" | ||
| 4 | #include "../../pred/is_in_middle_p/lib.hpp" | ||
| 5 | #include "../../proj/lib.hpp" | ||
| 6 | |||
| 7 | namespace tifa_libs { | ||
| 8 | |||
| 9 | // the point which is min dist_PP from a point to another point which belongs to a segment | ||
| 10 | template <class FP> | ||
| 11 | 12756 | CEXP point<FP> dist_PS_P(point<FP> CR p, line<FP> CR s) NE { | |
| 12 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 2 taken 12755 times.
|
12756 | if (s.l == s.r) return s.l; |
| 13 |
2/2✓ Branch 2 taken 2155 times.
✓ Branch 3 taken 10600 times.
|
12755 | if (const point<FP> h = proj(s, p); is_in_middle(s.l, h, s.r)) return h; |
| 14 |
2/2✓ Branch 1 taken 6308 times.
✓ Branch 2 taken 4292 times.
|
10600 | retif_((comp_distp(s.l, p, s.r, p) < 0), s.l, s.r); |
| 15 | } | ||
| 16 | // min dist_PP from a point to another point which belongs to a segment | ||
| 17 | template <class FP> | ||
| 18 | 11732 | CEXP FP dist_PS(point<FP> CR p, line<FP> CR s) NE { return dist_PP(dist_PS_P(p, s), p); } | |
| 19 | |||
| 20 | } // namespace tifa_libs | ||
| 21 |