1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use super::*;

impl Neg for TriangleIndex {
    type Output = Self;

    fn neg(self) -> Self::Output {
        Self { a: self.a, b: self.c, c: self.b }
    }
}

impl TriangleIndex {
    /// Construct new triangle index
    pub fn new(a: usize, b: usize, c: usize) -> Self {
        Self { a, b, c }
    }
    /// Returns the minimum index in the triangle index.
    pub fn min(&self) -> usize {
        self.a.min(self.b).min(self.c)
    }
    /// Returns the maximum index in the triangle index, used to check if the triangle index is valid
    pub fn max(&self) -> usize {
        self.a.max(self.b).max(self.c)
    }
}