DrawScript

home.gif


Kepler's Law


"The planets move in ellipses with the Sun at one focus; the radius vector sweeping out equal areas in equal times"
http://mathpages.com/rr/s8-01/8-01.htm

kep.gif

DATA 5,2,6,6,15,&eeeeee00
READ a,b,xc,yc,n,grey
·BoundBox(0,3,12,6)
·SpritesLoad("planets")
·GetSpriteSize("earth",wg,hg)  : ·GetSpriteSize("sun",ws,hs)

FOR i=0 TO n
 t=2*PI*i/n : x=xc+a*COS(t) : y=yc+b*SIN(t)
 ·Fill(-1) : ·Dash(1) : ·Ellipse(xc,yc,a,b) : ·Dash(0)
 IF i<>0 THEN 
  ·Fill(grey)
  ·Triangle(xo,yo,xc-a/2,yc,x,y)
  ·SpritePlot("sun",xc-a/2-ws/2,yc-hs/2)
  ·SpritePlot("earth",x-wg/2,y-hg/2) : ·SaveDrawing("kep"+STR$(i))
  ENDIF
 xo=x : yo=y
NEXT