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