From c243261ddab05cb03246a10af78d22d4d8988d3e Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Thu, 7 Nov 2024 12:30:24 +1000 Subject: [PATCH] geom/tri: add a helper that returns the edge segments --- cruft/util/geom/tri.hpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cruft/util/geom/tri.hpp b/cruft/util/geom/tri.hpp index 970d3b20..b12049fc 100644 --- a/cruft/util/geom/tri.hpp +++ b/cruft/util/geom/tri.hpp @@ -9,6 +9,7 @@ #pragma once #include "../point.hpp" +#include "cruft/util/geom/segment.hpp" #include "sample/fwd.hpp" #include @@ -67,6 +68,19 @@ namespace cruft::geom { }; + /////////////////////////////////////////////////////////////////////////// + template + std::array, 3> + edges (tri const &t) + { + return {{ + { t.a, t.b }, + { t.b, t.c }, + { t.c, t.a }, + }}; + } + + /////////////////////////////////////////////////////////////////////////// // n-dimensional triangle area template