Skip to main content

AnalyzedMesh

Struct AnalyzedMesh 

Source
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: Vec3

Component-wise minimum of all vertex positions.

§bbox_max: Vec3

Component-wise maximum of all vertex positions.

§diagonal: f64

Length 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

Source

pub fn new( mesh: &Mesh, options: &MeshAnalysisOptions, ) -> Result<AnalyzedMesh, RecognitionError>

Validates mesh and constructs its analyzed representation.

Source

pub fn all_non_degenerate(&self) -> Vec<usize>

Returns the indices of all triangles with positive analyzed area.

Source

pub fn validate_selection(&self, ids: &[usize]) -> Result<(), RecognitionError>

Checks that a selection is non-empty, in range, and contains usable geometry.

Source

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.

Source

pub fn selected_vertex_weights(&self, ids: &[usize]) -> Vec<(usize, f64)>

Returns area weights for vertices incident to the selected usable triangles.

Source

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.

Source

pub fn connected_components( &self, ids: &[usize], respect_features: bool, ) -> Vec<Vec<usize>>

Partitions selected usable triangles into edge-connected components.

When respect_features is true, traversal does not cross feature edges.

Trait Implementations§

Source§

impl Clone for AnalyzedMesh

Source§

fn clone(&self) -> AnalyzedMesh

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AnalyzedMesh

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more