Expand description
§FerroCAD geometry seam (ferrocad_geom)
The kernel-independent vocabulary for geometry, so the document, persistence, expression and recompute layers can be written and tested now, without a geometry kernel, and gain one later without touching them.
It provides four things:
Shape— an opaque, cheap-to-clone handle to a kernel shape. The kernel owns the data; Rust owns the handle.History,ElementRefandElementMap— what an operation did, in the kernel’s own terms, and the stable-name registry derived from it. These are re-exports of the payload-generic vocabulary inferrocad_lineage, specialised toShape.Lineage,ReverseMap,MapVersionandNamePolicy— the naming layer: provenance accumulated over successive histories, its inverse view, and the versioned rules that turn elements into names.Lineageis specialised toShape; the others carry no payload and are re-exported as themselves.ElementId,OperandIdandProvenance— the identity an operation reports for its inputs (operand, kind and 1-based ordinal), independent of the positional name it also reports.Tessellation,ElementKindandSelectionRef— the display mesh with per-primitive sub-element ids, and the neutral vocabulary a viewport or a workbench needs to turn a pick into a topology reference.tangent_chain— the smooth edge chain a fillet or chamfer applies to.GeometryBackend— the trait a kernel implements (OCCT, orNullBackend).
This crate depends on ferrocad_types for values such as Placement, on
ferrocad_curves for edge curves, and on ferrocad_lineage for the
provenance vocabulary, and on nothing else. It is the boundary OCCT must sit
behind: no crate below the
application depends on the kernel, and ferrocad_core stays a leaf (see
docs/architecture/occt-integration.md).
§Example
use ferrocad_geom::{GeometryBackend, NullBackend};
let backend = NullBackend;
let a = backend.make_box(10.0, 10.0, 10.0).unwrap();
let b = backend.make_box(10.0, 10.0, 10.0).unwrap();
let result = backend.fuse(&a, &b).unwrap();
assert!(result.history.is_empty()); // the null backend invents no lineageStructs§
- Capabilities
- The operations a backend supports.
- Element
Id - A kernel-independent identity for one sub-element of an operand.
- MapVersion
- The naming scheme a
Lineagewas folded under. - Mass
Properties - A geometry kernel.
- Null
Backend - A geometry kernel that produces placeholder shapes and empty
History. - Null
Shape - A placeholder shape produced by
NullBackend: enough to type-check and to assert on in tests, with no kernel behind it. - OpResult
- The output of a shape operation: the resulting shape and what changed.
- Operand
Id - Which input of an operation an element came from.
- Principal
Properties - The principal axes of a shape (
Shape.PrincipalProperties). - Provenance
- The identity behind one relation in a
History. - Reverse
Map - The element map read backwards: for each output name, the input names that produced it.
- Selection
Ref - One object plus the sub-elements selected on it.
- Shape
- An opaque handle to a kernel shape.
- Tessellation
- A display mesh with per-primitive sub-element ids.
- Tessellation
Options - How finely a kernel should tessellate a shape.
- Unsupported
Operation - An operation this backend does not implement.
Enums§
- Continuity
- How smoothly two elements meet, as far as tangent propagation is concerned.
- Element
Kind - The kind of a topological element, in FreeCAD’s terms.
- Relation
- The relation an input element took part in.
Traits§
- Geometry
Backend - Name
Policy - How sub-elements are turned into stable names.
Functions§
- tangent_
chain - The edges tangent-continuous with
seed, in the order the walk reaches them. - unsupported
- The error a backend returns for an operation it does not implement.
Type Aliases§
- Element
Map - The stable-name registry carried with a shape:
name -> current sub-shape. - Element
Ref - A reference to one sub-element of a shape (a face, an edge, …), by a stable name rather than a positional index.
- Geom
Error - A boxed kernel error.
- History
- What one operation did to its inputs, in the kernel’s own terms.
- Lineage
- A shape’s accumulated provenance: the forward
ElementMap, its reverse view, and the version of the naming rules that produced them.