Skip to main content

sweep_profile_helix

Function sweep_profile_helix 

Source
pub fn sweep_profile_helix(
    profile: &[NurbsCurve],
    axis_origin: Vec3,
    axis_direction: Vec3,
    helix_radius: f64,
    pitch: f64,
    turns: f64,
    name: Option<&str>,
) -> Result<BrepSolid, KernelRefusal>
Expand description

The helix is transcendental, not exactly NURBS-representable, so the path is FIT: points (R·cosθ, R·sinθ, pitch·θ/2π) in the axis frame are sampled uniformly in θ and globally interpolated with a cubic (interpolate_curve — the same machinery every other fitted path here uses). DENSITY: 64 intervals per turn, up to 4097 nodes at the supported 64-turn limit. Cubic interpolation error on a circle of radius R with node spacing Δθ is approximately R·Δθ⁴/384. Uniform-in-θ parameters are exact chord-length for a constant-radius helix.

The fitted path drives the path-sweep core at 64 intervals per turn, retaining that density through 64 turns. BREP_HELIX_FULL_DENSITY=0 restores the old 1024-station cap, which reduced the density on long coils.

GUARDS beyond the path sweep’s own: the path sweep documents self-intersection as caller responsibility, so the helix variant — which knows its curvature analytically — rejects the two garbage modes itself: • fold-over: the helix curvature radius (R² + c²)/R (c = pitch/2π) must exceed the profile’s max extent about its centroid, or the tube folds through itself on the inner side (the torus tube-radius > major-radius failure, pitch-relaxed); • coil collision (turns ≥ 1): the normal gap between consecutive coils, pitch·2πR/√((2πR)² + pitch²), must exceed the profile diameter. Both use the profile’s max sample distance from its centroid — conservative for asymmetric profiles (extent in a harmless direction still counts), but a false reject beats silent garbage.

SHALLOW COILS BUILD. They did not until 2026-09-08: the loft measured its advance by the END-TO-END chord, which on a whole-turn helix is purely AXIAL while both caps face nearly tangentially, so |n·chord| fell under the loft’s 0.1 sliver band and everything with pitch ≲ 0.63·R — most springs — was refused. The loft measures the advance at each END now (loft_topology::basic::advance_from), which is the direction the tube actually grows through the cap it is orienting, so the band only ever catches a real sliver.