From 6a1df3dfbae98a05e74c646cc216fbc19ffdb6d6 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 7 Jan 2024 13:04:31 +0000 Subject: Template Ray on position type --- game/network/link.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'game/network/link.cpp') 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 & 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 & 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::lround(segs)) + 1; - std::vector points; + std::vector 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})}; -- cgit v1.2.3