← Kraftwerk2 overview · 2. Density, potential and target points →
1. Three forces and one equation¶
In the paper: §IV and §V-B to §V-D, equations (15)–(30).
1.1 The net force¶
Start from quadratic placement. The wire cost in x is
\(C_x\) is the paper's name for the spring table, built from Bound2Bound weights (Foundations §5.3), and \(\vec d_x\) holds the springs to fixed cells. The derivative of an energy is a force, so the springs pull on the cells with
Setting it to zero is quadratic placement: every cell where its wire pulls cancel, everyone in one clump (Foundations §3.8). Kraftwerk2 adds two more forces.
1.2 The hold force: stay where you are¶
An iteration starts with the cells at \(\vec x'\). If only the wires acted, the cells would snap back into the clump. So Kraftwerk2 adds a hold force that is exactly the opposite of the wire force at the starting positions:
It is a constant: it does not change as the cells move. With the wires and the hold force alone, the total force at the start is zero, and it stays zero only there: \(F^\text{net} + F^\text{hold} = C_x(\vec x - \vec x') = 0\) means \(\vec x = \vec x'\). The two together keep the placement where it is. Anything that moves the cells now has to come from the third force.
The paper stresses a consequence: nothing has to be remembered from earlier iterations. Older force-directed placers (Eisenmann's Kraftwerk, FDP) added up spreading forces over the iterations; Kraftwerk2 starts each iteration fresh.
1.3 The move force: a spring to a target point¶
Each cell \(i\) gets a target point \(\mathring x_i\) (chapter 2 computes it from the density) and a spring of stiffness \(\mathring w_i\) toward it:
The targets are \(\mathring{\vec x} = \vec x' - \vec\Phi_x\), the starting positions minus the slope of the potential at each cell. Collect the stiffnesses into the diagonal table \(\mathring C_x = \text{diag}(\mathring w_i)\):
Because the target is a fixed point, a cell can at most reach its target in one iteration, never overshoot it. That limits how far anything moves per iteration, which is what makes the method converge (chapter 3).
1.4 The core equation (30)¶
The cells settle where the three forces add up to zero. Write \(\Delta\vec x = \vec x - \vec x'\):
The \(\vec d_x\) terms cancel, and \(C_x\vec x - C_x\vec x' = C_x\Delta\vec x\):
This is the whole engine of Kraftwerk2: one sparse linear system per axis per iteration. The matrix is the wire springs plus a diagonal, so it is symmetric positive definite and conjugate gradient solves it (Foundations chapter 4). The fixed cells have dropped out of the right-hand side: only the potential's slope drives the motion.
1.5 One cell, by hand¶
Take one movable cell whose springs to fixed pins add up to a stiffness \(c = 3\), so \(C_x = [3]\). The potential's slope at the cell is \(\Phi_x = 8\) (the ground rises to the right), so its target is 8 to the left. Equation (30) gives
| move weight \(\mathring w\) | 0 | 1 | 3 | 9 | very large |
|---|---|---|---|---|---|
| \(\Delta x\) | 0 | −2 | −4 | −6 | −8 |
With no move force the cell stays put (the hold force at work). A stiff move spring takes it all the way to the target; a soft one only part of the way, because its wires hold it back. The fraction \(\beta = \mathring w / (c + \mathring w)\) is how the paper explains convergence in chapter 3, and \(\mathring w\) is the knob that quality control turns.
1.6 One iteration, step by step (paper Figure 6)¶
- Start from the current placement \(\vec x'\).
- Compute the hold force (implicitly: it is what makes the fixed cells drop out of (30)).
- Build the density \(D\) and solve Poisson's equation for \(\Phi\) (chapter 2).
- Place each target point at \(\vec x' - \nabla\Phi\).
- Rebuild the Bound2Bound springs at \(\vec x'\); solve (30) for x and for y.
- Move every cell by \(\Delta\): the result is less crowded and still wire-aware.
Important
Key takeaways
- Net force: the wires' pull, \(C\vec x + \vec d\). Hold force: its opposite at the start, a constant.
- Move force: a spring of stiffness \(\mathring w_i\) from each cell to a target point \(x'_i - \partial\Phi/\partial x\).
- Their sum is zero at \((C + \mathring C)\Delta\vec x = -\mathring C\,\vec\Phi_x\): one SPD system per axis per iteration.
- A cell moves a fraction \(\mathring w/(c + \mathring w)\) of the way to its target.
Exercises¶
1. In §1.5, which \(\mathring w\) moves the cell exactly halfway to its target?
Answer
\(\mathring w/(3 + \mathring w) = \tfrac12\) gives \(\mathring w = 3\): the move spring as stiff as the wires. \(\Delta x = -4\).
2. Why do the springs to fixed cells (\(\vec d_x\)) not appear in equation (30)?
Answer
They appear in the net force and, with the opposite sign, in the hold force, because the hold force is minus the net force at the start. They cancel. Fixed cells still matter through \(C_x\): each spring to a fixed cell adds to the diagonal, and so to how strongly the cell resists moving.
← Kraftwerk2 overview · 2. Density, potential and target points →