moving_frame#
- Spline.moving_frame(t, method='frenet', initial_vector=None)#
Compute a moving frame (local orthonormal coordinate system) along the spline.
This method computes either the Frenet-Serret frame or the Bishop frame [2] for the spline. A moving frame [1] consists of three orthonormal basis vectors at each point on the curve. The Frenet-Serret frame is derived from the curve’s derivatives but may twist around the curve. The Bishop frame eliminates this twist, providing a zero-torsion alternative.
Parameters#
- tnp.array
A 1D array of parameter values at which to evaluate the frame. These correspond to positions along the spline.
- methodstr, optional
The type of moving frame to compute. Options are:
“frenet”: The classical Frenet-Serret frame, based on tangent, normal, and binormal vectors.
“bishop”: A twist-free frame that requires an initial orientation.
Default is “frenet”.
- initial_vectornp.array or None, optional
For the Bishop frame, an initial vector that is orthogonal to the tangent vector at t[0]. This vector determines the initial orientation of the basis, which is propagated along the curve without twisting. If None, the method computes a suitable initial vector automatically. This parameter is ignored when
method="frenet".
Returns#
- framenp.array
A 3D numpy array with shape (len(t), 3, 3). The dimensions are:
The first axis corresponds to the parameter values in t.
The second axis contains the three basis vectors at each t: [tangent, normal, binormal] for “frenet” or equivalent vectors for “bishop”.
The third axis contains the components of each basis vector in 3D space.
Raises#
- RuntimeError
If the spline is not defined in 3D or if the Frenet frame cannot be computed due to inflection points, straight segments, or undefined tangent/normal vectors.
- ValueError
If the initial vector for the Bishop frame is not orthogonal to the tangent at t[0], or if an invalid method is specified.
Notes#
The Frenet frame is not defined at points where the curve has zero curvature, such as straight segments or inflection points. In these cases, the Bishop frame is recommended.
For closed curves, check for discontinuities of the Bishop frame.
References#