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

/// Error indicating that a query is not supported between certain shapes
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum MeshIntersectionError {
    MissingTopology,
    MissingPseudoNormals,
    TriTriError,
}

impl fmt::Display for MeshIntersectionError {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            Self::MissingTopology => {
                f.pad("at least on of the meshes is missing its topology information. Call `mesh.compute_topology` on the mesh")
            }
            Self::MissingPseudoNormals => {
                f.pad("at least on of the meshes is missing its pseudo-normals. Call `mesh.compute_pseudo_normals` on the mesh")
            }
            Self::TriTriError => f.pad("internal failure while intersecting two triangles"),
        }
    }
}

#[cfg(feature = "std")]
impl std::error::Error for MeshIntersectionError {}