pub struct AnalyzedMesh {
pub vertices: Vec<Vec3>,
pub vertex_normals: Option<Vec<Vec3>>,
pub triangles: Vec<TriangleData>,
pub bbox_min: Vec3,
pub bbox_max: Vec3,
pub diagonal: f64,
pub vertex_area_weights: Vec<f64>,
pub source_metadata: Vec<SourceMetadata>,
pub degenerate_triangles: Vec<usize>,
}Expand description
A validated mesh with cached geometry, topology, and sampling weights.
Fields§
§vertices: Vec<Vec3>Validated vertex positions.
vertex_normals: Option<Vec<Vec3>>Normalized supplied vertex normals, when present on the source mesh.
triangles: Vec<TriangleData>Derived data for every input triangle.
bbox_min: Vec3Component-wise minimum of all vertex positions.
bbox_max: Vec3Component-wise maximum of all vertex positions.
diagonal: f64Length of the axis-aligned bounding-box diagonal.
vertex_area_weights: Vec<f64>One-third of each incident usable triangle’s area, accumulated per vertex.
source_metadata: Vec<SourceMetadata>Validated source metadata copied from the input mesh.
degenerate_triangles: Vec<usize>Indices of triangles rejected as degenerate.
Implementations§
Source§impl AnalyzedMesh
impl AnalyzedMesh
Sourcepub fn new(
mesh: &Mesh,
options: &MeshAnalysisOptions,
) -> Result<Self, RecognitionError>
pub fn new( mesh: &Mesh, options: &MeshAnalysisOptions, ) -> Result<Self, RecognitionError>
Validates mesh and constructs its analyzed representation.
Sourcepub fn all_non_degenerate(&self) -> Vec<usize>
pub fn all_non_degenerate(&self) -> Vec<usize>
Returns the indices of all triangles with positive analyzed area.
Sourcepub fn validate_selection(&self, ids: &[usize]) -> Result<(), RecognitionError>
pub fn validate_selection(&self, ids: &[usize]) -> Result<(), RecognitionError>
Checks that a selection is non-empty, in range, and contains usable geometry.
Sourcepub fn validate_vertex_selection(
&self,
ids: &[usize],
) -> Result<(), RecognitionError>
pub fn validate_vertex_selection( &self, ids: &[usize], ) -> Result<(), RecognitionError>
Checks that a vertex selection is non-empty, unique, in range, and incident to usable mesh geometry.
Sourcepub fn selected_vertex_weights(&self, ids: &[usize]) -> Vec<(usize, f64)>
pub fn selected_vertex_weights(&self, ids: &[usize]) -> Vec<(usize, f64)>
Returns area weights for vertices incident to the selected usable triangles.
Sourcepub fn selection_centroid(&self, ids: &[usize]) -> Vec3
pub fn selection_centroid(&self, ids: &[usize]) -> Vec3
Returns the area-weighted centroid of selected triangles.
Returns the zero vector when the selection has no positive-area triangle.
Trait Implementations§
Source§impl Clone for AnalyzedMesh
impl Clone for AnalyzedMesh
Source§fn clone(&self) -> AnalyzedMesh
fn clone(&self) -> AnalyzedMesh
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more