From ea393a85a572e94f4c76e79cbd16897f9eae55f5 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 15 Dec 2024 14:53:05 +0000 Subject: Triangle height support Point C from the line AB --- lib/triangle.h | 6 ++++++ 1 file changed, 6 insertions(+) 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> { 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) -- cgit v1.2.3