summaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-11-03 20:10:56 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-11-03 20:10:56 +0000
commit889baa0abe996976d8717e7e411961804b853465 (patch)
tree51916341689250a4d09ca63df22ce6031a6e3dd8 /game
parentIncrease BOOST_CHECK_CLOSE_VEC stream precision (diff)
downloadilt-889baa0abe996976d8717e7e411961804b853465.tar.bz2
ilt-889baa0abe996976d8717e7e411961804b853465.tar.xz
ilt-889baa0abe996976d8717e7e411961804b853465.zip
Helper to get cartesian position from baricentric on Triangle
Diffstat (limited to 'game')
-rw-r--r--game/terrain2.h7
1 files changed, 7 insertions, 0 deletions
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<Dim, glm::vec2::value_type>
+ 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;