Skip to main content

sweep_profile_twisted

Function sweep_profile_twisted 

Source
pub fn sweep_profile_twisted(
    profile: &[NurbsCurve],
    path: &NurbsCurve,
    twist_angle: f64,
    name: Option<&str>,
) -> Result<BrepSolid, String>
Expand description

Twisted path sweep (§5.7): identical to sweep_profile_along_path, but the profile additionally ROTATES about the path tangent, linearly in ARC LENGTH, from 0 at the sweep start to twist_angle radians (right-handed about the tangent) at the end. The arc-length fraction comes from the sampled station polyline, not the raw path parameter, so a non-uniformly parameterized path still twists uniformly in space.

STATION LAW: 16 stations per quarter turn of twist, floored at the path sweep’s 32 and capped at 1024 (the loft’s dense interpolation solve is O(stations³) per control column — the same cap the helix uses). At 16/quarter-turn the inter-station twist step is Δφ ≈ 5.6°, so the cubic v-interpolation error on a profile point circling at radius r is ≈ r·Δφ⁴/384 ≈ 2.4·10⁻¹⁰·r — far below any geometric tolerance. The cap holds that density up to 16 full turns (|twist| = 32π = 1024/16 quarter turns); a larger twist would silently alias under the cap, so it is REJECTED with an honest error instead. Everything else the path sweep documents (profile validity, self-intersection being the caller’s responsibility) applies unchanged; twisting about the profile’s own centroid adds no new radial extent, so no extra collision guard exists to compute here.