summaryrefslogtreecommitdiff
path: root/lib/triangle.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-12-18 17:24:02 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-12-18 17:24:02 +0000
commita007ffeed3cfa6af2cbe1053c330ad11927d58de (patch)
tree8b97f30bda1e49ee12191e11f68145b2c4dc5e88 /lib/triangle.h
parentMidpoint for integral vectors (diff)
downloadilt-a007ffeed3cfa6af2cbe1053c330ad11927d58de.tar.bz2
ilt-a007ffeed3cfa6af2cbe1053c330ad11927d58de.tar.xz
ilt-a007ffeed3cfa6af2cbe1053c330ad11927d58de.zip
Add sanity checking logic to GeoData
Diffstat (limited to 'lib/triangle.h')
-rw-r--r--lib/triangle.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/triangle.h b/lib/triangle.h
index 888481d..d5547ab 100644
--- a/lib/triangle.h
+++ b/lib/triangle.h
@@ -84,6 +84,14 @@ struct Triangle : public glm::vec<3, glm::vec<Dim, T, Q>> {
}
[[nodiscard]] constexpr auto
+ isUp() const
+ {
+ const auto edgeAB = sideDifference(1);
+ const auto edgeAC = sideDifference(2);
+ return edgeAB.x * edgeAC.y >= edgeAB.y * edgeAC.x;
+ }
+
+ [[nodiscard]] constexpr auto
p(const glm::length_t idx) const
{
return Base::operator[](idx);