pub struct PyTriangleMesh {
pub vertices: Vec<[f64; 3]>,
pub indices: Vec<usize>,
pub normals: Vec<[f64; 3]>,
}Expand description
A triangle mesh with vertices, indices, and optional per-vertex normals.
Fields§
§vertices: Vec<[f64; 3]>Vertex positions, each [f64; 3].
indices: Vec<usize>Triangle face indices (groups of 3 vertex indices).
normals: Vec<[f64; 3]>Per-vertex normals (may be empty until compute_normals is called).
Implementations§
Source§impl PyTriangleMesh
impl PyTriangleMesh
Sourcepub fn from_raw(vertices: Vec<[f64; 3]>, indices: Vec<usize>) -> Self
pub fn from_raw(vertices: Vec<[f64; 3]>, indices: Vec<usize>) -> Self
Create a mesh from raw vertex and index data.
Sourcepub fn compute_normals(&mut self)
pub fn compute_normals(&mut self)
Compute per-vertex normals as the area-weighted average of adjacent face normals.
Sourcepub fn smooth(&mut self, iterations: usize)
pub fn smooth(&mut self, iterations: usize)
Laplacian smoothing: average each vertex toward its neighbours.
Sourcepub fn compute_volume(&self) -> f64
pub fn compute_volume(&self) -> f64
Compute signed volume using the divergence theorem.
Sourcepub fn compute_surface_area(&self) -> f64
pub fn compute_surface_area(&self) -> f64
Compute total surface area.
Sourcepub fn triangle_count(&self) -> usize
pub fn triangle_count(&self) -> usize
Number of triangles.
Trait Implementations§
Source§impl Clone for PyTriangleMesh
impl Clone for PyTriangleMesh
Source§fn clone(&self) -> PyTriangleMesh
fn clone(&self) -> PyTriangleMesh
Returns a duplicate 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 PyTriangleMesh
impl Debug for PyTriangleMesh
Source§impl Default for PyTriangleMesh
impl Default for PyTriangleMesh
Source§impl<'de> Deserialize<'de> for PyTriangleMesh
impl<'de> Deserialize<'de> for PyTriangleMesh
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PyTriangleMesh
impl RefUnwindSafe for PyTriangleMesh
impl Send for PyTriangleMesh
impl Sync for PyTriangleMesh
impl Unpin for PyTriangleMesh
impl UnsafeUnpin for PyTriangleMesh
impl UnwindSafe for PyTriangleMesh
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.