3 n
= 3 # number of masses
4 r
= 3.0 # system radius
5 rcyc
= 0.3 # radius of cycloid
6 nl
= 13 # number of cycloid half-loops
7 rc
= 0.5 # radius of masses
8 eps
= 0.03 # extra spacing for surrounding circles
11 springcircle
= path
.circle(0, 0, r
)
12 masspositions
= [i
*springcircle
.arclen()/n
14 for springsegment
in springcircle
.split(masspositions
):
15 c
.stroke(springsegment
,
16 [deformer
.cycloid(rcyc
, nl
),
17 deformer
.smoothed(radius
=0.1)])
18 for x
, y
in springcircle
.at(masspositions
):
19 c
.fill(path
.circle(x
, y
, rc
))
20 c
.stroke(path
.circle(0, 0, r
- rc
- eps
))
21 c
.stroke(path
.circle(0, 0, r
+ rc
+ eps
))
22 c
.writeEPSfile("springs")