pub struct CoordinateQuantizer {
pub precision: u32,
pub scale: f32,
}Expand description
Simple lossy coordinate compression via fixed-point quantization.
Positions are quantized to a fixed number of decimal places, reducing precision but allowing more compact storage.
Fields§
§precision: u32Number of decimal places to preserve.
scale: f32Scale factor = 10^precision.
Implementations§
Source§impl CoordinateQuantizer
impl CoordinateQuantizer
Sourcepub fn new(precision: u32) -> Self
pub fn new(precision: u32) -> Self
Create a quantizer with the given precision (decimal places).
Sourcepub fn quantize(&self, pos: [f32; 3]) -> [f32; 3]
pub fn quantize(&self, pos: [f32; 3]) -> [f32; 3]
Quantize a position to fixed-point, then round back to f32.
Sourcepub fn quantize_frame(&self, positions: &mut [[f32; 3]])
pub fn quantize_frame(&self, positions: &mut [[f32; 3]])
Quantize all positions in-place.
Auto Trait Implementations§
impl Freeze for CoordinateQuantizer
impl RefUnwindSafe for CoordinateQuantizer
impl Send for CoordinateQuantizer
impl Sync for CoordinateQuantizer
impl Unpin for CoordinateQuantizer
impl UnsafeUnpin for CoordinateQuantizer
impl UnwindSafe for CoordinateQuantizer
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
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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.