pub struct GeometryHasher { /* private fields */ }Expand description
Accumulates a single entity’s geometry signature across one or more mesh segments. Segments are combined commutatively, so the order in which the kernel emits an entity’s pieces does not affect the result.
Implementations§
Source§impl GeometryHasher
impl GeometryHasher
Sourcepub fn new(tolerance: f64, rtc_offset: [f64; 3]) -> Self
pub fn new(tolerance: f64, rtc_offset: [f64; 3]) -> Self
Create a hasher for one entity.
tolerance— quantization grid in metres (must be> 0).rtc_offset— the file’s RTC offset, added back to local positions to reconstruct world coordinates. Pass[0.0; 3]if positions are already in world space.
Sourcepub fn add_mesh(&mut self, positions: &[f32], indices: &[u32])
pub fn add_mesh(&mut self, positions: &[f32], indices: &[u32])
Add one mesh segment (a flat [x,y,z, ...] position buffer and a
triangle index buffer). Indices that run past the position buffer or
trailing non-triangle remainder are skipped defensively.
Sourcepub fn add_mesh_with_origin(
&mut self,
positions: &[f32],
indices: &[u32],
origin: [f64; 3],
)
pub fn add_mesh_with_origin( &mut self, positions: &[f32], indices: &[u32], origin: [f64; 3], )
Like [add_mesh] but for positions stored in a per-element LOCAL frame:
origin (the per-mesh AABB-centre origin) is folded back so the hash is
over absolute world coordinates. This keeps the fingerprint identical
whether the producer emitted absolute positions (native) or local +
origin (the wasm local-frame path), and still detects element MOVES.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
true until at least one (non-degenerate, in-range) triangle has been
hashed. Lets callers skip emitting a fingerprint for entities that
produced no geometry.
Sourcepub fn finish(&self) -> u64
pub fn finish(&self) -> u64
Finalize the entity’s geometry hash. Folds in the triangle count so two distinct shapes that happen to collide on the commutative triangle sum are still separated by their cardinality. Vertex count is intentionally excluded: it is ambiguous under shared-vs-duplicated vertices and under segment splitting (the same entity may arrive as one mesh or several sharing a position buffer), whereas the triangle count is intrinsic and additive across segments.
Trait Implementations§
Source§impl Clone for GeometryHasher
impl Clone for GeometryHasher
Source§fn clone(&self) -> GeometryHasher
fn clone(&self) -> GeometryHasher
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for GeometryHasher
impl RefUnwindSafe for GeometryHasher
impl Send for GeometryHasher
impl Sync for GeometryHasher
impl Unpin for GeometryHasher
impl UnsafeUnpin for GeometryHasher
impl UnwindSafe for GeometryHasher
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for 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.