Struct TriMesh
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§
§impl TriMesh
impl TriMesh
pub 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.
pub fn triangle_count(&self) -> usize
pub fn triangle_count(&self) -> usize
Number of complete triangles.
pub fn bounds(&self) -> Aabb
pub fn bounds(&self) -> Aabb
Bounds of all positions.
pub fn validate_structure(&self) -> Result<(), MeshValidationError>
pub fn validate_structure(&self) -> Result<(), MeshValidationError>
Cheap index-buffer and attribute-size validation.
pub fn is_structurally_valid(&self) -> bool
pub fn is_structurally_valid(&self) -> bool
Whether cheap structural validation succeeds.
pub fn triangles(&self) -> impl ExactSizeIterator
pub fn triangles(&self) -> impl ExactSizeIterator
Triangles in deterministic index-buffer order.
Trait Implementations§
impl BuiltInNode for TriMesh
§impl<'de> Deserialize<'de> for TriMesh
impl<'de> Deserialize<'de> for TriMesh
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TriMesh, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TriMesh, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl From<TriMesh> for GeometryNode
impl From<TriMesh> for GeometryNode
§fn from(value: TriMesh) -> GeometryNode
fn from(value: TriMesh) -> GeometryNode
Converts to this type from the input type.
§impl Serialize for TriMesh
impl Serialize for TriMesh
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for TriMesh
§impl TriangleMeshView for TriMesh
impl TriangleMeshView for TriMesh
§fn position_count(&self) -> usize
fn position_count(&self) -> usize
Number of addressable positions.
§fn triangle_count(&self) -> usize
fn triangle_count(&self) -> usize
Number of complete triangle records.
Auto Trait Implementations§
impl Freeze for TriMesh
impl RefUnwindSafe for TriMesh
impl Send for TriMesh
impl Sync for TriMesh
impl Unpin for TriMesh
impl UnsafeUnpin 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
Mutably borrows from an owned value. Read more