summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ray.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/ray.h b/lib/ray.h
index 67fdd12..a831270 100644
--- a/lib/ray.h
+++ b/lib/ray.h
@@ -43,6 +43,18 @@ public:
}
bool
+ intersectPlane(const PositionType orig, const Direction3D norm, RelativeDistance & distance) const
+ {
+ if constexpr (std::is_floating_point_v<typename PositionType::value_type>) {
+ return glm::intersectRayPlane(start, direction, orig, norm, distance) && distance >= 0.F;
+ }
+ else {
+ const RelativePosition3D origr = orig - start;
+ return glm::intersectRayPlane({}, direction, origr, norm, distance) && distance >= 0.F;
+ }
+ }
+
+ bool
intersectTriangle(const PositionType t0, const PositionType t1, const PositionType t2, BaryPosition & bary,
RelativeDistance & distance) const
{