Enum truck_topology::errors::Error [−][src]
Topological Errors
Variants
Two same vertices cannot construct an edge.
Examples
use truck_topology::*; use truck_topology::errors::Error; let v = Vertex::new(()); assert_eq!(Edge::try_new(&v, &v, ()), Err(Error::SameVertex));
The empty wire cannot contruct a face.
Examples
use truck_topology::*; use truck_topology::errors::Error; assert_eq!(Face::try_new(vec![Wire::<(), ()>::new()], ()), Err(Error::EmptyWire));
The boundary of a face must be closed.
Examples
use truck_topology::*; use truck_topology::errors::Error; let v = Vertex::news(&[(), ()]); let wire: Wire<(), ()> = vec![Edge::new(&v[0], &v[1], ())].into(); assert_eq!(Face::try_new(vec![wire], ()), Err(Error::NotClosedWire));
The boundary of a face must be simple.
Examples
use truck_topology::*; use truck_topology::errors::Error; let v = Vertex::news(&[(); 4]); let wire: Wire<(), ()> = vec![ Edge::new(&v[0], &v[1], ()), Edge::new(&v[1], &v[2], ()), Edge::new(&v[2], &v[3], ()), Edge::new(&v[3], &v[1], ()), Edge::new(&v[1], &v[0], ()), ].into(); assert_eq!(Face::try_new(vec![wire], ()), Err(Error::NotSimpleWire));
Some boundaries has a shared vertex.
The empty shell cannot construct a solid.
Examples
use truck_topology::*; use truck_topology::errors::Error; assert_eq!(Solid::try_new(vec![Shell::<(), (), ()>::new()]), Err(Error::EmptyShell));
The vector of boundaries of the solid must consist connected shells.
Examples
use truck_topology::*; use truck_topology::errors::Error; let v = Vertex::news(&[(), (), (), ()]); let wire = vec![ Wire::from(vec![Edge::new(&v[0], &v[1], ()), Edge::new(&v[1], &v[0], ())]), Wire::from(vec![Edge::new(&v[2], &v[3], ()), Edge::new(&v[3], &v[2], ())]), ]; let shell: Shell<(), (), ()> = wire.into_iter().map(|w| Face::new(vec![w], ())).collect(); assert_eq!(Solid::try_new(vec![shell]), Err(Error::NotConnected));
The boundary of the solid must be closed.
Examples
use truck_topology::*; use truck_topology::errors::Error; let v = Vertex::news(&[(), ()]); let wire = Wire::from(vec![Edge::new(&v[0], &v[1], ()), Edge::new(&v[1], &v[0], ())]); let shell: Shell<(), (), ()> = vec![Face::new(vec![wire], ())].into(); assert_eq!(Solid::try_new(vec![shell]), Err(Error::NotClosedShell));
The boundary of the solid must be a manifold.
Examples
// the wedge sum of two spheres use truck_topology::*; use truck_topology::errors::Error; use std::iter::FromIterator; let v = Vertex::news(&[(), (), ()]); let edge = [ Edge::new(&v[0], &v[1], ()), Edge::new(&v[1], &v[0], ()), Edge::new(&v[1], &v[2], ()), Edge::new(&v[2], &v[1], ()), ]; let wire = vec![ Wire::from_iter(vec![&edge[0], &edge[1]]), Wire::from_iter(vec![&edge[1].inverse(), &edge[0].inverse()]), Wire::from_iter(vec![&edge[2], &edge[3]]), Wire::from_iter(vec![&edge[3].inverse(), &edge[2].inverse()]), ]; let shell: Shell<(), (), ()> = wire.into_iter().map(|w| Face::new(vec![w], ())).collect(); assert_eq!(Solid::try_new(vec![shell]), Err(Error::NotManifold));
Trait Implementations
impl Debug for Error
[src]
impl Display for Error
[src]
impl Error for Error
[src]
pub fn source(&self) -> Option<&(dyn Error + 'static)>
1.30.0[src]
pub fn backtrace(&self) -> Option<&Backtrace>
[src]
pub fn description(&self) -> &str
1.0.0[src]
pub fn cause(&self) -> Option<&dyn Error>
1.0.0[src]
impl PartialEq<Error> for Error
[src]
impl StructuralPartialEq for Error
[src]
Auto Trait Implementations
impl RefUnwindSafe for Error
[src]
impl Send for Error
[src]
impl Sync for Error
[src]
impl Unpin for Error
[src]
impl UnwindSafe for Error
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,