ifc_lite_clash/lib.rs
1// This Source Code Form is subject to the terms of the Mozilla Public
2// License, v. 2.0. If a copy of the MPL was not distributed with this
3// file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
5//! # IFC-Lite Clash
6//!
7//! High-performance geometry kernel for clash detection. This is a faithful
8//! native port of the TypeScript reference engine in `packages/clash`: the same
9//! AABB/vector math, triangle-triangle intersection (SAT) and minimum-distance
10//! routines, per-element triangle BVHs, broad-phase candidate generation, and —
11//! crucially — the exact narrow-phase classification.
12//!
13//! All geometric computation is performed in `f64`, even though vertices and
14//! AABBs are sourced from `f32` buffers.
15//!
16//! ## Usage
17//!
18//! ```
19//! use ifc_lite_clash::ClashSession;
20//!
21//! let mut session = ClashSession::new();
22//! // positions: concatenated per-element vertex coords (x, y, z, ...)
23//! // pos_ranges: [float_offset, float_len] per element
24//! // indices: concatenated per-element LOCAL triangle indices
25//! // idx_ranges: [idx_offset, idx_len] per element
26//! // aabbs: [minx, miny, minz, maxx, maxy, maxz] per element
27//! session.ingest(&[], &[], &[], &[], &[]);
28//! let result = session.run_rule(&[], &[], 0, 0.0, 0.0, false);
29//! assert!(result.records.is_empty());
30//! ```
31
32mod aabb;
33mod bvh;
34mod narrow;
35mod triangle;
36mod tri_mesh;
37mod vec3;
38mod session;
39
40pub use aabb::Aabb;
41pub use narrow::ClashStatus;
42pub use session::{ClashRecord, ClashSession, RuleResult};
43
44#[cfg(test)]
45mod tests;