Plant bending: solver detail
For a joint angle error,
the implemented update is
Here, wrap chooses the signed angle difference in the range from −π to π; is inverse mass; is the gradient of the angle error with respect to one of the three neighboring points; and 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.