summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/triangle.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/triangle.h b/lib/triangle.h
index 5787094..888481d 100644
--- a/lib/triangle.h
+++ b/lib/triangle.h
@@ -45,6 +45,12 @@ struct Triangle : public glm::vec<3, glm::vec<Dim, T, Q>> {
return crossProduct(sideDifference(1), sideDifference(2));
}
+ [[nodiscard]] constexpr auto
+ height()
+ {
+ return (area() * 2) / glm::length(difference(p(0), p(1)));
+ }
+
[[nodiscard]] constexpr Normal3D
nnormal() const
requires(Dim == 3)