Plant bending: solver detail

For a joint angle error,

C(x)=wrap⁡(ϕ−ϕ0),α=ℓ/B,α~=α/Δt2,C(\mathbf{x})=\operatorname{wrap}(\phi-\phi_0),\qquad \alpha=\ell/B,\qquad \widetilde{\alpha}=\alpha/\Delta t^2,

the implemented update is

Δλ=−C−α~λ∑iwi∥∇iC∥2+α~,Δxi=wi∇iC Δλ.\Delta\lambda=\frac{-C-\widetilde{\alpha}\lambda} {\sum_i w_i\|\nabla_i C\|^2+\widetilde{\alpha}}, \qquad \Delta\mathbf{x}_i=w_i\nabla_i C\,\Delta\lambda.

Here, wrap chooses the signed angle difference in the range from −π to π; wiw_i is inverse mass; ∇iC\nabla_i C is the gradient of the angle error with respect to one of the three neighboring points; and λ\lambda accumulates corrections during the step. A fixed point has zero inverse mass. Accumulated multipliers reset at each new simulation step.

error = wrapped_angle(current_turn - resting_turn)
scaled_compliance = compliance / dt**2
for each of the joint's three points:
    gradient[i] = analytic_angle_gradient(i)
denominator = scaled_compliance
for each point:
    denominator += inverse_mass[i] * dot(gradient[i], gradient[i])
delta_lambda = (-error - scaled_compliance * lambda) / denominator
lambda += delta_lambda
for each point:
    position[i] += inverse_mass[i] * gradient[i] * delta_lambda

This is a notation-level transcription of bends, not a newly proposed algorithm. The source guards degenerate segments before computing gradients. In the current model, attachment separately solves a root-direction error with compliance segmentLength/(4*bendingRigidity*widthScale*baseThickness³).

The angle solver and finite alternating passes approximate compliant mechanics. Claims about exact physical material calibration, exact inextensibility or full fluid–structure coupling would exceed this implementation.