From d982157ee2711f2a28a8ca0dc5f882424626217c Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 1 Dec 2024 14:06:28 +0000 Subject: Remove GeoData::difference for points, use global version --- game/geoData.cpp | 4 ++-- game/geoData.h | 13 +++---------- 2 files changed, 5 insertions(+), 12 deletions(-) (limited to 'game') diff --git a/game/geoData.cpp b/game/geoData.cpp index f43e231..a5fc4ef 100644 --- a/game/geoData.cpp +++ b/game/geoData.cpp @@ -361,7 +361,7 @@ GeoData::findBoundaryStart() const [[nodiscard]] RelativePosition3D GeoData::difference(const HalfedgeHandle heh) const { - return point(to_vertex_handle(heh)) - point(from_vertex_handle(heh)); + return ::difference(point(to_vertex_handle(heh)), point(from_vertex_handle(heh))); } [[nodiscard]] RelativeDistance @@ -427,7 +427,7 @@ GeoData::setHeights(const std::span triangleStrip, const const auto vertexDistFrom = [this](GlobalPosition2D p) { return [p, this](const VertexHandle v) { - return std::make_pair(v, glm::length(difference(this->point(v).xy(), p))); + return std::make_pair(v, glm::length(::difference(p, this->point(v).xy()))); }; }; diff --git a/game/geoData.h b/game/geoData.h index 71ec85f..dcc28e0 100644 --- a/game/geoData.h +++ b/game/geoData.h @@ -68,7 +68,7 @@ public: [[nodiscard]] Point operator*(BaryPosition bari) const { - return p(0) + (difference(p(0), p(1)) * bari.x) + (difference(p(0), p(2)) * bari.y); + return p(0) + (::difference(p(1), p(0)) * bari.x) + (::difference(p(2), p(0)) * bari.y); } [[nodiscard]] Point @@ -83,14 +83,14 @@ public: area() const requires(Dim == 3) { - return glm::length(crossProduct(difference(p(0), p(1)), difference(p(0), p(2)))) / 2.F; + return glm::length(crossProduct(::difference(p(1), p(0)), ::difference(p(2), p(0)))) / 2.F; } [[nodiscard]] Normal3D normal() const requires(Dim == 3) { - return crossProduct(difference(p(0), p(1)), difference(p(0), p(2))); + return crossProduct(::difference(p(1), p(0)), ::difference(p(2), p(0))); } [[nodiscard]] Normal3D @@ -190,13 +190,6 @@ protected: [[nodiscard]] HalfedgeHandle findBoundaryStart() const; [[nodiscard]] RelativePosition3D difference(const HalfedgeHandle) const; - template - [[nodiscard]] static RelativePosition - difference(const GlobalPosition a, const GlobalPosition b) - { - return b - a; - } - [[nodiscard]] RelativeDistance length(const HalfedgeHandle) const; [[nodiscard]] GlobalPosition3D centre(const HalfedgeHandle) const; -- cgit v1.2.3