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 bool2d::compute_signed_area;pub use bool2d::ensure_ccw;pub use bool2d::ensure_cw;pub use bool2d::is_valid_contour;pub use bool2d::point_in_contour;pub use bool2d::subtract_2d;pub use bool2d::subtract_multiple_2d;pub use bool2d::union_contours;pub use csg::calculate_normals;pub use csg::ClippingProcessor;pub use csg::Plane;pub use csg::Triangle;pub use diagnostics::BoolFailure;pub use diagnostics::BoolFailureReason;pub use diagnostics::BoolOp;pub use error::Error;pub use error::Result;pub use geom_hash::hash_mesh_world;pub use geom_hash::GeometryHasher;pub use geom_hash::DEFAULT_GEOM_HASH_TOLERANCE;pub use extrusion::extrude_profile;pub use extrusion::extrude_profile_lofted;pub use extrusion::extrude_profile_with_voids;pub use material_layer_index::LayerAxis;pub use material_layer_index::LayerBuildup;pub use material_layer_index::LayerInfo;pub use material_layer_index::MaterialLayerIndex;pub use mesh::CoordinateShift;pub use mesh::Mesh;pub use mesh::SubMesh;pub use mesh::SubMeshCollection;pub use processors::AdvancedBrepProcessor;pub use processors::BooleanClippingProcessor;pub use processors::ExtrudedAreaSolidProcessor;pub use processors::ExtrudedAreaSolidTaperedProcessor;pub use processors::FaceBasedSurfaceModelProcessor;pub use processors::FacetedBrepProcessor;pub use processors::build_texture_index;pub use processors::MappedItemProcessor;pub use processors::MeshTexture;pub use processors::PolygonalFaceSetProcessor;pub use processors::ResolvedTextureMap;pub use processors::RevolvedAreaSolidProcessor;pub use processors::SurfaceOfLinearExtrusionProcessor;pub use processors::SweptDiskSolidProcessor;pub use processors::TriangulatedFaceSetProcessor;pub use alignment::AlignmentCurve;pub use alignment::AlignmentFrame;pub use profile::Profile2D;pub use profile::Profile2DWithVoids;pub use profile::ProfileType;pub use profile::VoidInfo;pub use profile_extractor::extract_profiles;pub use profile_extractor::ExtractedProfile;pub use profiles::ProfileProcessor;pub use router::ClassificationStats;pub use router::GeometryProcessor;pub use router::GeometryRouter;pub use router::HostOpeningDiagnostic;pub use router::OpeningDiagnostic;pub use router::OpeningKindDiag;pub use tessellation::scale_segments;pub use tessellation::TessellationQuality;pub use transform::apply_rtc_offset;pub use transform::parse_axis2_placement_3d;pub use transform::parse_axis2_placement_3d_from_id;pub use transform::parse_cartesian_point;pub use transform::parse_cartesian_point_from_id;pub use transform::parse_direction;pub use transform::parse_direction_from_id;pub use transform::rotation_angle_about_z;pub use triangulation::triangulate_polygon;pub use void_analysis::classify_voids_batch;pub use void_analysis::extract_coplanar_voids;pub use void_analysis::extract_nonplanar_voids;pub use void_analysis::VoidAnalyzer;pub use void_analysis::VoidClassification;pub use void_index::build_aggregate_children_index;pub use void_index::compute_parts_to_skip;pub use void_index::propagate_voids_to_parts;pub use void_index::propagate_voids_via_aggregates;pub use void_index::VoidIndex;pub use void_index::VoidStatistics;
Modules§
- alignment
IfcAlignmentCurveevaluation — horizontal + vertical alignment curves used as the directrix ofIfcSectionedSolidHorizontal.- bool2d
- 2D Boolean Operations for Profile-Level Void Subtraction
- csg
- CSG (Constructive Solid Geometry) Operations
- diagnostics
- Boolean / CSG failure diagnostics.
- error
- extrusion
- Extrusion operations - converting 2D profiles to 3D meshes
- facet_
weld - Deterministic near-coplanar facet weld for faceted-BREP host meshes. Corrects f32 import jitter (~0.09°) so authored-coplanar roof slope facets are EXACTLY coplanar before the exact-kernel opening cut (issue #1007). Deterministic near-coplanar facet weld for faceted-BREP host meshes.
- geom_
hash - Per-entity geometry fingerprinting for model diffing.
- 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
- processors
- Geometry Processors - P0 implementations
- profile
- 2D Profile definitions and triangulation
- profile_
extractor - Profile extraction for architectural 2D drawing projection.
- profiles
- Profile Processors - Handle all IFC profile types
- projection_
outline - Winding-independent 2D footprint outline of a mesh, for construction projection on 2D floor plans (issue #979).
- router
- Geometry Router - Dynamic dispatch to geometry processors
- space_
dcel - Persistent, editable space topology (DCEL)
- tessellation
- Consumer-configurable tessellation quality.
- transform
- Shared transform utilities for IFC geometry processing
- triangulation
- Polygon triangulation utilities
- void_
analysis - Void Analysis Module
- void_
index - Void Index Module