pub enum ShellCondition {
    Irregular,
    Regular,
    Oriented,
    Closed,
}
Expand description

The shell conditions being determined by the half-edge model.

Variants§

§

Irregular

This shell is not regular.

Examples

use truck_topology::*;
use truck_topology::shell::ShellCondition;
let v = Vertex::news(&[(); 5]);
let edge = [
   Edge::new(&v[0], &v[1], ()),
   Edge::new(&v[0], &v[2], ()),
   Edge::new(&v[0], &v[3], ()),
   Edge::new(&v[0], &v[4], ()),
   Edge::new(&v[1], &v[2], ()),
   Edge::new(&v[1], &v[3], ()),
   Edge::new(&v[1], &v[4], ()),
];
let wire = vec![
   Wire::from_iter(vec![&edge[0], &edge[4], &edge[1].inverse()]),
   Wire::from_iter(vec![&edge[0], &edge[5], &edge[2].inverse()]),
   Wire::from_iter(vec![&edge[0], &edge[6], &edge[3].inverse()]),
];
let shell: Shell<_, _, _> = wire.into_iter().map(|w| Face::new(vec![w], ())).collect();
// The shell is irregular because three faces share edge[0].
assert_eq!(shell.shell_condition(), ShellCondition::Irregular);
§

Regular

All edges are shared by at most two faces.

Examples

use truck_topology::*;
use truck_topology::shell::ShellCondition;
let v = Vertex::news(&[(); 6]);
let edge = [
    Edge::new(&v[0], &v[1], ()),
    Edge::new(&v[0], &v[2], ()),
    Edge::new(&v[1], &v[2], ()),
    Edge::new(&v[1], &v[3], ()),
    Edge::new(&v[1], &v[4], ()),
    Edge::new(&v[2], &v[4], ()),
    Edge::new(&v[2], &v[5], ()),
    Edge::new(&v[3], &v[4], ()),
    Edge::new(&v[4], &v[5], ()),
];
let wire = vec![
    Wire::from_iter(vec![&edge[0], &edge[2], &edge[1].inverse()]),
    Wire::from_iter(vec![&edge[3], &edge[7], &edge[4].inverse()]),
    Wire::from_iter(vec![&edge[5], &edge[8], &edge[6].inverse()]),
    Wire::from_iter(vec![&edge[2], &edge[5], &edge[4].inverse()]),
];
let shell: Shell<_, _, _> = wire.into_iter().map(|w| Face::new(vec![w], ())).collect();
// This shell is regular, but not oriented.
// It is because the orientations of shell[0] and shell[3] are incompatible on edge[2].
assert_eq!(shell.shell_condition(), ShellCondition::Regular);
§

Oriented

The orientations of faces are compatible.

Examples

use truck_topology::*;
use truck_topology::shell::ShellCondition;
let v = Vertex::news(&[(); 6]);
let edge = [
    Edge::new(&v[0], &v[1] ,()),
    Edge::new(&v[0], &v[2] ,()),
    Edge::new(&v[1], &v[2] ,()),
    Edge::new(&v[1], &v[3] ,()),
    Edge::new(&v[1], &v[4] ,()),
    Edge::new(&v[2], &v[4] ,()),
    Edge::new(&v[2], &v[5] ,()),
    Edge::new(&v[3], &v[4] ,()),
    Edge::new(&v[4], &v[5] ,()),
];
let wire = vec![
    Wire::from_iter(vec![&edge[0], &edge[2], &edge[1].inverse()]),
    Wire::from_iter(vec![&edge[3], &edge[7], &edge[4].inverse()]),
    Wire::from_iter(vec![&edge[5], &edge[8], &edge[6].inverse()]),
    Wire::from_iter(vec![&edge[2].inverse(), &edge[4], &edge[5].inverse()]),
];
let shell: Shell<_, _, _> = wire.into_iter().map(|w| Face::new(vec![w], ())).collect();
// The orientations of all faces in the shell are compatible on the shared edges.
// This shell is not closed because edge[0] is included in only the 0th face.
assert_eq!(shell.shell_condition(), ShellCondition::Oriented);
§

Closed

All edges are shared by two faces.

Examples

use truck_topology::*;
use truck_topology::shell::ShellCondition;
let v = Vertex::news(&[(); 8]);
let edge = [
    Edge::new(&v[0], &v[1] ,()),
    Edge::new(&v[1], &v[2] ,()),
    Edge::new(&v[2], &v[3] ,()),
    Edge::new(&v[3], &v[0] ,()),
    Edge::new(&v[0], &v[4] ,()),
    Edge::new(&v[1], &v[5] ,()),
    Edge::new(&v[2], &v[6] ,()),
    Edge::new(&v[3], &v[7] ,()),
    Edge::new(&v[4], &v[5] ,()),
    Edge::new(&v[5], &v[6] ,()),
    Edge::new(&v[6], &v[7] ,()),
    Edge::new(&v[7], &v[4] ,()),
];
let wire = vec![
    Wire::from_iter(vec![&edge[0], &edge[1], &edge[2], &edge[3]]),
    Wire::from_iter(vec![&edge[0].inverse(), &edge[4], &edge[8], &edge[5].inverse()]),
    Wire::from_iter(vec![&edge[1].inverse(), &edge[5], &edge[9], &edge[6].inverse()]),
    Wire::from_iter(vec![&edge[2].inverse(), &edge[6], &edge[10], &edge[7].inverse()]),
    Wire::from_iter(vec![&edge[3].inverse(), &edge[7], &edge[11], &edge[4].inverse()]),
    Wire::from_iter(vec![&edge[8], &edge[9], &edge[10], &edge[11]]),
];
let mut shell: Shell<_, _, _> = wire.into_iter().map(|w| Face::new(vec![w], ())).collect();
shell[5].invert();
assert_eq!(shell.shell_condition(), ShellCondition::Closed);

Trait Implementations§

The resulting type after applying the & operator.
Performs the & operation. Read more
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.