Expand description
§IFC-Lite Geometry Processing
Efficient geometry processing for IFC models using earcutr triangulation and nalgebra for transformations.
§Overview
This crate transforms IFC geometry representations into GPU-ready triangle meshes:
- Profile Handling: Extract and process 2D profiles (rectangle, circle, arbitrary)
- Extrusion: Generate 3D meshes from extruded profiles
- Triangulation: Polygon triangulation with hole support via earcutr
- CSG Operations: Full boolean operations (difference, union, intersection)
- Mesh Processing: Normal calculation and coordinate transformations
§Supported Geometry Types
| Type | Status | Description |
|---|---|---|
IfcExtrudedAreaSolid | Full | Most common - extruded profiles |
IfcExtrudedAreaSolidTapered | Full | Lofted extrusion between two profiles |
IfcFacetedBrep | Full | Boundary representation meshes |
IfcTriangulatedFaceSet | Full | Pre-triangulated (IFC4) |
IfcBooleanClippingResult | Full | CSG operations (difference, union, intersection) |
IfcMappedItem | Full | Instanced geometry |
IfcSweptDiskSolid | Full | Pipe/tube geometry |
§Quick Start
ⓘ
use ifc_lite_geometry::{
Profile2D, extrude_profile, triangulate_polygon,
Point2, Point3, Vector3
};
// Create a rectangular profile
let profile = Profile2D::rectangle(2.0, 1.0);
// Extrude to 3D
let direction = Vector3::new(0.0, 0.0, 1.0);
let mesh = extrude_profile(&profile, direction, 3.0)?;
println!("Generated {} triangles", mesh.triangle_count());§Geometry Router
Use the GeometryRouter to automatically dispatch entities to appropriate processors:
ⓘ
use ifc_lite_geometry::{GeometryRouter, GeometryProcessor};
let router = GeometryRouter::new();
// Process entity
if let Some(mesh) = router.process(&decoder, &entity)? {
renderer.add_mesh(mesh);
}§Performance
- Simple extrusions: ~2000 entities/sec
- Complex Breps: ~200 entities/sec
- Boolean operations: ~20 entities/sec
Re-exports§
pub use rect_fast::RectFastStats;pub use clash_solid::intersection_solid;pub use clash_solid::DegenerateReason;pub use clash_solid::IntersectionSolid;pub use csg::calculate_normals;pub use csg::ClippingProcessor;pub use csg::GroupCut;pub use csg::GroupReject;pub use csg::Plane;pub use csg::Triangle;pub use material_layer_index::LayerAxis;pub use material_layer_index::LayerBuildup;pub use material_layer_index::LayerInfo;pub use material_layer_index::MaterialLayerFlat;pub use material_layer_index::MaterialLayerIndex;pub use mesh::InstanceMeta;pub use mesh::Mesh;pub use mesh::SubMesh;pub use mesh::SubMeshCollection;pub use analytic::extract_analytic_extrusion;pub use analytic::extract_analytic_profile;pub use analytic::extract_swept_disk;pub use analytic::AnalyticCurveSegment;pub use analytic::AnalyticExtrusion;pub use analytic::AnalyticProfile;pub use analytic::AnalyticProfileLoop;pub use analytic::AnalyticStatus;pub use analytic::AnalyticSweptDisk;pub use analytic::ProfileLoopKind;pub use simplify::simplify_mesh;pub use simplify::SimplifyOptions;pub use simplify::SimplifyStats;
Modules§
- analytic
- Exact source descriptions for IFC geometry, in representation-local IFC units. A description does not claim to include later boolean operations.
- clash_
solid - The intersection SOLID of a clashing pair — the overlap volume itself, as a mesh the viewer can draw opaque while ghosting both parents (the BIMcollab Zoom / Solibri presentation). A contact point tells you two elements touch; this tells you how deep, in what shape, and in which direction.
- csg
- CSG (Constructive Solid Geometry) Operations
- kernel
- Pure-Rust exact mesh-arrangement CSG kernel — the only CSG kernel, on every target (see docs/architecture/geometry-pipeline.md). Pure-Rust exact mesh-arrangement CSG kernel — predicate foundation.
- material_
layer_ index - Material Layer Index
- mesh
- Mesh data structures
- mesh_
weld - Intra-mesh vertex weld + index dedup applied at the per-element mesh source
(
build_mesh_data), collapsing the faceted-brep per-face vertex duplication while keeping creases (distinct normals) split. Intra-mesh vertex weld + index dedup, applied at the mesh SOURCE. - progress
- Cooperative heartbeat from long geometry work to a host that must tell a slow call from a hung one (see the module docs). Cooperative progress heartbeat from inside long geometry work.
- projection_
outline - Winding-independent 2D footprint outline of a mesh, for construction projection on 2D floor plans (issue #979).
- rect_
fast - Analytic fast path for axis-aligned rectangular openings cut through an axis-aligned box host (the dominant case: rectangular windows/doors in a straight wall). This sidesteps the exact mesh-arrangement CSG kernel — which is at its single-threaded, memory-bandwidth-bound floor — for openings that need no exact arithmetic at all.
- simplify
- Per-element mesh simplification for the demesher (cavity removal, grid vertex-clustering decimation, bounding-box collapse). Per-element mesh simplification (“demesher”).
- space_
dcel - Persistent, editable space topology (DCEL)
- zone_
split - Cut one element into one closed solid per location zone (#2508 item 2), on top of the exact kernel rather than beside it. Cut one element into one solid per location zone (issue #2508 item 2).
Structs§
- Advanced
Brep Processor - AdvancedBrep processor Handles IfcAdvancedBrep and IfcAdvancedBrepWithVoids - NURBS/B-spline surfaces Supports planar faces and B-spline surface tessellation
- Alignment
Axis - Shared evaluated axis. Retains the canonical evaluator before renderer conversion, so a future WASM consumer can request an f64 frame at any distance.
- Alignment
Curve - Parsed alignment curve. Holds horizontal and vertical segments in authored order with cumulative-start stations precomputed.
- Alignment
Frame - Cross-section placement frame at a station.
- Alignment
Sample - Alignment
Sampling Diagnostic - Alignment
Sampling Options - Output bounds include both endpoints. Distance starts at the physical start, irrespective of authored chainage; spacing is horizontal distance in metres.
- Alignment
Sampling Report - Bool
Failure - Single boolean / CSG failure record.
- Boolean
Clipping Processor - BooleanResult processor Handles IfcBooleanResult and IfcBooleanClippingResult - CSG operations
- Classification
Stats - Counts of opening classification outcomes during the most recent
geometry pass. Useful for confirming whether the host-aware
floor-opening classifier guard (commit
1e033f8) is taking effect on a given model. - Classification
Summary - Opening-classifier outcome counts (rectangular / diagonal / non-rectangular).
- Collated
- Result of collation: instanced templates + the meshes left to render flat.
- Contour
Set - The result of a contour-set boolean: rings grouped into disjoint shapes.
- Decoded
Instance - One occurrence of a decoded template.
- Decoded
Instanced - A decoded instanced shard.
- Decoded
Template - A unique geometry decoded from an instanced shard.
- Extracted
Profile - A profile extracted from a single IFC building element.
- Extruded
Area Solid Processor - ExtrudedAreaSolid processor (P0) Handles IfcExtrudedAreaSolid - extrusion of 2D profiles
- Extruded
Area Solid Tapered Processor - Face
Based Surface Model Processor - Handles
IfcFaceBasedSurfaceModel: FbsmFaces (SET of IfcConnectedFaceSet) -> Face[] -> FaceBound -> PolyLoop, or AdvancedFace[] -> FaceSurface. - Faceted
Brep Processor - FacetedBrep processor Handles IfcFacetedBrep - explicit mesh with faces Supports faces with inner bounds (holes) Uses parallel triangulation for large BREPs
- Fixed
Grid Composition - Bounded sequential fixed-grid authoring. The caller charges worst-case work before construction and each overlay; this context independently caps sizes.
- Geometry
Closure - What an ENTITY’s produced geometry looked like topologically, folded over every segment the hasher was fed (#1891).
- Geometry
Diagnostics - Aggregate CSG / opening diagnostics for one geometry pass — the public
diagnostics contract. Built by
aggregate_diagnosticsfrom drained router data and serialized to the @ifc-lite/geometrycompleteevent, and reused verbatim by the nativeProcessingStatspath (rust/processing/src/processor/mod.rspopulatesgeometry_diagnostics). wasm-free (serde only). - Geometry
Hasher - 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.
- Geometry
Router - Geometry router - routes entities to processors
- Host
Opening Diagnostic - Per-host opening diagnostic captured during void processing.
- Image
Texture Ref - An unresolved
IfcImageTexturereference (#1781). - Instance
Mesh Ref - A borrowed view of a mesh for collation/encoding — lets callers feed geometry
from any owner (geometry’s
Mesh, processing’sMeshData) WITHOUT cloning the vertex data (cloning 219k meshes’ geometry risks the build-container OOM). - Instance
Occurrence - One occurrence of a template geometry.
- Instance
Template - A unique geometry shared by two or more occurrences.
- Mesh
Texture - A decoded RGBA8 image ready for GPU upload.
- Opening
Diagnostic - One opening’s worth of diagnostic data — what
classify_openingsobserved about it. - Orient
Verdict - What
orient_mesh_outward_verdictconcluded about a mesh’s SURFACE TOPOLOGY, on top of whether it re-wound anything. - Plane
Frame - A plane in 3D:
world = origin + u * u_axis + v * v_axis. - Polygonal
Face SetProcessor - Handles IfcPolygonalFaceSet - explicit polygon meshes that need triangulation Unlike IfcTriangulatedFaceSet, faces can be arbitrary polygons (not just triangles)
- Profile2D
- 2D Profile with optional holes
- Profile2D
With Voids - Profile with void tracking for depth-aware extrusion
- Profile
Processor - Profile processor - processes IFC profiles into 2D contours
- Reason
Count - One CSG failure reason and its occurrence count this pass.
reasonis one of the stablecrate::diagnostics::BoolFailureReason::labelstrings. - Rect
Fast Summary - rect_fast fast-path engagement counters (perf observability).
- Rect
Param - EXACT parametric oriented box of a rectangular extrusion, in WORLD space.
rcolumns are the orthonormal world axes (profile-X’, profile-Y’, extrude);halfare the half-extents along those axes (XDim/2, YDim/2, Depth/2). Produced byGeometryRouter::parametric_rect_probe. - Resolved
Texture Map - A fully resolved
IfcIndexedTriangleTextureMapfor one face set. - Revolved
Area Solid Processor - RevolvedAreaSolid processor Handles IfcRevolvedAreaSolid - rotates a 2D profile around an axis
- Sampled
Alignment Axis - Scan
Outline - Traced outline in plane coordinates.
- Scan
Outline Diagnostics - What the run did, for the UI and for judging a result. Serialises to
camelCase for the wasm binding.
#[non_exhaustive]: diagnostics grow as the tracer does, and only this crate builds them. - Scan
Outline Options - Every tunable of the tracer, with defaults sized for building scans in metres. Deserialises from camelCase with every field optional (absent means the default) and unknown fields refused, which is the shape the wasm binding accepts.
- Shared
Brep Signature Cache - Model-scoped memo of completed fast BREP signatures, keyed by express id. Create a fresh cache for every source/model; identical ids in different models must never share this cache. Quality, scale and RTC are folded later.
- Skipped
Profile - A building element whose construction-projection profile was dropped —
its
IfcExtrudedAreaSolid(direct or viaIfcMappedItem) is present but could not be turned into 2D drawing geometry, or the mapped-item chain was too deep. Never an element the extractor deliberately excludes (a non-IfcExtrudedAreaSolidrepresentation, anIfcFeatureElement). - Surface
OfLinear Extrusion Processor - SurfaceOfLinearExtrusion processor Handles IfcSurfaceOfLinearExtrusion - surface created by sweeping a curve along a direction
- Swept
Disk Solid Processor - SweptDiskSolid processor Handles IfcSweptDiskSolid - sweeps a circular profile along a curve
- Terrain
CdtMesh - A deterministic, f64 constrained triangulation. Indices address
points. - Texture
Attachment - A surface texture attached to an output mesh: the stable dedup key plus the
pixel source.
texture_idis theIfcSurfaceTextureexpress id — every mesh sampling the same image carries the same id, so consumers create one GPU texture per id instead of one per mesh. - Triangulated
Face SetProcessor - TriangulatedFaceSet processor (P0) Handles IfcTriangulatedFaceSet - explicit triangle meshes
- Union
Find - Disjoint sets over
0..n. - Void
Index - Index mapping host elements to their voids
- Void
Info - Void metadata for depth-aware extrusion
- Worst
Host - One of the worst-failing host elements (bounded top-N, opt-in detail).
Enums§
- Alignment
Sampling Diagnostic Code - Bool
Failure Reason - Why a boolean operation failed or was skipped.
- BoolOp
- Which boolean operation produced the failure.
- Boolean
Op2D - Which boolean to apply in
boolean_2d. - Contour
Fill Rule - Explicit winding rule for quantized planar authoring.
- Error
- Errors that can occur during geometry processing
- Opening
Kind Diag - Discriminator for
OpeningDiagnostic::kind. MirrorsOpeningTypewithout dragging the geometry data along. - Profile
Type - Common profile types
- Terrain
CdtError - Failure to build a constrained terrain mesh.
- Tessellation
Quality - Detail level for geometry tessellation, selectable by consumers.
- Texture
Source - Where a resolved surface texture’s pixels come from.
Constants§
- DEFAULT_
GEOM_ HASH_ TOLERANCE - Default quantization grid in metres (1 mm). Chosen as a starting point near
the
f32precision floor of RTC-local coordinates;tolerance_sweeponly exercises a synthetic cube today; real-revision-pair calibration is still open (see that test’s doc comment). - FACETED_
BREP_ DEDUP_ FACE_ LIMIT - Face-count threshold above which [
faceted_brep_face_count] tells the caller to skip the structural signature walk entirely (#1909). The walk in [try_faceted_brep_signature] mirrors the mesher’s own traversal face-by-face, bound-by-bound, point-by-point — for dedup to pay off there must be at least one OTHER item sharing this exact signature. Tekla-style duplication (thousands of connection plates/bolts, the case this cache exists for) tops out at low hundreds of faces per part; a SINGLE huge faceted import — a terrain, a scanned mesh, one big BREP with no sibling — has none, so hashing every point is pure loss that DOUBLES the traversal cost of an already-expensive mesh with no possible payback. Set well above any plausible detail-part face count and well below the scale where a single giant mesh becomes measurably worse — a 2.5 M-triangle model reported ~30 s where web-ifc took ~2.85 s, traced to this hash. - GEOMETRY_
DIAGNOSTICS_ SCHEMA_ VERSION - Compatibility handshake for the
GeometryDiagnosticscontract, serialized asschemaVersion. DISTINCT from the viewer cacheFORMAT_VERSION(an invalidation token): this is a promise consumers can gate on. - INSTANCED_
MAGIC "IFNS"little-endian — the instanced-shard magic the TS decoder validates.- INSTANCED_
VERSION - Instanced format version this encoder writes for a record that CARRIES
trailing field 1 (
item_id). Decoders accept v1 and any version at or above 2 that declares a valid stride, so this bumps only when a trailing field is APPENDED — never to gate a read. Keep in lockstep with the TS decoder. - LARGE_
COORD_ THRESHOLD_ METERS - The large-coordinate threshold and its predicate, defined in
ifc_lite_core::limitsso core’s own bounds scan can use them too. The large-coordinate threshold (metres): a world coordinate whose magnitude exceeds this needs RTC re-basing before it is cast to f32, or the model renders with vertex jitter. - MAX_
CELLS_ LIMIT - Largest cell budget accepted: about 64 M cells, a few hundred MB of working grids, which is what a 32-bit wasm heap can still afford.
- MAX_
GAP_ LIMIT - Hard upper bound on
ScanOutlineOptions::max_gap: a closing radius that bridges more than half a metre starts to fuse rooms and erase corridors. - MAX_
SNAP_ DISTANCE_ CELLS - The snap band gathers
(2r + 3)²cells per step along an edge. - MAX_
TEXTURE_ DIMENSION - Upper bound on a decoded texture’s width/height. 16384² RGBA ≈ 1 GiB — a
hostile/garbage image header claiming larger dimensions is rejected BEFORE
any pixel buffer is allocated, so a crafted file can’t drive an OOM. Matches
the
IfcPixelTexturebound. - MAX_
VERTEX_ MOVE_ CELLS - The support check searches a disk of about this radius per edge sample.
- MIN_
CELL_ SIZE_ LIMIT - Finest cell accepted (metres). Finer cells only grow the radii (in cells) that the closing and the support check work in.
- MIN_
GEOM_ HASH_ TOLERANCE - Floor on the quantization tolerance (
GeometryHasher::newclamps any smaller request up to this). - UNATTRIBUTED_
PRODUCT_ ID - The
csg_failureskey used for records that belong to no single product: the boolean processors’ own logs (swept once per element bycrate::GeometryRouter::drain_processor_failures) andPENDING_MAPPED_BOOL_FAILURES. Zero is not a valid IFC express id, so it cannot collide with a real product.
Traits§
- Geometry
Processor - Geometry processor trait Each processor handles one type of IFC representation
Functions§
- aggregate_
diagnostics - Build a
GeometryDiagnosticsfrom drained router data. wasm-free so both the wasm/viewer path and a future native path can produce the same contract. The caller owns draining: the router accessors are destructive (mem::take), so drain once and pass the results here — do not double-take. - bake_
source_ at_ world - Bake a SOURCE-coords
Meshat a PRE-RTC row-major world transform into absolute POST-RTC world geometry(positions, normals, indices)— the #1623 Phase 2 finalize fallback for a don’t-bake instance whose template occurrence never materialized (an orphan; effectively unreachable for the eligible single-solid type-instanced set, but kept so geometry is NEVER silently lost). The affine part transforms positions; the inverse-transpose of the linear part transforms normals (renormalized). Geometrically equal to the baked flat occurrence (same triangles); the registry source is pre-weld, so vertices are unwelded — that changes only the vertex count, not the rendered surface. - boolean_
2d - Apply a boolean operation to two contour sets.
- boolean_
2d_ fixed_ grid - Fixed-grid contour overlay using the same canonical engine and complete
island/hole collector as
boolean_2d. Coordinates are quantized; callers must includegrid_sizein their declared approximation and charge repeated operations against a shared budget. The per-call edge cap also bounds the uninterruptible overlay’s worst-case intersection expansion. - build_
aggregate_ children_ index - Scan
contentforIfcRelAggregatesand build the full (unfiltered) parent → children map used bypropagate_voids_via_aggregates. - build_
texture_ index - Scan the model for
IfcIndexedTriangleTextureMapentities and build an index keyed by the face set id each one maps to (issue #961). Cheap substring bail-out keeps untextured files (the overwhelming majority) off the scan. - collate_
and_ encode - One-shot producer: collate the mesh views into templates + instances and
encode them as an instanced shard. The caller (e.g. the native helper) builds
InstanceMeshRefs borrowing its own mesh storage — no geometry is cloned. - collate_
instances collate_refsover geometryMeshvalues (thin wrapper, no geometry clone).- collate_
refs - Group instanceable meshes by representation identity into templates +
per-instance transforms.
min_groupis the smallest occurrence count worth instancing (groups below it are emitted flat); use 2 to instance any repeat. - collate_
refs_ in_ basis collate_refsagainst baked positions that are NOT in the native frame:baked_basisis what the baker did to the vertices afterInstanceMetawas captured, so thatp_baked = B · p_native.- collate_
refs_ verified_ in - Compatibility entry point preserving the original verify-only emission
contract. Use
collate_refs_in_basisfor baked-frame output. - compose_
instance_ world_ row_ major - Compose an occurrence’s full PRE-RTC world transform
transform·local·canonicalas a row-major[f64; 16]. Public so the processing crate’s don’t-bake finalize (#1623 Phase 2) can record the SAME world placementcollate_refscomputes for a baked occurrence — without materializing the occurrence’s vertices. - compute_
parts_ to_ skip - Compute the set of aggregated
IfcBuildingElementPartids to skip when the “merge multilayer wall as a single solid” toggle is on (issue #540): a part is skipped when its parent’s layered build-up is sliceable, so the parent’s merged-layer geometry is drawn instead of the individual parts. - compute_
signed_ area - Compute the signed area of a 2D contour Positive = counter-clockwise, Negative = clockwise
- coord_
is_ large - The large-coordinate threshold and its predicate, defined in
ifc_lite_core::limitsso core’s own bounds scan can use them too. True when any component ofpoint(metres) lies strictly beyondLARGE_COORD_THRESHOLD_METERSfrom the origin. - count_
attributed_ products - How many REAL products have at least one failure. The synthetic
UNATTRIBUTED_PRODUCT_IDbucket is excluded: it is not a product, and counting it would report “1 product failed” for a model where the only records came from an unattributed sweep. Its records still count towards the failure TOTALS — they are real failures, only their owner is unknown. - decode_
instance_ finishes - Trailing field 2 of every instance record, in instance order (#5984):
[metallic, roughness], NaN where unauthored. A shard whose stride does not reach the field (v1, v2, or a v3 written by a model without finishes) reads as all-NaN rather than failing, the same forward/backward rule the item id follows.Noneexactly whendecode_instancedwould refuse the header or the instance table does not fit the buffer. - decode_
instanced - Decode an instanced shard. Returns None on a bad magic/version or truncation.
- embedded_
raster_ dimensions - Inspect supported raster headers without decoding pixel buffers. Hosts that aggregate many embedded images can budget their allocations before decoding. A successful header read does not certify the compressed pixel stream.
- encode_
instanced encode_refsover geometryMeshvalues, with id/colour accessor closures (thin wrapper, no geometry clone).- encode_
refs - Encode a
Collatedresult + its source mesh views into an instanced shard. Per-occurrence entity id + colour come from eachInstanceMeshRef. - encode_
refs_ with_ finishes encode_refsplus each occurrence’s IFC-authored finish (#5984):finishes[i]ismeshes[i]’s[metallic, roughness], NaN where unauthored, and a missing entry is unauthored.InstanceMeshRefis published with public fields, so the finish travels beside it rather than in it. Only a shard where some written occurrence authors a finish widens its records to trailing field 2 (stride 100, version 3); every other shard is byte-identical toencode_refs’s, so a model without finishes pays nothing. Read back withsuper::decode_instance_finishes.- ensure_
ccw - Ensure contour has counter-clockwise winding (positive area)
- ensure_
cw - Ensure contour has clockwise winding (for holes)
- extract_
profiles - Extract
IfcExtrudedAreaSolidprofiles (incl. nestedIfcMappedItem) for every element incontent. Drops are silent — seeextract_profiles_with_diagnostics. - extract_
profiles_ with_ diagnostics - Same as
extract_profiles, plus everySkippedProfile(default features — unlikediag_debug!). - extrude_
profile - Extrude a 2D profile along the Z axis
- extrude_
profile_ lofted - Extrude with a different cross section at the top (lofted/tapered extrusion).
- extrude_
profile_ with_ voids - Extrude a 2D profile with void awareness
- format_
unsupported_ breakdown - The human-facing
type=countbreakdown, count-desc then name, as one line. - hash_
mesh_ world - Convenience: hash a single-segment entity in one call.
- instance_
rel_ row_ major_ f32 - Template-relative instance transform
rel = post_rtc(M_k) · post_rtc(M_ref)⁻¹as a row-major[f32; 16], orNonewhenM_refis singular.m_k/m_refare PRE-RTC row-major world transforms (seecompose_instance_world_row_major);rtcis the model offset. This is EXACTLYcollate_refs’ per-occurrencerel, exposed for the don’t-bake finalize where the occurrence carries no geometry to group — the template’s baked world geometry placed byrelreproduces the occurrence’s world geometry (bounded byverify_recomposition). #1623 Phase 2. - is_
valid_ contour - Check if a contour is valid (has area, not degenerate)
- local_
frame_ set_ enabled_ override - Test/harness-only: force the target/env fallback on/off, or
Nonefor the target default. A router constructed with an explicit frame policy does not consult this process-global hook. Mirrorsrect_fast::param_set_enabled_override. The mesh-output determinism manifest uses it to run native and wasm with the SAME flag state (wasm defaults ON, native defaults OFF below), so the two targets’ outputs are comparable byte-for-byte. - locate_
axis_ curve - Resolve an
IfcAlignment’s directrix curve. - meshed_
representations - The representations of
element(itsIfcProductDefinitionShapeRepresentations, decoded) that the element meshing paths mesh, in order: eachIfcShapeRepresentationwhose effective type is body geometry, or an annotation’s 2D fill, or that names no type at all, minus aMappedRepresentationwhen the element also carries direct body geometry. Anything that must agree with what renders (theIgnoreOpaqueopening filter inifc-lite-processing, #4699) selects through this. - orient_
mesh_ outward - Orient every connected component of
meshconsistently and outward, in place. Returnstrueiff any triangle’s winding was flipped (the caller must then recompute normals — the existing ones were baked with the old winding). - orient_
mesh_ outward_ verdict orient_mesh_outward, also reporting the per-component topology it had to work out along the way. SeeOrientVerdict.- parse_
axis2_ placement_ 3d - Parse IfcAxis2Placement3D into transformation matrix
- parse_
axis2_ placement_ 3d_ from_ id - Parse IfcAxis2Placement3D from entity ID (fast-path variant)
- parse_
cartesian_ point - Parse IfcCartesianPoint from an entity attribute
- parse_
cartesian_ point_ from_ id - Parse IfcCartesianPoint from entity ID (fast-path variant)
- parse_
direction - Parse IfcDirection entity
- parse_
direction_ from_ id - Parse IfcDirection from entity ID.
- point_
in_ contour - Check if a point is inside a contour using ray casting
- propagate_
voids_ to_ parts - Propagate void (opening) relationships from aggregate parents to their children
and return a child-part → parent-element map covering every emitted aggregate
IfcWall→IfcBuildingElementPartpair. - propagate_
voids_ via_ aggregates - Propagate openings from hosts that aggregate parts to every aggregated descendant — any depth, any type (IfcWallElementedCase panels, IfcRoof → IfcSlab skylights, nested assemblies, …).
- resolve_
2d - Resolve a ring set into disjoint shapes without changing the area it covers
(a self-union). Canonicalises a hand-built contour set — or the flattened
rings of a
MeshOutline— into grouped outer/hole shapes. - rotation_
angle_ about_ z - The building/site rotation about the world vertical (Z) axis, derived from a
resolved column-major 4×4 placement matrix (as returned by
crate::GeometryRouter::resolve_scaled_placement). The local X-axis (the placement’s RefDirection, composed through the full parent chain and normalized) is column 0 — elements[0],[1],[2]— so its angle in the world XY plane isatan2(m[1], m[0]). - sample_
alignment_ axes - Sample every resolvable alignment in source order. Failed axes are reported; no identity-placement or implicit-metre fallback is permitted. When bounds coarsen spacing both endpoints remain; exhausted total budgets omit later axes with explicit diagnostics. The cap applies to emitted samples, not IFC parsing memory (which is bounded by input size and canonical refwalk guards).
- sanitize_
contours - Drop rings that cannot contribute, so no input can panic or hang the overlay: fewer than 3 vertices, ANY non-finite coordinate (a NaN makes i_overlay’s segment ordering meaningless, so the whole ring goes rather than the offending point — dropping single points would silently deform the boundary instead), or all vertices collinear (a ring with no interior). A trailing vertex equal to the first is stripped, so a caller that closes its rings explicitly does not feed in a zero-length edge. Note this drops only provably-collinear rings, NOT by area: a zero-signed-area bow-tie still carries coverage under NonZero and is left for i_overlay.
- scale_
segments - Scale a tessellator’s segment count by the selected quality level.
- subtract_
2d - Perform 2D boolean difference: profile - void_contour
- subtract_
multiple_ 2d - Perform 2D boolean difference with multiple voids at once
- subtract_
multiple_ 2d_ counted - Like
subtract_multiple_2d, but also reports how many DISCONNECTED output shapes the difference produced (each with non-degenerate area). The returnedProfile2Dis the largest shape (assubtract_multiple_2d); a caller that must not silently drop geometry — the 2D opening-subtraction re-extrude — checksshapes == 1and otherwise defers to the exact kernel (a void that splits the profile into pieces can’t be re-extruded from a single profile). - take_
bool2d_ stats - Read + reset the 2D-path telemetry: (hosts cut via the 2D path, opening footprints subtracted in those hosts). Process-global; used by the perf harness to report the fast-path hit-rate. Relaxed atomics — a stale read under concurrency only mis-reports a diagnostic count, never geometry.
- take_
cdt_ recovery_ fallbacks - Read + reset
(stuck, exhausted): constraint segments [Cdt::recover_segment] gave up on since the last call, each of which madebuild_fromreturnNoneso the caller ear-clipped.stuckis the “no flippable crossing edge” exit (crossing constraints, a duplicate vertex the segment names);exhaustedis the 100 000-flip guard. Process-global relaxed atomics, likecrate::take_bool2d_stats: a stale read under concurrency mis-reports a diagnostic count, never geometry. - take_
plane_ weld_ stats - Read + reset
[(calls, calls that moved something, vertices moved); 2]as[every caller, union only]. Process-global relaxed atomics: a stale read under concurrency mis-reports a diagnostic count, never geometry. - take_
prism_ defers - Read + reset the per-reason defer counters as (name, count) pairs.
- take_
prism_ stats - Read + reset the prism-path telemetry: (hosts cut via the prism path, openings subtracted analytically, openings routed to the exact residual on prism-cut hosts). Process-global; the perf harness reports the fast-path hit-rate from it. Relaxed atomics — a stale read under concurrency only mis-reports a diagnostic count, never geometry.
- trace_
scan_ outline - Trace outlines from plane points given as flat
[u0, v0, u1, v1, …]. - triangulate_
polygon - Triangulate a simple polygon (no holes) Returns triangle indices into the input points
- triangulate_
terrain_ pslg - Triangulate a non-crossing PSLG through the repository’s exact-predicate CDT. The output covers the convex hull; callers own closed-region/hole selection because an open breakline has no fill-side meaning.
- triangulate_
terrain_ pslg_ with_ progress - Triangulate while checking a caller-supplied cancellation/work callback in source validation, exact CDT construction/recovery, and output emission.
- verify_
recomposition - Maximum per-vertex world-space error (in mesh units) when each occurrence is
reconstructed by applying its instance transform to the template’s baked
world geometry, versus the occurrence’s own baked world geometry. The
template-relative transform operates on world coords, so each mesh’s
originis folded in. Used by tests + as a runtime diagnostic — [verify_pairing] above runs the same [reconstructed_vertex_error] kernel inline, per candidate group, so a production caller never has to run this after the fact to find out itsCollatedshipped a mis-grouped occurrence.
Type Aliases§
- Item
Dedup Cache - Shared content-dedup cache: maps a 128-bit structural item hash to the
LOCAL (pre-placement, void-free, colour-free) item mesh PLUS its precomputed
instancing
rep_identity(Somewhen instancing tagged it, elseNone). Storing the rep beside the mesh lets a cache hit stamp it without re-running the O(verts)compute_mesh_hash_fullper occurrence. Build ONE per loaded model withcrate::GeometryRouter::new_dedup_cacheand inject it into every per-element / per-batch router viacrate::GeometryRouter::enable_content_dedup_sharedso byte-identical geometry is meshed once regardless of how the work is partitioned across threads/batches. - Mapped
Instance Plan - #1623 Phase 2 “don’t-bake” instancing plan:
IfcRepresentationMapexpress id ⇒(occurrence_count, template_item_id), wheretemplate_item_idis the SMALLESTIfcMappedItemexpress id referencing that source (a deterministic, race-free choice of which occurrence materializes its geometry as the shared template). Only sources withoccurrence_count >= 2appear. Built ONCE from the file scan and injected into every per-element / per-batch router viaGeometryRouter::enable_output_instancing. When a mapped item’s source is in this plan AND the occurrence is a single-solid ordinary product, the NON-template occurrences skip the per-occurrence vertex bake and emit an instance-only placeholder (empty geometry carryingcrate::mesh::InstanceMeta) instead of a full materialized mesh — the ~29s / 43M-vertex materialize this phase kills.None⇒ every occurrence materializes (historical flat output, byte-identical); exporters and the determinism harness never arm it. - Matrix4
- A stack-allocated, column-major, 4x4 square matrix.
- Point2
- A statically sized 2-dimensional column point.
- Point3
- A statically sized 3-dimensional column point.
- Result
- Result type for geometry operations
- Ring2D
- A closed ring: 2D points in order, WITHOUT a duplicated closing vertex.
- Shared
Mapped Item Cache - Shared
IfcMappedItemsource cache: maps anIfcRepresentationMapexpress id to its SOURCE-coordinate (pre-MappingTarget, pre-placement, colour-free) item mesh. Build ONE per loaded model withGeometryRouter::new_mapped_item_cacheand inject it into every per-element / per-batch router viaGeometryRouter::enable_shared_mapped_item_cache, so a source shared by many owning elements is meshed ONCE model-wide instead of once per element (a fresh router is built per element, so the per-router RefCellmapped_item_cacheonly dedups WITHIN one element — #1623). The value is the same source-coords mesh the RefCell would store; the per-occurrenceMappingTargettransform +instance_metaare applied by the caller AFTER the lookup, so a cross-router cache hit is byte-identical to a fresh build. - Vector2
- A stack-allocated, 2-dimensional column vector.
- Vector3
- A stack-allocated, 3-dimensional column vector.