pub enum TopologyError {
    BadTriangle(u32),
    BadAdjacentTrianglesOrientation {
        triangle1: u32,
        triangle2: u32,
        edge: (u32, u32),
    },
}Expand description
Errors that occur when computing or validating triangle mesh topology.
Triangle mesh topology describes the connectivity and adjacency relationships between
vertices, edges, and triangles. When constructing a mesh with TriMeshFlags::HALF_EDGE_TOPOLOGY,
Parry validates these relationships and returns this error if inconsistencies are found.
§When This Occurs
Topology errors typically occur when:
- The mesh is non-manifold (edges with more than 2 adjacent faces)
- Adjacent triangles have inconsistent winding order
- Triangles have degenerate geometry (duplicate vertices)
Variants§
BadTriangle(u32)
A triangle has two or three identical vertices (degenerate triangle).
This error indicates that a triangle in the mesh references the same vertex
multiple times, creating a degenerate triangle (zero area). For example,
a triangle with indices [5, 5, 7] or [1, 2, 1].
Degenerate triangles cannot be part of a valid mesh topology because they don’t have proper edges or face normals.
Alternatively, use TriMeshFlags::DELETE_DEGENERATE_TRIANGLES to automatically
remove degenerate triangles:
let flags = TriMeshFlags::HALF_EDGE_TOPOLOGY
    | TriMeshFlags::DELETE_BAD_TOPOLOGY_TRIANGLES;
let mesh = TriMesh::with_flags(vertices, indices, flags)
    .expect("Bad triangles removed");BadAdjacentTrianglesOrientation
Two adjacent triangles have opposite orientations (inconsistent winding).
For a manifold mesh with consistent normals, adjacent triangles must have compatible orientations. If two triangles share an edge, they must traverse that edge in opposite directions.
This error reports:
- triangle1,- triangle2: The indices of the two conflicting triangles
- edge: The shared edge as a pair of vertex indices- (v1, v2)
§Example of the Problem
CORRECT (opposite winding on shared edge):
  Triangle 1: [a, b, c]  ->  edge (a,b)
  Triangle 2: [b, a, d]  ->  edge (b,a)  ✓ opposite direction
INCORRECT (same winding on shared edge):
  Triangle 1: [a, b, c]  ->  edge (a,b)
  Triangle 2: [a, b, d]  ->  edge (a,b)  ✗ same direction!§Common Causes
- Mixing clockwise and counter-clockwise triangle definitions
- Incorrectly constructed mesh from modeling software
- Manual mesh construction with inconsistent winding
- Merging separate meshes with different conventions
Trait Implementations§
Source§impl Clone for TopologyError
 
impl Clone for TopologyError
Source§fn clone(&self) -> TopologyError
 
fn clone(&self) -> TopologyError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TopologyError
 
impl Debug for TopologyError
Source§impl Display for TopologyError
 
impl Display for TopologyError
Source§impl Error for TopologyError
 
impl Error for TopologyError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
 
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
 
fn description(&self) -> &str
Source§impl PartialEq for TopologyError
 
impl PartialEq for TopologyError
impl Copy for TopologyError
impl Eq for TopologyError
impl StructuralPartialEq for TopologyError
Auto Trait Implementations§
impl Freeze for TopologyError
impl RefUnwindSafe for TopologyError
impl Send for TopologyError
impl Sync for TopologyError
impl Unpin for TopologyError
impl UnwindSafe for TopologyError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
Source§impl<T> Downcast for Twhere
    T: Any,
 
impl<T> Downcast for Twhere
    T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
 
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
 
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
 
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
 
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
 
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
 
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
 
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
 
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
    SS: SubsetOf<SP>,
 
impl<SS, SP> SupersetOf<SS> for SPwhere
    SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
 
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
 
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
 
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
 
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.