pub struct TriMesh {
pub positions: Vec<DVec3>,
pub indices: Vec<u32>,
pub normals: Option<NormalAttribute>,
pub attributes: Vec<AttributeChannel>,
}Expand description
Indexed triangle mesh in local coordinates.
Dirty source geometry is representable. Call TriMesh::validate_structure
at trust boundaries; manifold validation is a separate, more expensive pass.
Fields§
§positions: Vec<DVec3>Vertex positions.
indices: Vec<u32>Triangle corner indices, three entries per triangle.
normals: Option<NormalAttribute>Optional normals preserved from the source.
attributes: Vec<AttributeChannel>Named per-vertex channels carried alongside positions.
Empty by default: a mesh with no extra data pays nothing for this.
Implementations§
Source§impl TriMesh
impl TriMesh
Sourcepub fn new(positions: Vec<DVec3>, indices: Vec<u32>) -> TriMesh
pub fn new(positions: Vec<DVec3>, indices: Vec<u32>) -> TriMesh
Construct a position/index mesh without normals.
Sourcepub fn triangle_count(&self) -> usize
pub fn triangle_count(&self) -> usize
Number of complete triangles.
Sourcepub fn validate_structure(&self) -> Result<(), MeshValidationError>
pub fn validate_structure(&self) -> Result<(), MeshValidationError>
Cheap index-buffer and attribute-size validation.
Sourcepub fn is_structurally_valid(&self) -> bool
pub fn is_structurally_valid(&self) -> bool
Whether cheap structural validation succeeds.
Sourcepub fn triangles(&self) -> impl ExactSizeIterator
pub fn triangles(&self) -> impl ExactSizeIterator
Triangles in deterministic index-buffer order.
Trait Implementations§
Source§impl Diagnose<TriMesh> for MeshHealer
impl Diagnose<TriMesh> for MeshHealer
Source§impl From<TriMesh> for GeometryNode
impl From<TriMesh> for GeometryNode
Source§fn from(value: TriMesh) -> GeometryNode
fn from(value: TriMesh) -> GeometryNode
§impl Measure<TriMesh> for MeshMeasure
impl Measure<TriMesh> for MeshMeasure
§fn measure(
&self,
value: &TriMesh,
tolerance: Tolerance,
) -> Result<MassProperties, <MeshMeasure as Measure<TriMesh>>::Error>
fn measure( &self, value: &TriMesh, tolerance: Tolerance, ) -> Result<MassProperties, <MeshMeasure as Measure<TriMesh>>::Error>
Area, signed volume, volume centroid and second moments in one pass.
The centroid reported is the VOLUME centroid, not the area centroid:
for mass properties of a solid that is the meaningful one, and
surface_properties still exposes the area centroid separately for
callers measuring a shell.
§type Error = MeshMeasureError
type Error = MeshMeasureError
Source§impl Repair<TriMesh> for MeshHealer
impl Repair<TriMesh> for MeshHealer
Source§type Error = MeshHealError
type Error = MeshHealError
Source§fn repair(
&self,
mesh: &TriMesh,
plan: &RepairPlan,
tolerance: Tolerance,
) -> Result<(TriMesh, RepairReport), <MeshHealer as Repair<TriMesh>>::Error>
fn repair( &self, mesh: &TriMesh, plan: &RepairPlan, tolerance: Tolerance, ) -> Result<(TriMesh, RepairReport), <MeshHealer as Repair<TriMesh>>::Error>
Source§impl TriangleMeshView for TriMesh
impl TriangleMeshView for TriMesh
Source§fn position_count(&self) -> usize
fn position_count(&self) -> usize
Source§fn triangle_count(&self) -> usize
fn triangle_count(&self) -> usize
impl BuiltInNode for TriMesh
impl StructuralPartialEq for TriMesh
Auto Trait Implementations§
impl Freeze for TriMesh
impl RefUnwindSafe for TriMesh
impl Send for TriMesh
impl Sync for TriMesh
impl Unpin for TriMesh
impl UnwindSafe for TriMesh
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more