## Parameters for the model solar system ## Used by the main program theplanets.py ## ## Each planet needs to be defined AND AT THE END ## all planets must be put into the list 'planets' ## - All objects that exert gravity need a mass. ## - All objects subject to gravity need a curve attribute named ## 'track' for tracing the orbit, a velocity velocity named 'vel', ## and list of objects that exert gravity on them ('others') from visual import * ####################### sun ### (fixed in space by assumption) sun = sphere(pos=(0.,0.,0.), radius=0.2, color=color.yellow) sun.mass = 1 ####################### bigmars ### (this object will affect Earth, ####################### but is not affected by the Earth.) ##### note that the z-position is not zero - its orbit will be tilted ##### relative to the unperturbed orbit of the Earth. Set ##### starting position, velocity, mass, and color of track. bigmars = sphere(radius=0.1, color=color.magenta, pos=(3,0,0.2)) bigmars.vel = vector(0,0.5,0) bigmars.mass = 0.0 bigmars.others=[sun] ### sun affects the bigmars bigmars.track=curve(color=color.red) earth = sphere(radius = 0.1, color=color.blue, pos = (2,0,0)) earth.vel = vector(0,0.6,0) earth.others=[sun,bigmars] ### bigmars and sun affect the earth earth.track=curve(color=color.cyan) ## list of the planets - things with tracks and dynamics - sun is fixed planets = [bigmars, earth]