Skip to main content

MeshCollection

Struct MeshCollection 

Source
pub struct MeshCollection { /* private fields */ }
Expand description

Collection of mesh data for returning multiple meshes

Implementations§

Source§

impl MeshCollection

Source

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.

Source

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.

Source

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.

Source

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).

Source

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

Source

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

Source

pub fn length(&self) -> usize

Get number of meshes

Source

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.

Source

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.

Source

pub fn total_vertices(&self) -> usize

Get total vertex count across all meshes

Source

pub fn total_triangles(&self) -> usize

Get total triangle count across all meshes

Source

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

Source

pub fn rtc_offset_y(&self) -> f64

Get RTC offset Y

Source

pub fn rtc_offset_z(&self) -> f64

Get RTC offset Z

Source

pub fn has_rtc_offset(&self) -> bool

Check if RTC offset is significant (>10km)

Source

pub fn building_rotation(&self) -> Option<f64>

Get building rotation angle in radians (from IfcSite placement) Returns None if no rotation was detected

Source

pub fn geometry_hash_count(&self) -> usize

Number of per-entity geometry fingerprints recorded.

Source

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

Source

pub fn new() -> Self

Create new empty collection

Source

pub fn with_capacity(capacity: usize) -> Self

Create new collection with capacity hint

Source

pub fn add(&mut self, mesh: MeshDataJs)

Add a mesh to the collection

Source

pub fn set_diagnostics(&mut self, diagnostics: GeometryDiagnostics)

Attach the batch’s typed CSG / opening diagnostics (the public GeometryDiagnostics contract).

Source

pub fn from_vec(meshes: Vec<MeshDataJs>) -> Self

Create from vec of meshes

Source

pub fn len(&self) -> usize

Get number of meshes (internal)

Source

pub fn is_empty(&self) -> bool

Check if collection is empty

Source

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)

Source

pub fn set_building_rotation(&mut self, rotation: Option<f64>)

Set the building rotation angle in radians

Source

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

Source§

fn clone(&self) -> Self

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 Default for MeshCollection

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<MeshCollection> for JsValue

Source§

fn from(value: MeshCollection) -> Self

Converts to this type from the input type.
Source§

impl FromWasmAbi for MeshCollection

Source§

type Abi = WasmPtr<WasmRefCell<MeshCollection>>

The Wasm ABI type that this converts from when coming back out from the ABI boundary.
Source§

unsafe fn from_abi(js: Self::Abi) -> Self

Recover a Self from Self::Abi. Read more
Source§

impl IntoWasmAbi for MeshCollection

Source§

type Abi = WasmPtr<WasmRefCell<MeshCollection>>

The Wasm ABI type that this converts into when crossing the ABI boundary.
Source§

fn into_abi(self) -> Self::Abi

Convert self into Self::Abi so that it can be sent across the wasm ABI boundary.
Source§

impl LongRefFromWasmAbi for MeshCollection

Source§

type Abi = WasmPtr<WasmRefCell<MeshCollection>>

Same as RefFromWasmAbi::Abi
Source§

type Anchor = RcRef<MeshCollection>

Same as RefFromWasmAbi::Anchor
Source§

unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor

Same as RefFromWasmAbi::ref_from_abi
Source§

impl OptionFromWasmAbi for MeshCollection

Source§

fn is_none(abi: &Self::Abi) -> bool

Tests whether the argument is a “none” instance. If so it will be deserialized as None, and otherwise it will be passed to FromWasmAbi.
Source§

impl OptionIntoWasmAbi for MeshCollection

Source§

fn none() -> Self::Abi

Returns an ABI instance indicating “none”, which JS will interpret as the None branch of this option. Read more
Source§

impl RefFromWasmAbi for MeshCollection

Source§

type Abi = WasmPtr<WasmRefCell<MeshCollection>>

The Wasm ABI type references to Self are recovered from.
Source§

type Anchor = RcRef<MeshCollection>

The type that holds the reference to 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§

unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor

Recover a Self::Anchor from Self::Abi. Read more
Source§

impl RefMutFromWasmAbi for MeshCollection

Source§

type Abi = WasmPtr<WasmRefCell<MeshCollection>>

Same as RefFromWasmAbi::Abi
Source§

type Anchor = RcRefMut<MeshCollection>

Same as RefFromWasmAbi::Anchor
Source§

unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor

Same as RefFromWasmAbi::ref_from_abi
Source§

impl SupportsConstructor for MeshCollection

Source§

impl SupportsInstanceProperty for MeshCollection

Source§

impl SupportsStaticProperty for MeshCollection

Source§

impl TryFromJsValue for MeshCollection

Source§

fn try_from_js_value(value: JsValue) -> Result<Self, JsValue>

Performs the conversion.
Source§

fn try_from_js_value_ref(value: &JsValue) -> Option<Self>

Performs the conversion.
Source§

impl VectorFromWasmAbi for MeshCollection

Source§

impl VectorIntoWasmAbi for MeshCollection

Source§

impl WasmDescribe for MeshCollection

Source§

impl WasmDescribeVector for MeshCollection

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<U> As for U

Source§

fn as_<T>(self) -> T
where T: CastFrom<U>, U: Sized,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. 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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ReturnWasmAbi for T
where T: IntoWasmAbi,

Source§

type Abi = <T as IntoWasmAbi>::Abi

Same as IntoWasmAbi::Abi
Source§

fn return_abi(self) -> <T as ReturnWasmAbi>::Abi

Same as IntoWasmAbi::into_abi, except that it may throw and never return in the case of Err.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

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

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more