pub struct QemDecimation {
pub mesh: SimpleMesh,
/* private fields */
}Expand description
A QEM-based decimator that wraps SimpleMesh and provides adaptive
error thresholds, boundary preservation, and feature scoring.
Fields§
§mesh: SimpleMeshThe mesh being simplified.
Implementations§
Source§impl QemDecimation
impl QemDecimation
Sourcepub fn new(mesh: SimpleMesh) -> Self
pub fn new(mesh: SimpleMesh) -> Self
Construct a QemDecimation from a mesh. Quadrics are computed once.
Sourcepub fn recompute_quadrics(&mut self)
pub fn recompute_quadrics(&mut self)
Recompute the per-vertex quadric matrices from the current mesh.
Sourcepub fn compute_error_threshold(&self, scale_factor: f64) -> f64
pub fn compute_error_threshold(&self, scale_factor: f64) -> f64
Compute an adaptive QEM error threshold.
The threshold is scale_factor * avg_edge_length² * mean_curvature_proxy,
where the mean curvature proxy is the average edge collapse cost over
a sample of edges. This adapts the threshold to mesh scale and feature
density.
scale_factor controls aggressiveness (try 0.01 – 1.0).
Sourcepub fn preserve_boundary(&mut self, threshold: f64) -> usize
pub fn preserve_boundary(&mut self, threshold: f64) -> usize
Collapse edges while preserving boundary geometry.
Boundary edges (shared by exactly one triangle) are never collapsed.
Interior edges with QEM cost below threshold are collapsed greedily
using a priority queue.
Returns the number of collapses performed.
Sourcepub fn compute_feature_score(&self) -> HashMap<(usize, usize), f64>
pub fn compute_feature_score(&self) -> HashMap<(usize, usize), f64>
Compute a feature importance score for each edge in the mesh.
The score is the sum of the dihedral-angle curvature between the two incident faces. High scores indicate sharp creases or geometric features that should be preserved.
Returns a HashMap<(usize, usize), f64> keyed by the canonical
(min, max) vertex index pair.
Auto Trait Implementations§
impl Freeze for QemDecimation
impl RefUnwindSafe for QemDecimation
impl Send for QemDecimation
impl Sync for QemDecimation
impl Unpin for QemDecimation
impl UnsafeUnpin for QemDecimation
impl UnwindSafe for QemDecimation
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.