eryon_core/utils/
area.rs

1/*
2    Appellation: area <module>
3    Contrib: @FL03
4*/
5
6/// given the coordinates of the vertices of a triangle, calculate the area
7pub fn triangle_area<T>((a, b): (T, T), (c, d): (T, T), (e, f): (T, T)) -> T
8where
9    T: num::Float,
10{
11    let half = T::from(2).unwrap().recip();
12    half * ((c - a) * (f - b) - (e - a) * (d - b)).abs()
13}