Skip to main content

Crate ogeom_topo

Crate ogeom_topo 

Source
Expand description

The boundary-representation data model. What this model can express is what the kernel can do, so its invariants are normative; see docs/DATA_MODEL.md.

Non-negotiable invariants:

  • A shape is a (TShape, Location, Orientation) triple: a positionless, orientationless shared topology node plus a placement plus an orientation. Cheap to copy; the heavy data lives once in an arena.
  • Location is a chain of (datum, power) pairs, not a flat 4x4. Composition is list concatenation and the composed transform is computed lazily. This is what lets an assembly of 10,000 identical bolts share one piece of geometry, and what keeps identical-instance detection a cheap chain comparison.
  • Orientation composes multiplicatively down the tree. An edge’s effective orientation inside a face depends on that face’s orientation inside its shell.
  • Identity is a trichotomy: same (tshape + location), equal (+ orientation), partner (tshape only), each with a consistent hasher. Conflating these is a classic source of silent bugs.
  • Tolerances are per-entity, with tol(vertex) >= tol(edge) >= tol(face), and they grow through operations. This is the kernel’s answer to inexact arithmetic.
  • An edge carries a list of representations, not one curve: a 3D curve, one pcurve per adjacent face, two pcurves for a seam edge on a closed surface, plus polygon and triangulation representations, with a same_parameter flag and a repair routine.

Re-exports§

pub use entity::CurveId;
pub use entity::EdgeData;
pub use entity::EdgeRepr;
pub use entity::FaceData;
pub use entity::GeometryStore;
pub use entity::NodeData;
pub use entity::PCurveId;
pub use entity::SurfaceId;
pub use entity::TriangulationId;
pub use entity::VertexData;
pub use entity::check_containment;
pub use entity::enforce_containment;
pub use location::Datum;
pub use location::DatumId;
pub use location::DatumStore;
pub use location::Location;
pub use model::Absorbed;
pub use model::Filter;
pub use model::Model;
pub use model::ModelParts;
pub use model::Unshared;
pub use model::WidenMark;
pub use model::ancestors_of;
pub use model::explore;
pub use model::explore_unique;
pub use shape::Orientation;
pub use shape::PartnerKey;
pub use shape::SameKey;
pub use shape::Shape;
pub use shape::ShapeType;
pub use shape::TShape;
pub use shape::TShapeId;
pub use tessellation::Triangulation;

Modules§

entity
What hangs off a topology node: geometry, tolerances, edge representations.
location
Placement as a chain of transforms.
model
The model: the arenas a shape’s handles refer into, and the builder that is the only way to mutate them.
shape
The shape triple, orientation, and the identity trichotomy.
tessellation
Cached tessellation: the polyline and triangle forms of exact geometry.

Functions§

face_content
Everything a face is made of, written out as bytes: its orientation, placement, tolerance and surface, then each wire in order with each of its edges’ orientation, placement, tolerance, flags, every representation (a curve, a pcurve, a seam’s two pcurves, with their placements and ranges, and whether a pcurve lies on the face’s own surface or another face’s) and vertices. An edge met again in the face is named by where it was first met, so a seam walked twice reads as one edge. Geometry is written out, never named by its handle, so the same face built again in another model reads the same.