Enum truck_modeling::topology::ShellCondition
source · 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§
source§impl BitAnd<ShellCondition> for ShellCondition
impl BitAnd<ShellCondition> for ShellCondition
§type Output = ShellCondition
type Output = ShellCondition
The resulting type after applying the
&
operator.source§fn bitand(self, other: ShellCondition) -> ShellCondition
fn bitand(self, other: ShellCondition) -> ShellCondition
Performs the
&
operation. Read moresource§impl Clone for ShellCondition
impl Clone for ShellCondition
source§fn clone(&self) -> ShellCondition
fn clone(&self) -> ShellCondition
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ShellCondition
impl Debug for ShellCondition
source§impl PartialEq<ShellCondition> for ShellCondition
impl PartialEq<ShellCondition> for ShellCondition
source§fn eq(&self, other: &ShellCondition) -> bool
fn eq(&self, other: &ShellCondition) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.