diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-01-07 13:04:31 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-01-07 13:04:31 +0000 |
commit | 6a1df3dfbae98a05e74c646cc216fbc19ffdb6d6 (patch) | |
tree | 46c42bcbef1f12c4f46d53b4e0c4736bea506b51 /game/network/link.cpp | |
parent | Unified crossProduct (diff) | |
download | ilt-6a1df3dfbae98a05e74c646cc216fbc19ffdb6d6.tar.bz2 ilt-6a1df3dfbae98a05e74c646cc216fbc19ffdb6d6.tar.xz ilt-6a1df3dfbae98a05e74c646cc216fbc19ffdb6d6.zip |
Template Ray on position type
Diffstat (limited to 'game/network/link.cpp')
-rw-r--r-- | game/network/link.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/game/network/link.cpp b/game/network/link.cpp index 703a1ca..e8eaea2 100644 --- a/game/network/link.cpp +++ b/game/network/link.cpp @@ -33,9 +33,10 @@ LinkStraight::positionAt(float dist, unsigned char start) const } bool -LinkStraight::intersectRay(const Ray & ray) const +LinkStraight::intersectRay(const Ray<GlobalPosition3D> & ray) const { - return ray.passesCloseToEdges(std::array {ends.front().node->pos, ends.back().node->pos}, 1.F); + return ray.passesCloseToEdges( + std::array {GlobalPosition3D {ends.front().node->pos}, GlobalPosition3D {ends.back().node->pos}}, 1000); } Location @@ -54,7 +55,7 @@ LinkCurve::positionAt(float dist, unsigned char start) const } bool -LinkCurve::intersectRay(const Ray & ray) const +LinkCurve::intersectRay(const Ray<GlobalPosition3D> & ray) const { const auto & e0p {ends[0].node->pos}; const auto & e1p {ends[1].node->pos}; @@ -64,7 +65,7 @@ LinkCurve::intersectRay(const Ray & ray) const const auto trans {glm::translate(centreBase)}; auto segCount = static_cast<std::size_t>(std::lround(segs)) + 1; - std::vector<Position3D> points; + std::vector<GlobalPosition3D> points; points.reserve(segCount); for (Position3D swing = {arc.first, centreBase.z - e0p.z, 0.F}; segCount; swing += step, --segCount) { const auto t {trans * glm::rotate(half_pi - swing.x, up) * glm::translate(Position3D {radius, 0.F, swing.y})}; |