diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-02-14 02:07:04 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-02-14 02:07:04 +0000 |
commit | 861c046ed527474a18a1358246a818ce70bb0b75 (patch) | |
tree | e0bf430608dd3c4e54de333832aa2bf6f3b6aa00 | |
parent | Fix getting cartesian coords from triangle baripos (diff) | |
download | ilt-861c046ed527474a18a1358246a818ce70bb0b75.tar.bz2 ilt-861c046ed527474a18a1358246a818ce70bb0b75.tar.xz ilt-861c046ed527474a18a1358246a818ce70bb0b75.zip |
Check ray intersects triangle 'in front' of start
-rw-r--r-- | lib/ray.h | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -47,11 +47,11 @@ public: RelativeDistance & distance) const { if constexpr (std::is_floating_point_v<typename PositionType::value_type>) { - return glm::intersectRayTriangle(start, direction, t0, t1, t2, bary, distance); + return glm::intersectRayTriangle(start, direction, t0, t1, t2, bary, distance) && distance >= 0.F; } else { const RelativePosition3D t0r = t0 - start, t1r = t1 - start, t2r = t2 - start; - return glm::intersectRayTriangle({}, direction, t0r, t1r, t2r, bary, distance); + return glm::intersectRayTriangle({}, direction, t0r, t1r, t2r, bary, distance) && distance >= 0.F; } } |