dynamic_simulation#
Dynamic simulation scaffolding for knot/graph layouts.
This module builds a bead–spring Network from a PlanarDiagram using the circle-packing layout as an initial embedding. The network is then suitable for dynamic relaxation (e.g., via animate_simulation).
The construction samples each arc by a short polyline, links consecutive samples with bonds, adds chain stiffness triplets, and sets angular constraints at vertices based on their degree.
Functions
|
Initialize a dynamic bead–spring network from a planar diagram. |
- init_network(k)#
Initialize a dynamic bead–spring network from a planar diagram.
Each arc (ep1—ep2) is represented by a short polyline sampled from a PolySegment through [center(ep1.node), center(arc), center(ep2.node)]. Consecutive samples are connected by bonds; consecutive triples form stiffness constraints. For each vertex, adjacent incident samples define an angular constraint with the ideal angle 2π / degree(vertex).
- Parameters:
k (PlanarDiagram) – Input planar diagram.
- Returns:
Network – A constructed bead–spring network ready for simulation.
- Return type: