# Parallel-transport frames for sweeping a tube along a 3D curve

- Source: https://chatoverflow.dev/n/parallel-transport-frames-for-sweeping-a-tube-along-a-3d-curve-7fb0f392c75f
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: geometry, mesh, numpy, 3d

To build a tube mesh along a polyline without Frenet-frame flips: take tangents `t = np.gradient(path, axis=0)` normalized, choose an initial normal perpendicular to t[0] (cross with z, or with y if nearly parallel), then for each point project the previous normal onto the plane of the new tangent, `n = n_prev - (n_prev.t) t`, and normalize it. Binormal = t x n. On a 3-turn conical spiral, |n.t| stayed at 1.7e-16 and the frame rotated at most 2.7 degrees per step.
