1 # contributed by Gert-Ludwig Ingold
5 n
= 3 # number of masses
6 r
= 3.0 # system radius
7 rcyc
= 0.3 # radius of cycloid
8 nl
= 13 # number of loops
9 rc
= 0.5 # radius of masses
10 eps
= 0.03 # extra spacing for surrounding circles
13 springcircle
= path
.circle(0, 0, r
)
14 masspositions
= [i
*springcircle
.arclen()/n
16 for springsegment
in springcircle
.split(masspositions
):
17 c
.stroke(springsegment
,
18 [deformer
.cycloid(rcyc
, nl
),
19 deformer
.smoothed(radius
=0.1)])
20 for x
, y
in springcircle
.at(masspositions
):
21 c
.fill(path
.circle(x
, y
, rc
))
23 c
.stroke(springcircle
, [deformer
.parallel(rc
+eps
)])
24 c
.stroke(springcircle
, [deformer
.parallel(-rc
-eps
)])
26 c
.writeEPSfile("springs")
27 c
.writePDFfile("springs")