Thursday, January 10, 2013

Trigonometric Functions


graphsize 500,350
hip ={0,0,60,0,60,3,0,3,0,0}
fastgraphics
for n = 0 to pi*2 step .01
color black
circle 70,70,62
color white
circle 70,70,58
color black
stamp 70,70,1,-n,hip
rect 140,70,400,3
rect 140,250,400,3
color red
if cos(n)>0 then rect 70,70,60*cos(n),3
if cos(n)<0 then rect 70-60*cos(n+pi),70,60*cos(n+pi),3
color blue
if sin(n)>0 then stamp 70+cos(n)*60,70,sin(n),-pi/2,hip
if sin(n)<0 then stamp 70+cos(n)*60,70,sin(pi+n),pi/2,hip
color blue
circle n*50+140,50*sin(n+pi)+70,2
color red
circle n*50+140,50*cos(n+pi)+250,2
refresh
next n

No comments:

Post a Comment