Expand description
Frame and position of a space curve given by curvature and torsion.
§The problem, and why it is not the 2D problem
Frenet-Serret is a matrix ODE on the rotation group:
R'(s) = R(s) Omega(s), Omega = [[0, -k, 0], [k, 0, -tau], [0, tau, 0]]where R’s columns are the tangent, normal and binormal. In 2D the
analogous system is scalar, and its solution is exp of the integral of
the generator. That does NOT generalise: exp(int Omega) solves this only
when generators at different arc lengths commute, i.e. when tau/k is
constant. Using it otherwise is a real error, not a tolerance-level one.
§What is computed
The Magnus expansion, truncated after the second term, on each panel:
Omega_1 = Omega(s0 + c1 h), Omega_2 = Omega(s0 + c2 h) (2-pt Gauss)
M = (h/2)(Omega_1 + Omega_2) - (sqrt(3) h^2/12)[Omega_2, Omega_1]
R(s0 + h) = R(s0) exp(M)The commutator term is exactly what a naive exp(int Omega) drops, and it
is what makes this fourth order rather than second.
§Two properties this buys, which a generic ODE solver does not give
- The frame is orthonormal to machine precision at ANY step size,
structurally:
expof a skew-symmetric matrix is a rotation, and a product of rotations is a rotation. A Runge-Kutta step leaves the group and the frame drifts out of orthonormality. Measured at 100 panels:|R^T R - I|is 2.6e-15 here versus 8.4e-10 for RK4. - Torsion identically zero reproduces the planar answer exactly, because
the generator then has no
taucomponent and the rotation stays in the start frame’s plane.
Position integrates the tangent T(u) = R(u) e_x by Gauss-Legendre on the
same panels. Integrating it with a constant-generator closed form instead
silently caps the whole scheme at second order – measured during
development, and the reason the tangent is quadratured at Gauss nodes
rather than folded into the rotation step.
Functions§
- frenet_
frame - Frame of a space curve at arc length
sfrom its start. - frenet_
point - Position on a space curve at arc length
sfrom its start. - frenet_
tangent - Unit tangent of a space curve at arc length
sfrom its start.