pub struct Mesh {
pub vertices: Vec<Vec3>,
pub triangles: Vec<[u32; 3]>,
pub vertex_normals: Option<Vec<Vec3>>,
pub source_metadata: Vec<SourceMetadata>,
}Expand description
An indexed triangle mesh and optional recognition metadata.
Fields§
§vertices: Vec<Vec3>Vertex positions in model coordinates.
triangles: Vec<[u32; 3]>Triangle vertex indices; winding defines the geometric normal.
vertex_normals: Option<Vec<Vec3>>Optional unit-normal hints, one per vertex. These improve curved-surface fitting without replacing triangle winding as the topology authority.
source_metadata: Vec<SourceMetadata>Versioned metadata associated with subsets of triangles.
Implementations§
Source§impl Mesh
impl Mesh
Sourcepub fn new(vertices: Vec<Vec3>, triangles: Vec<[u32; 3]>) -> Mesh
pub fn new(vertices: Vec<Vec3>, triangles: Vec<[u32; 3]>) -> Mesh
Creates a mesh without vertex-normal hints or source metadata.
Sourcepub fn with_vertex_normals(self, normals: Vec<Vec3>) -> Mesh
pub fn with_vertex_normals(self, normals: Vec<Vec3>) -> Mesh
Attach per-vertex normal hints. Length and values are validated by
Mesh::analyze, where finite non-zero vectors are normalized.
Sourcepub fn analyze(
&self,
options: &MeshAnalysisOptions,
) -> Result<AnalyzedMesh, RecognitionError>
pub fn analyze( &self, options: &MeshAnalysisOptions, ) -> Result<AnalyzedMesh, RecognitionError>
Validates the mesh and computes geometry and adjacency information.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Mesh
impl<'de> Deserialize<'de> for Mesh
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Mesh, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Mesh, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Mesh
impl Serialize for Mesh
Source§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 Mesh
Auto Trait Implementations§
impl Freeze for Mesh
impl RefUnwindSafe for Mesh
impl Send for Mesh
impl Sync for Mesh
impl Unpin for Mesh
impl UnsafeUnpin for Mesh
impl UnwindSafe for Mesh
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