13#include <lagrange/utils/span.h>
28template <
typename Scalar>
31 const Scalar n0 = (a[1] - b[1]) * (a[2] - c[2]) - (a[1] - c[1]) * (a[2] - b[2]);
32 const Scalar n1 = -(a[0] - b[0]) * (a[2] - c[2]) + (a[0] - c[0]) * (a[2] - b[2]);
33 const Scalar n2 = (a[0] - b[0]) * (a[1] - c[1]) - (a[0] - c[0]) * (a[1] - b[1]);
35 return std::sqrt(n0 * n0 + n1 * n1 + n2 * n2) / 2;
47template <
typename Scalar>
50 return ((a[0] - b[0]) * (a[1] - c[1]) - (a[0] - c[0]) * (a[1] - b[1])) / 2;
::nonstd::span< T, Extent > span
A bounds-safe view for sequences of objects.
Definition: span.h:27
Main namespace for Lagrange.
Definition: AABBIGL.h:30
Scalar triangle_area_2d(span< const Scalar, 2 > a, span< const Scalar, 2 > b, span< const Scalar, 2 > c)
Compute 2D triangle signed area.
Definition: triangle_area.h:48
Scalar triangle_area_3d(span< const Scalar, 3 > a, span< const Scalar, 3 > b, span< const Scalar, 3 > c)
Compute 3D triangle area.
Definition: triangle_area.h:29