#*********************light.py*************************
#
# William Baker
#
#  usage:   python earth.py 
#
#*********************************************************

from visual import *
from math import *


def draw():
    
    sun = sphere(pos=(0,0,0), radius=1, color=color.red)
    earth = sphere(pos=(2.5,0,0), radius=.25, color=color.white)
    #moon = sphere(pos=(5.75,0), radius=.1, color=(.75,.75,.75))
    #moonval=0
    scene.autoscale=0
    scene.userzoom=1
    scene.ambient=0
    
    scene.lights=[vector(earth.pos-sun.pos)/mag(vector(earth.pos-sun.pos))]
            
    while 1:
        rate(50)
        #scene.lights=[vector(sun.pos-earth.pos)/mag(vector(sun.pos-earth.pos))]
        earth.rotate(angle=.005, axis=(0,0,1), origin=sun.pos)
        scene.lights=[vector(earth.pos-sun.pos)/mag(vector(earth.pos-sun.pos))]
        #moon.pos=(earth.pos[0]+.75,earth.pos[1],earth.pos[2])
        #moon.rotate(angle=(pi-moonval), axis=(0,0,1), origin=earth.pos)
        #moonval+=.06
       
        #if moonval>=2*pi:
        #    moonval=0
   

def main():
   
    draw()

main()

