diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-01-13 01:45:43 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-01-21 20:58:55 +0000 |
commit | 1aba027462a861f2c1155672792dbbe555d7dc0a (patch) | |
tree | f406c86cc0c610c05da63fc508d8963f0cb61ba4 /lib/ray.h | |
parent | Add default Q = glm::defaultp to maths functions (diff) | |
download | ilt-1aba027462a861f2c1155672792dbbe555d7dc0a.tar.bz2 ilt-1aba027462a861f2c1155672792dbbe555d7dc0a.tar.xz ilt-1aba027462a861f2c1155672792dbbe555d7dc0a.zip |
Add distance helperterrain-for-networks
Works with integer positions, first template param allows forcing to N dimensions
Diffstat (limited to 'lib/ray.h')
-rw-r--r-- | lib/ray.h | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -27,8 +27,7 @@ public: const auto n2 = crossProduct(direction, n); const auto c1 = p1 + PositionType((glm::dot(RelativePosition3D(start - p1), n2) / glm::dot(d1, n2)) * d1); const auto difflength = glm::length(diff); - if (glm::length(RelativePosition3D(c1 - p1)) > difflength - || glm::length(RelativePosition3D(c1 - e1)) > difflength) { + if (::distance(c1, p1) > difflength || ::distance(c1, e1) > difflength) { return std::numeric_limits<typename PositionType::value_type>::infinity(); } return static_cast<PositionType::value_type>(glm::abs(glm::dot(n, RelativePosition3D(p1 - start)))); |