#1=3.1 ( R in this formula {R+r}*cos{t} - {r+O}*cos{{{R+r}/r}*t} )
#2=2 ( r in above)
#3=.6 ( O in above)
#4=0 (starting t Deg)
#5=.2 (deg of resolution)
(check which of the R/r is bigger)
o100 if [abs[#1] GT abs[#2]]
#6=#1 (6 and 7 are temp locations for the R and r )
#7=#2
#8=1
o100 else
#6=#2
#7=#1
#8=2
o100 endif
(now we make them whole numbers if they are not.)
(this is the start of figuring the number of degrees)
(it has to go to do a complete cycle.)
#9=#6
#10=#7
#11=2
o150 while [[fix[#6] NE #6] or [fix[#7] NE #7]]
#6=[#9*#11]
#7=[#10*#11]
#11=[#11+1]
o150 endwhile
(now lets figure out if we can simplify the R/r fraction)
(this is using Euclidean algerithum to get the gcd)
#12=#6
#13=#7
o200 do
#14=[#12 mod #13]
#12=#13
#13=#14
o200 while [#13 NE 0]
(#12 is now the gcd)
(the Number of times around in degrees)
(using the correct denominator.)
o225 if[#8 eq 1]
#14=[[#7/#12]*360]
o225 else
#14=[[#6/#12]*360]
o225 endif
(here is the actual cutting - I don't have any z in it yet)
o250 do
#15=[[#1+#2]*COS[#4] - [#2+#3]*COS[[[#1+#2]/#2]*#4]]
#16=[[#1+#2]*sin[#4] - [#2+#3]*sin[[[#1+#2]/#2]*#4]]
g1 x[#15]y[#16]f200
#4=[#4+#5]
o250 while [#4 LE #14]
m30