Skip to main content

ogeom_topo/
lib.rs

1//! The boundary-representation data model. What this model can express is what
2//! the kernel can do, so its invariants are normative; see `docs/DATA_MODEL.md`.
3//!
4//! *Elsewhere:* `TopoDS`, `TopAbs`, `TopExp`, `TopTools`, `TopLoc` and `BRep`.
5//!
6//! Non-negotiable invariants:
7//!
8//! - A shape is a **(TShape, Location, Orientation) triple**: a positionless,
9//!   orientationless shared topology node plus a placement plus an orientation.
10//!   Cheap to copy; the heavy data lives once in an arena.
11//! - **Location is a chain** of `(datum, power)` pairs, not a flat 4x4. Composition
12//!   is list concatenation and the composed transform is computed lazily. This is
13//!   what lets an assembly of 10,000 identical bolts share one piece of geometry,
14//!   and what keeps identical-instance detection a cheap chain comparison.
15//! - **Orientation composes multiplicatively** down the tree. An edge's effective
16//!   orientation inside a face depends on that face's orientation inside its shell.
17//! - **Identity is a trichotomy**: same (tshape + location), equal (+ orientation),
18//!   partner (tshape only), each with a consistent hasher. Conflating these is a
19//!   classic source of silent bugs.
20//! - **Tolerances are per-entity**, with `tol(vertex) >= tol(edge) >= tol(face)`, and
21//!   they grow through operations. This is the kernel's answer to inexact
22//!   arithmetic; every production kernel works this way.
23//! - **An edge carries a list of representations**, not one curve: a 3D curve, one
24//!   pcurve per adjacent face, two pcurves for a seam edge on a closed surface, plus
25//!   polygon and triangulation representations, with a `same_parameter` flag and a
26//!   repair routine.
27
28pub mod entity;
29pub mod location;
30pub mod model;
31pub mod shape;
32pub mod tessellation;
33
34pub use entity::{
35    CurveId, EdgeData, EdgeRepr, FaceData, GeometryStore, NodeData, PCurveId, SurfaceId,
36    TriangulationId, VertexData, check_containment, enforce_containment,
37};
38pub use location::{Datum, DatumId, DatumStore, Location};
39pub use model::{Absorbed, Filter, Model, ModelParts, ancestors_of, explore, explore_unique};
40pub use shape::{Orientation, PartnerKey, SameKey, Shape, ShapeType, TShape, TShapeId};
41pub use tessellation::Triangulation;