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: Boolean clipping for wall openings
- Mesh Processing: Normal calculation and coordinate transformations
§Supported Geometry Types
| Type | Status | Description |
|---|---|---|
IfcExtrudedAreaSolid | Full | Most common - extruded profiles |
IfcFacetedBrep | Full | Boundary representation meshes |
IfcTriangulatedFaceSet | Full | Pre-triangulated (IFC4) |
IfcBooleanClippingResult | Partial | CSG difference operations |
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 error::Error;pub use error::Result;pub use mesh::Mesh;pub use profile::Profile2D;pub use profile::ProfileType;pub use extrusion::extrude_profile;pub use csg::Plane;pub use csg::Triangle;pub use csg::ClippingProcessor;pub use csg::calculate_normals;pub use triangulation::triangulate_polygon;pub use router::GeometryRouter;pub use router::GeometryProcessor;pub use profiles::ProfileProcessor;pub use processors::ExtrudedAreaSolidProcessor;pub use processors::TriangulatedFaceSetProcessor;pub use processors::MappedItemProcessor;pub use processors::FacetedBrepProcessor;pub use processors::BooleanClippingProcessor;pub use processors::SweptDiskSolidProcessor;pub use processors::RevolvedAreaSolidProcessor;pub use processors::AdvancedBrepProcessor;
Modules§
- csg
- CSG (Constructive Solid Geometry) Operations
- error
- extrusion
- Extrusion operations - converting 2D profiles to 3D meshes
- mesh
- Mesh data structures
- processors
- Geometry Processors - P0 implementations
- profile
- 2D Profile definitions and triangulation
- profiles
- Profile Processors - Handle all IFC profile types
- router
- Geometry Router - Dynamic dispatch to geometry processors
- triangulation
- Polygon triangulation utilities