Enum truck_polymesh::errors::Error [−][src]
pub enum Error<V: Debug = StandardVertex> {
OutOfRange(V),
NoNormal,
DifferentLengthArrays,
IrregularArray,
UnsortedDivision,
FromIO(Error),
}Expand description
Errors occured by polygon mesh handling
Variants
OutOfRange(V)
There is an index in out of range.
Examples
use truck_polymesh::*;
use errors::Error;
let positions = vec![
Point3::new(0.0, 0.0, 0.0),
Point3::new(1.0, 0.0, 0.0),
Point3::new(0.0, 1.0, 0.0),
];
let faces = Faces::from_iter(&[
&[0, 1, 2],
&[1, 2, 4],
]);
let res = PolygonMesh::try_new(
StandardAttributes {
positions,
..Default::default()
},
faces,
);
match res {
Err(Error::OutOfRange(vertex)) => {
assert_eq!(vertex.pos, 4);
}
_ => panic!("wrong result!"),
}NoNormal
There are no normal in polygon mesh.
DifferentLengthArrays
The length of arrays of StructuredMesh is incorrect.
IrregularArray
The length of arrays of StructuredMesh is incorrect.
Examples
use truck_polymesh::*;
use errors::Error;
let positions = vec![
vec![Point3::new(0.0, 0.0, 0.0), Point3::new(1.0, 0.0, 0.0)],
vec![Point3::new(0.0, 1.0, 0.0)],
];
match StructuredMesh::try_from_positions(positions) {
Err(Error::IrregularArray) => {}
_ => panic!("wrong result!"),
}UnsortedDivision
The division of uv coords of StructuredMesh is not sorted.
Examples
use truck_polymesh::*;
use errors::Error;
let positions = vec![
vec![Point3::new(0.0, 0.0, 0.0), Point3::new(0.0, 1.0, 0.0)],
vec![Point3::new(1.0, 0.0, 0.0), Point3::new(1.0, 1.0, 0.0)],
];
let udiv = vec![1.0, 0.0];
let vdiv = vec![0.0, 1.0];
match StructuredMesh::try_from_positions_and_uvs(positions, (udiv, vdiv)) {
Err(Error::UnsortedDivision) => {}
_ => panic!("wrong result!"),
}FromIO(Error)
Tuple Fields
0: ErrorErrors caused by obj files I/O.
Trait Implementations
Performs the conversion.
Performs the conversion.