BeginPackage["Wikicode`Spring`Device`"]
Spring2D::usage = "Spring2D[start,end,loops,radius] draws a spring \
from the start point to the end point with the given number of loops \
and radius."
Begin["`Private`"]
Spring2D[start_, end_, loops_, radius_] :=
Module[{detail = 40, steps}, steps = detail (loops + .5);
Translate[
Rotate[Line@
Table[{radius + (Norm[end - start] - 2 radius) a/steps +
radius Cos[2 Pi a/detail + Pi],
radius Sin[2 Pi a/detail]}, {a, 0, steps}], {{1, 0},
end - start}], start]]
End[]
EndPackage[]
References edit
"How to draw a spring?". Mathematica Stack Exchange. Retrieved 6 February 2014.