From 889baa0abe996976d8717e7e411961804b853465 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 3 Nov 2023 20:10:56 +0000 Subject: Helper to get cartesian position from baricentric on Triangle --- game/terrain2.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'game/terrain2.h') diff --git a/game/terrain2.h b/game/terrain2.h index f1d288e..da9f823 100644 --- a/game/terrain2.h +++ b/game/terrain2.h @@ -53,6 +53,13 @@ public: return m->point(vh); }); } + + glm::vec + operator*(glm::vec2 bari) const + { + const auto & t {*this}; + return t[0] + ((t[1] - t[0]) * bari.x) + ((t[2] - t[1]) * bari.y); + } }; [[nodiscard]] FaceHandle findPoint(glm::vec2) const; -- cgit v1.2.3