shape_core/elements/triangles/
indexes.rs

1use super::*;
2
3impl Neg for TriangleIndex {
4    type Output = Self;
5
6    fn neg(self) -> Self::Output {
7        Self { a: self.a, b: self.c, c: self.b }
8    }
9}
10
11impl TriangleIndex {
12    /// Construct new triangle index
13    pub fn new(a: usize, b: usize, c: usize) -> Self {
14        Self { a, b, c }
15    }
16    /// Returns the minimum index in the triangle index.
17    pub fn min(&self) -> usize {
18        self.a.min(self.b).min(self.c)
19    }
20    /// Returns the maximum index in the triangle index, used to check if the triangle index is valid
21    pub fn max(&self) -> usize {
22        self.a.max(self.b).max(self.c)
23    }
24}