pub struct MeshCollection { /* private fields */ }Expand description
Collection of mesh data for returning multiple meshes
Implementations§
Source§impl MeshCollection
impl MeshCollection
Sourcepub fn geometry_hash_ids(&self) -> Uint32Array
pub fn geometry_hash_ids(&self) -> Uint32Array
Express ids for the per-entity geometry fingerprints, parallel to
Self::geometry_hash_values. Empty unless geometry hashing was
enabled via IfcAPI.setComputeGeometryHashes.
Sourcepub fn geometry_hash_values(&self) -> BigUint64Array
pub fn geometry_hash_values(&self) -> BigUint64Array
Per-entity geometry fingerprints as a BigUint64Array, parallel to
Self::geometry_hash_ids. u64 is exposed (not hex strings) so JS
can compare with === and key maps without allocation. Empty unless
geometry hashing was enabled.
Sourcepub fn geometry_aabb_values(&self) -> Float64Array
pub fn geometry_aabb_values(&self) -> Float64Array
Per-entity world-space AABBs as a Float64Array, SIX values per entry
(minx, miny, minz, maxx, maxy, maxz), in the same order as
Self::geometry_hash_ids — entry i spans [6*i, 6*i+6). Empty
unless geometry hashing was enabled; the same
IfcAPI.setComputeGeometryHashes switch gates both, so nothing is
computed when the diff feature is off.
Unquantized world f64 (the file’s RTC folded back in), so two
revisions that chose different RTC offsets report the same box. This is
what lets a consumer say “MOVED” honestly instead of inferring it from a
changed hash, which also fires on reshape and on retriangulation.
Frame: WebGL Y-up, like every other box, position, origin and
placement that crosses this boundary (see MeshDataJs::local_bounds).
The hasher accumulates in the producer’s IFC Z-up frame, so the swap
(x,y,z) -> (x,z,-y) is applied here, on the way out. Unconverted, the
boxes would not enclose the very meshes processGeometryBatch returns
alongside them. Positions are RTC-relative and this box is absolute, so
a consumer comparing the two folds rtcOffset* in — itself Y-up-swapped.
Present for every hashed entity. Its companion
Self::geometry_volume_values is not — see there.
Sourcepub fn geometry_volume_values(&self) -> Float64Array
pub fn geometry_volume_values(&self) -> Float64Array
Per-entity enclosed volume in CUBIC METRES as a Float64Array, one
value per entry in Self::geometry_hash_ids order. NaN means NO
TRUSTWORTHY VOLUME — the same absent convention as
Self::geometry_aabb_values — and it is NaN for roughly a third of
entities by design, not by failure.
A value is emitted only when that entity’s produced geometry was
PROVABLY a single closed, orientable, single-component solid, as decided
by the mesher’s own orientation pass. Read
ifc_lite_geometry::GeometryHasher::volume before treating a NaN as a
bug: an open SurfaceModel, a material-layered wall (whose slices are
open bands by construction), and any element assembled from more than one
representation item all correctly report nothing rather than a plausible
wrong number. Self::geometry_closure_flags says which.
This is NOT a substitute for an IFC BaseQuantities GrossVolume: it is
the volume of the geometry that was actually meshed, after opening cuts,
and it says nothing about whether a CSG degradation left the host uncut
(see the diagnostics getter).
Sourcepub fn geometry_closure_flags(&self) -> Uint8Array
pub fn geometry_closure_flags(&self) -> Uint8Array
Per-entity topology verdict as a Uint8Array, one packed byte per entry
in Self::geometry_hash_ids order:
- bit 0 (
1) — every segment closed (no boundary / non-manifold edge) - bit 1 (
2) — every segment orientable - bit 2 (
4) — every segment a single connected component - bit 3 (
8) — the entity produced exactly one segment
0x0F is exactly the set that carries a volume in
Self::geometry_volume_values. The individual bits are the diagnosis:
a model checker can distinguish “this wall is an open shell” (bit 0
clear) from “this door is a multi-item assembly whose parts may overlap”
(bit 3 clear), which are different findings with different fixes.
Source§impl MeshCollection
impl MeshCollection
Sourcepub fn push_geometry_hash(&mut self, fp: GeometryFingerprint)
pub fn push_geometry_hash(&mut self, fp: GeometryFingerprint)
Record one entity’s geometry fingerprint and everything the SAME hashing pass measured about it. Taken as a struct rather than five positional arguments precisely because the five arrays must stay index-parallel: there is one push site per entity, and a caller cannot supply three of the five and silently misalign every later entry.
Absent values are written in place, never skipped — None becomes a
six-NaN box / a NaN volume — because shortening an array would
mis-attribute every entry past it.
Source§impl MeshCollection
impl MeshCollection
Sourcepub fn get(&self, index: usize) -> Option<MeshDataJs>
pub fn get(&self, index: usize) -> Option<MeshDataJs>
Get mesh at index (clones — non-destructive). Prefer takeMesh on the
hot streaming path; this stays for callers that read meshes more than once.
Sourcepub fn take_mesh(&mut self, index: usize) -> Option<MeshDataJs>
pub fn take_mesh(&mut self, index: usize) -> Option<MeshDataJs>
#1097 perf: MOVE the mesh at index out of the collection (the Vec
buffers are std::mem::take-n, leaving an empty stub). The streaming
worker reads each mesh exactly once, so moving avoids the full vertex-
data clone get pays — one fewer copy of positions/normals/indices/uvs/
texture per mesh (the JS getters still do the single Rust→JS copy). Calling
it twice for the same index yields the second call an empty mesh.
Sourcepub fn total_vertices(&self) -> usize
pub fn total_vertices(&self) -> usize
Get total vertex count across all meshes
Sourcepub fn total_triangles(&self) -> usize
pub fn total_triangles(&self) -> usize
Get total triangle count across all meshes
Sourcepub fn rtc_offset_x(&self) -> f64
pub fn rtc_offset_x(&self) -> f64
Get RTC offset X (for converting local coords back to world coords) Add this to local X coordinates to get world X coordinates
Sourcepub fn rtc_offset_y(&self) -> f64
pub fn rtc_offset_y(&self) -> f64
Get RTC offset Y
Sourcepub fn rtc_offset_z(&self) -> f64
pub fn rtc_offset_z(&self) -> f64
Get RTC offset Z
Sourcepub fn has_rtc_offset(&self) -> bool
pub fn has_rtc_offset(&self) -> bool
Check if RTC offset is significant (>10km)
Sourcepub fn building_rotation(&self) -> Option<f64>
pub fn building_rotation(&self) -> Option<f64>
Get building rotation angle in radians (from IfcSite placement) Returns None if no rotation was detected
Sourcepub fn geometry_hash_count(&self) -> usize
pub fn geometry_hash_count(&self) -> usize
Number of per-entity geometry fingerprints recorded.
Sourcepub fn diagnostics(&self) -> JsValue
pub fn diagnostics(&self) -> JsValue
The batch’s typed CSG / opening diagnostics as a JS object (the
GeometryDiagnostics contract), or undefined if none were recorded. The
worker merges these across batches. One serialized value keeps the rich
nested shape as a single FFI crossing instead of dozens of getters.
Source§impl MeshCollection
impl MeshCollection
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create new collection with capacity hint
Sourcepub fn add(&mut self, mesh: MeshDataJs)
pub fn add(&mut self, mesh: MeshDataJs)
Add a mesh to the collection
Sourcepub fn set_diagnostics(&mut self, diagnostics: GeometryDiagnostics)
pub fn set_diagnostics(&mut self, diagnostics: GeometryDiagnostics)
Attach the batch’s typed CSG / opening diagnostics (the public
GeometryDiagnostics contract).
Sourcepub fn from_vec(meshes: Vec<MeshDataJs>) -> Self
pub fn from_vec(meshes: Vec<MeshDataJs>) -> Self
Create from vec of meshes
Sourcepub fn set_rtc_offset(&mut self, x: f64, y: f64, z: f64)
pub fn set_rtc_offset(&mut self, x: f64, y: f64, z: f64)
Set the RTC offset (called during parsing when large coordinates are detected)
Sourcepub fn set_building_rotation(&mut self, rotation: Option<f64>)
pub fn set_building_rotation(&mut self, rotation: Option<f64>)
Set the building rotation angle in radians
Sourcepub fn apply_rtc_offset(&mut self, x: f64, y: f64, z: f64)
pub fn apply_rtc_offset(&mut self, x: f64, y: f64, z: f64)
Apply RTC offset to all meshes (shift coordinates) This is used when meshes are collected first and then shifted
Trait Implementations§
Source§impl Clone for MeshCollection
impl Clone for MeshCollection
Source§impl Default for MeshCollection
impl Default for MeshCollection
Source§impl From<MeshCollection> for JsValue
impl From<MeshCollection> for JsValue
Source§fn from(value: MeshCollection) -> Self
fn from(value: MeshCollection) -> Self
Source§impl FromWasmAbi for MeshCollection
impl FromWasmAbi for MeshCollection
Source§impl IntoWasmAbi for MeshCollection
impl IntoWasmAbi for MeshCollection
Source§impl LongRefFromWasmAbi for MeshCollection
impl LongRefFromWasmAbi for MeshCollection
Source§type Abi = WasmPtr<WasmRefCell<MeshCollection>>
type Abi = WasmPtr<WasmRefCell<MeshCollection>>
RefFromWasmAbi::AbiSource§type Anchor = RcRef<MeshCollection>
type Anchor = RcRef<MeshCollection>
RefFromWasmAbi::AnchorSource§unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
RefFromWasmAbi::ref_from_abiSource§impl OptionFromWasmAbi for MeshCollection
impl OptionFromWasmAbi for MeshCollection
Source§impl OptionIntoWasmAbi for MeshCollection
impl OptionIntoWasmAbi for MeshCollection
Source§impl RefFromWasmAbi for MeshCollection
impl RefFromWasmAbi for MeshCollection
Source§type Abi = WasmPtr<WasmRefCell<MeshCollection>>
type Abi = WasmPtr<WasmRefCell<MeshCollection>>
Self are recovered from.Source§type Anchor = RcRef<MeshCollection>
type Anchor = RcRef<MeshCollection>
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl RefMutFromWasmAbi for MeshCollection
impl RefMutFromWasmAbi for MeshCollection
Source§type Abi = WasmPtr<WasmRefCell<MeshCollection>>
type Abi = WasmPtr<WasmRefCell<MeshCollection>>
RefFromWasmAbi::AbiSource§type Anchor = RcRefMut<MeshCollection>
type Anchor = RcRefMut<MeshCollection>
RefFromWasmAbi::AnchorSource§unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
RefFromWasmAbi::ref_from_abiimpl SupportsConstructor for MeshCollection
impl SupportsInstanceProperty for MeshCollection
impl SupportsStaticProperty for MeshCollection
Source§impl TryFromJsValue for MeshCollection
impl TryFromJsValue for MeshCollection
Source§impl VectorFromWasmAbi for MeshCollection
impl VectorFromWasmAbi for MeshCollection
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[MeshCollection]>
Source§impl VectorIntoWasmAbi for MeshCollection
impl VectorIntoWasmAbi for MeshCollection
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[MeshCollection]>) -> Self::Abi
Source§impl WasmDescribeVector for MeshCollection
impl WasmDescribeVector for MeshCollection
Auto Trait Implementations§
impl Freeze for MeshCollection
impl RefUnwindSafe for MeshCollection
impl Send for MeshCollection
impl Sync for MeshCollection
impl Unpin for MeshCollection
impl UnsafeUnpin for MeshCollection
impl UnwindSafe for MeshCollection
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.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.