Run one sweep of compliant distance constraints over a lattice, in place:
every edge of the lattice, its row and column neighbours, its diagonals
and its second neighbours, projected one after another with its Lagrange
multiplier, the extended position-based dynamics of Macklin, Müller and
Chentanez 2016 ("XPBD: position-based simulation of compliant constrained
dynamics", MIG 2016, pp. 49-54, equations 18 and 17).
For an edge between particles i and k with rest length l, the constraint
is C = |x_i - x_k| - l, its gradient the unit direction n from k to i, and
the time-scaled compliance alpha~ = alpha / dt^2 with alpha the family's
compliance in metres per newton. The multiplier's increment is
dlambda = (-C - alpha~ lambda) / (w_i + w_k + alpha~), and the particles
move by w_i dlambda n and -w_k dlambda n, w the inverse masses. Unlike the
relaxation weight of the plain position-based solver, compliance represents
a physical constitutive parameter with explicit step scaling (the paper's
section 4). Finite Gauss-Seidel iteration leaves residual error: four and
sixteen sweeps need not produce identical stretch or bend. Zero compliance
requests an inextensible edge but does not certify convergence. On a cord, a one-wide
lattice, the second neighbours are its bending constraint in distance form:
the distance between the ends of two consecutive segments, which is
regular at a straight rest where the angle between the segments is not
differentiable.
Edges are visited in a fixed order (row-major particles, each with the
neighbours that follow it in SOFT_BODY_NEIGHBOURS), so a solve is
deterministic. lambda holds one multiplier per particle and neighbour
slot and is reset by the caller at the start of each step.
Run one sweep of compliant distance constraints over a lattice, in place: every edge of the lattice, its row and column neighbours, its diagonals and its second neighbours, projected one after another with its Lagrange multiplier, the extended position-based dynamics of Macklin, Müller and Chentanez 2016 ("XPBD: position-based simulation of compliant constrained dynamics", MIG 2016, pp. 49-54, equations 18 and 17).
For an edge between particles i and k with rest length l, the constraint is C = |x_i - x_k| - l, its gradient the unit direction n from k to i, and the time-scaled compliance alpha~ = alpha / dt^2 with alpha the family's compliance in metres per newton. The multiplier's increment is dlambda = (-C - alpha~ lambda) / (w_i + w_k + alpha~), and the particles move by w_i dlambda n and -w_k dlambda n, w the inverse masses. Unlike the relaxation weight of the plain position-based solver, compliance represents a physical constitutive parameter with explicit step scaling (the paper's section 4). Finite Gauss-Seidel iteration leaves residual error: four and sixteen sweeps need not produce identical stretch or bend. Zero compliance requests an inextensible edge but does not certify convergence. On a cord, a one-wide lattice, the second neighbours are its bending constraint in distance form: the distance between the ends of two consecutive segments, which is regular at a straight rest where the angle between the segments is not differentiable.
Edges are visited in a fixed order (row-major particles, each with the neighbours that follow it in
SOFT_BODY_NEIGHBOURS), so a solve is deterministic.lambdaholds one multiplier per particle and neighbour slot and is reset by the caller at the start of each step.