Skip to main content

Module history

Module history 

Source
Expand description

What an operation did to its inputs.

docs/DATA_MODEL.md §7. Every operation in this crate and above it reports three things about each shape it was given:

  • generated: new entities made from it that did not exist before. A prism’s side faces are generated from the profile’s edges.
  • modified: what it became. A face split in two is modified into both halves.
  • deleted: it has no image in the result at all.

A modification may also be marked an exact copy: the image is a new node standing for the same thing, on the same surface or curve within the same boundary, its vertices where they were to within their tolerances. A boolean’s faces the tool never touched come through so, and a caller holding names or meshes for the input can carry them across unchanged.

A parametric application records “fillet that edge” and must still find that edge after the model is rebuilt with different dimensions. It does so by walking history. Half-populated history does not error. It reopens the document with the wrong faces filleted, which is why every operation populates it.

§Composition is the hard part

Operations chain. If A modifies x into y and B then modifies y into z, the composed history must say A-then-B modified x into z. Getting that wrong is how a reference survives one rebuild and dies on the next, which is far harder to diagnose than dying immediately. See History::then.

Structs§

Built
A shape together with the history of the operation that produced it.
History
A record of what one operation, or a chain of them, did.

Functions§

on_own_nodes
run on root and the shapes parts below it, once every node below root is the root’s alone: what other shapes hold as well is copied first, root itself included where it is held whole (Model::unshare_each), and each part is carried to its copy. The history runs from the shapes as given.
on_own_nodes_with
As on_own_nodes, for an operation whose answer holds its history beside other things: history finds it in the answer.
unshare
Make every node below root the root’s alone, as Model::unshare does, and say so: each face, edge and vertex copied, as it stands below root, is recorded as an exact copy of the one it stands in for.