diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-03-18 00:04:18 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-03-18 00:04:18 +0000 |
commit | c0ff72c1aef7f1ad502b838af899cb0a9be35263 (patch) | |
tree | b8c67898346293829e7a7d02ad93e56fd2c11600 | |
parent | Fix generation of halfedge extrusion extents (diff) | |
download | ilt-c0ff72c1aef7f1ad502b838af899cb0a9be35263.tar.bz2 ilt-c0ff72c1aef7f1ad502b838af899cb0a9be35263.tar.xz ilt-c0ff72c1aef7f1ad502b838af899cb0a9be35263.zip |
Add Ray::intersectPlane
-rw-r--r-- | lib/ray.h | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -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 { |