A helical wire of round cross-section: the points within wire_radius of a helix.
centreline
c(t)=p0+R(costu+sintv)+2πpta,0≤t≤2πN
level set
ϕ(x)=0≤t≤2πNmin∣x−c(t)∣−rw
descent
t←t−f′′(t) or 2ρR+2b2f′(t),f(t)=ρ2+R2−2ρRcos(t−φ)+(s−bt)2,b=2πp
bound
∣x−c(t)∣≥(ρ−R)2+max(−s,s−pN,0)2
Assumes
a the unit axis, u the direction of the start point from the axis, v=±a×u (right- or left-handed); (s,ρ,φ) the point's cylindrical coordinates in that frame
the wire's ends are hemispheres (the points within rw of the end points of the centreline)
within 2rw of the cylinder the centreline lies on: the minimum over t from four starts, the two ends and the linearised minima of the two turns around s/b, by six Newton steps (descent steps on the majorant f′′≤2ρR+2b2 where f′′ is not clearly positive), clipped to [0,2πN]; exact there (tested against dense sampling)
farther away ϕ is the bound (the distance from the cylinder, minus rw): a level set that never exceeds the distance