Skip to main content

ogeom_core/
lib.rs

1//! Foundation layer: everything else in the workspace is shaped by this crate.
2//!
3//! Four responsibilities:
4//!
5//! - **Arenas.** [`Arena`] and [`Key`]: typed generational index arenas in
6//!   place of intrusive reference counting. No cycle hazard, cache-friendly,
7//!   and arena keys are what make stable entity identity possible at all.
8//! - **Identity.** [`EntityId`] plus [`Provenance`]. Where a topology node's
9//!   identity is its address, every modeling operation produces new ones and
10//!   downstream references break: the topological naming problem. An entity
11//!   records where it came from at creation time instead of having it
12//!   reconstructed from history maps afterwards.
13//! - **Errors.** [`OgeomError`] covers the failure vocabulary a kernel needs, lining
14//!   up with the categories applications already handle, but as a plain [`Result`]:
15//!   no exceptions, and no conversion of hardware signals into throwable
16//!   objects.
17//! - **Numerics.** [`Tolerances`], [`Tolerance`] and the [`Predicates`] trait, so
18//!   the robustness strategy can change without rewriting a single algorithm.
19//!
20//! See `docs/DATA_MODEL.md` for the normative invariants. Section numbers in this
21//! crate's documentation refer to it.
22
23pub mod arena;
24pub mod clock;
25pub mod collections;
26pub mod error;
27pub mod id;
28pub mod parallel;
29pub mod predicates;
30pub mod progress;
31pub mod tolerance;
32
33pub use arena::{Arena, Key, UNSCOPED};
34pub use collections::{FastHasher, FastMap, FastSet};
35pub use error::{Cause, OgeomError, OgeomResult};
36pub use id::{EntityId, OpId, Provenance, ProvenanceTable, Role, SourceId};
37pub use predicates::{Exact, Fast, P2, P3, Predicates, Sign};
38pub use progress::{Canceller, Stage, Watch};
39pub use tolerance::{Tolerance, Tolerances, check_containment};
40
41/// The predicate implementation algorithms use unless told otherwise.
42///
43/// Exact by default: a wrong combinatorial decision in a triangulation or a
44/// boolean is not a slightly-off number, it is an inconsistent structure that
45/// fails somewhere else entirely. Opt into [`Fast`] with a measurement in hand.
46pub type DefaultPredicates = Exact;