src/geo3d/rel/plp/lib.hpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "../../ds/pl/lib.hpp" | ||
| 4 | |||
| 5 | namespace tifa_libs { | ||
| 6 | |||
| 7 | // relation between plane and point3d | ||
| 8 | // clang-format off | ||
| 9 | enum class RELPLP : u8 { above, in, below }; | ||
| 10 | // clang-format on | ||
| 11 | |||
| 12 | template <class FP> | ||
| 13 | 3829 | CEXP RELPLP relation_PlP(planev<FP> CR pl, point3d<FP> CR p) NE { | |
| 14 | 3829 | const FP d = (p - *pl.u) * pl.normal(); | |
| 15 |
2/2✓ Branch 1 taken 1191 times.
✓ Branch 2 taken 2638 times.
|
3829 | if (is_pos(d)) return RELPLP::above; |
| 16 |
2/2✓ Branch 1 taken 2282 times.
✓ Branch 2 taken 356 times.
|
2638 | if (is_neg(d)) return RELPLP::below; |
| 17 | 356 | return RELPLP::in; | |
| 18 | } | ||
| 19 | |||
| 20 | } // namespace tifa_libs | ||
| 21 |