geom/tri: add a helper that returns the edge segments

This commit is contained in:
Danny Robson 2024-11-07 12:30:24 +10:00
parent 71d8e7d1af
commit c243261dda

View File

@ -9,6 +9,7 @@
#pragma once #pragma once
#include "../point.hpp" #include "../point.hpp"
#include "cruft/util/geom/segment.hpp"
#include "sample/fwd.hpp" #include "sample/fwd.hpp"
#include <cstddef> #include <cstddef>
@ -67,6 +68,19 @@ namespace cruft::geom {
}; };
///////////////////////////////////////////////////////////////////////////
template <std::size_t S, typename T>
std::array<cruft::geom::segment<S,T>, 3>
edges (tri<S,T> const &t)
{
return {{
{ t.a, t.b },
{ t.b, t.c },
{ t.c, t.a },
}};
}
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// n-dimensional triangle area // n-dimensional triangle area
template <std::size_t DimensionV, typename ValueT> template <std::size_t DimensionV, typename ValueT>