diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-11-26 13:51:33 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-11-26 14:14:13 +0000 |
commit | 7fba471728f2216d7e3b7900297fc3b3531e286c (patch) | |
tree | 5caef3b2efc23aefccb215ec9005cd8e7d2e91b8 /lib/ray.cpp | |
parent | Fix todo for handling a terrain walk from outside the mesh (diff) | |
parent | Model positions as integers (diff) | |
download | ilt-7fba471728f2216d7e3b7900297fc3b3531e286c.tar.bz2 ilt-7fba471728f2216d7e3b7900297fc3b3531e286c.tar.xz ilt-7fba471728f2216d7e3b7900297fc3b3531e286c.zip |
Merge branch 'ints' into terrain
Conflicts fix, compiles, some test failures remain.
Trees not added, possibility of OM invalid handle assertion failures,
normals broken due to integer overflow in Newell's method.
Diffstat (limited to 'lib/ray.cpp')
-rw-r--r-- | lib/ray.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/ray.cpp b/lib/ray.cpp index c4e0d8c..9fb3648 100644 --- a/lib/ray.cpp +++ b/lib/ray.cpp @@ -2,13 +2,13 @@ #include <algorithm> Ray -Ray::fromPoints(glm::vec3 start, glm::vec3 p) +Ray::fromPoints(Position3D start, Position3D p) { return {start, glm::normalize(p - start)}; } float -Ray::distanceToLine(const glm::vec3 & p1, const glm::vec3 & e1) const +Ray::distanceToLine(const Position3D & p1, const Position3D & e1) const { // https://en.wikipedia.org/wiki/Skew_lines const auto diff = p1 - e1; @@ -25,10 +25,10 @@ Ray::distanceToLine(const glm::vec3 & p1, const glm::vec3 & e1) const } bool -Ray::passesCloseToEdges(const std::span<const glm::vec3> positions, float distance) const +Ray::passesCloseToEdges(const std::span<const Position3D> positions, float distance) const { return std::adjacent_find(positions.begin(), positions.end(), - [this, distance](const glm::vec3 & a, const glm::vec3 & b) { + [this, distance](const Position3D & a, const Position3D & b) { return distanceToLine(a, b) <= distance; }) != positions.end(); |