Struct truck_polymesh::PolygonMesh [−][src]
Polygon mesh
The polygon data is held in a method compliant with wavefront obj. Position, uv (texture) coordinates, and normal vectors are held in separate arrays, and each face vertex accesses those values by an indices triple.
Implementations
impl PolygonMesh
[src]
pub fn new(
positions: Vec<Point3>,
uv_coords: Vec<Vector2>,
normals: Vec<Vector3>,
faces: Faces
) -> PolygonMesh
[src]
positions: Vec<Point3>,
uv_coords: Vec<Vector2>,
normals: Vec<Vector3>,
faces: Faces
) -> PolygonMesh
complete constructor
Panics
Panic occurs if there is an index is out of range.
Remarks
This method does not check whether the normal is normalized or not.
pub fn try_new(
positions: Vec<Point3>,
uv_coords: Vec<Vector2>,
normals: Vec<Vector3>,
faces: Faces
) -> Result<PolygonMesh>
[src]
positions: Vec<Point3>,
uv_coords: Vec<Vector2>,
normals: Vec<Vector3>,
faces: Faces
) -> Result<PolygonMesh>
complete constructor
Errors
Returns Error::OutOfRange
if there is an index is out of range.
Remarks
This method does not check whether the normal is normalized or not.
pub fn positions(&self) -> &Vec<Point3>
[src]
Returns the vector of all positions.
pub fn positions_mut(&mut self) -> &mut [Point3]
[src]
Returns the mutable slice of all positions.
pub fn push_position(&mut self, position: Point3)
[src]
Adds a position.
pub fn extend_positions<I: IntoIterator<Item = Point3>>(&mut self, iter: I)
[src]
Extend positions by iterator.
pub fn uv_coords(&self) -> &Vec<Vector2>
[src]
Returns the vector of all uv (texture) coordinates.
pub fn uv_coords_mut(&mut self) -> &mut [Vector2]
[src]
Returns the mutable slice of all uv (texture) coordinates.
pub fn push_uv_coord(&mut self, uv_coord: Vector2)
[src]
Adds a uv (texture) coordinate.
pub fn extend_uv_coords<I: IntoIterator<Item = Vector2>>(&mut self, iter: I)
[src]
Extend uv (texture) coordinates by iterator.
pub fn normals(&self) -> &Vec<Vector3>
[src]
Returns the vector of all normals.
pub fn normals_mut(&mut self) -> &mut [Vector3]
[src]
Returns the mutable slice of all normals.
pub fn extend_normals<I: IntoIterator<Item = Vector3>>(&mut self, iter: I)
[src]
Extend normals by iterator
pub fn faces(&self) -> &Faces
[src]
Returns the faces of the polygon.
pub fn tri_faces(&self) -> &Vec<[Vertex; 3]>
[src]
Returns the vector of all triangles of the polygon.
pub fn tri_faces_mut(&mut self) -> &mut [[Vertex; 3]]
[src]
Returns the mutable slice of all triangles.
pub fn quad_faces(&self) -> &Vec<[Vertex; 4]>
[src]
Returns the vector of all quadrangles.
pub fn quad_faces_mut(&mut self) -> &mut [[Vertex; 4]]
[src]
Returns the mutable slice of all quadrangles.
pub fn other_faces(&self) -> &[Vec<Vertex>]
[src]
Returns the vector of n-gons (n > 4).
pub fn other_faces_mut(&mut self) -> &mut [Vec<Vertex>]
[src]
Returns the mutable iterator of n-gons (n > 4).
pub fn face_iter<'a>(&'a self) -> impl Iterator<Item = &'a [Vertex]>
[src]
Returns the iterator of the slice.
By the internal optimization, this iterator does not runs in the simple order
in which they are registered, but runs order: triangle, square, and the others.
cf: Faces::face_iter
pub fn face_iter_mut<'a>(&'a mut self) -> impl Iterator<Item = &'a mut [Vertex]>
[src]
Returns the iterator of the slice.
By the internal optimization, this iterator does not runs in the simple order
in which they are registered, but runs order: triangle, square, and the others.
cf: Faces::face_iter
pub fn editor(&mut self) -> PolygonMeshEditor<'_>
[src]
Creates an editor that performs boundary checking on dropped.
pub fn uncheck_editor(&mut self) -> PolygonMeshEditor<'_>
[src]
Creates an editor that does NOT perform boundary checking on dropped.
pub fn debug_editor(&mut self) -> PolygonMeshEditor<'_>
[src]
Creates an editor that performs boundary checking on dropped ONLY in debug build.
pub fn merge(&mut self, mesh: PolygonMesh)
[src]
Returns polygonmesh merged self
and mesh
.
pub fn bounding_box(&self) -> BoundingBox<Point3>
[src]
Creates the bounding box of the polygon mesh.
Trait Implementations
impl Clone for PolygonMesh
[src]
fn clone(&self) -> PolygonMesh
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for PolygonMesh
[src]
impl<'de> Deserialize<'de> for PolygonMesh
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl NormalFilters for PolygonMesh
[src]
fn normalize_normals(&mut self) -> &mut Self
[src]
fn add_naive_normals(&mut self, overwrite: bool) -> &mut Self
[src]
fn add_smooth_normals(&mut self, tol_ang: f64, overwrite: bool) -> &mut Self
[src]
impl OptimizingFilter for PolygonMesh
[src]
fn remove_unused_attrs(&mut self) -> &mut Self
[src]
fn remove_degenerate_faces(&mut self) -> &mut Self
[src]
fn put_together_same_attrs(&mut self) -> &mut Self
[src]
impl PartialEq<PolygonMesh> for PolygonMesh
[src]
fn eq(&self, other: &PolygonMesh) -> bool
[src]
fn ne(&self, other: &PolygonMesh) -> bool
[src]
impl Serialize for PolygonMesh
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl Splitting for PolygonMesh
[src]
fn create_mesh_by_face_indices(&self, indices: &[usize]) -> PolygonMesh
[src]
fn extract_planes(&self, tol: f64) -> (Vec<usize>, Vec<usize>)
[src]
fn into_components(&self) -> Vec<Vec<usize>>
[src]
impl StructuralPartialEq for PolygonMesh
[src]
impl StructuringFilter for PolygonMesh
[src]
fn triangulate(&mut self) -> &mut Self
[src]
fn quadrangulate(&mut self, plane_tol: f64, score_tol: f64) -> &mut Self
[src]
Auto Trait Implementations
impl RefUnwindSafe for PolygonMesh
impl Send for PolygonMesh
impl Sync for PolygonMesh
impl Unpin for PolygonMesh
impl UnwindSafe for PolygonMesh
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> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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>,