summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-03-18 00:04:18 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-03-18 00:04:18 +0000
commitc0ff72c1aef7f1ad502b838af899cb0a9be35263 (patch)
treeb8c67898346293829e7a7d02ad93e56fd2c11600 /lib
parentFix generation of halfedge extrusion extents (diff)
downloadilt-c0ff72c1aef7f1ad502b838af899cb0a9be35263.tar.bz2
ilt-c0ff72c1aef7f1ad502b838af899cb0a9be35263.tar.xz
ilt-c0ff72c1aef7f1ad502b838af899cb0a9be35263.zip
Add Ray::intersectPlane
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
{