Hylograph.Forces.Snapshot
- Package
- purescript-hylograph-forces
- Repository
- afcondon/purescript-hylograph-forces
Snapshot and restore: everything that changes as a simulation runs, as one immutable value.
The forces keep no state between ticks (each rebuilds what it needs from the nodes), so what changes is alpha, the random source, and each node's position, velocity and pins. Restoring a snapshot and running N ticks gives exactly what N more ticks would have given when it was taken, as long as the forces and settings are the same; they are configuration, not state, and are not in the snapshot.
The Rust kernel has the same pair (snapshot and restore in
force-kernel/src/lib.rs), and test/differential.mjs checks both
against each other across a restore.
#restore Source
restore :: forall row. Snapshot -> Source -> Array (Node (Pinnable row)) -> Effect NumberPut the nodes and the random source back as the snapshot recorded them, and return the alpha to give the next tick. The nodes are matched by place; if there are more or fewer than were recorded, the extra ones on either side are left alone.
- Modules
- Hylograph.
Forces - Hylograph.
Forces. Center - Hylograph.
Forces. Cohesion - Hylograph.
Forces. Collide - Hylograph.
Forces. Contain - Hylograph.
Forces. Directional - Hylograph.
Forces. Group - Hylograph.
Forces. Link - Hylograph.
Forces. Linkage - Hylograph.
Forces. ManyBody - Hylograph.
Forces. Measure - Hylograph.
Forces. Node - Hylograph.
Forces. Position - Hylograph.
Forces. Quadtree - Hylograph.
Forces. Radial - Hylograph.
Forces. Random - Hylograph.
Forces. RectCollide - Hylograph.
Forces. Snapshot - Hylograph.
Forces. Tick - Hylograph.
Forces. Towards