Initial commit
This commit is contained in:
15
sim_solar_system.py
Normal file
15
sim_solar_system.py
Normal file
@@ -0,0 +1,15 @@
|
||||
# A simulation of a solar system, with a sun and three planets.
|
||||
# Gravity is the only force acting on the system.
|
||||
|
||||
from simulation import Simulation
|
||||
from simulation.ball import Ball
|
||||
from geometry.point import Point
|
||||
from geometry.vector import Vector
|
||||
|
||||
sun = Ball(Point(), mass=100000, radius=20, color="yellow")
|
||||
a = Ball(Point((100, 0)), velocity=Vector((0, 14)), mass=1, radius=10, color="blue")
|
||||
b = Ball(Point((-80, 0)), velocity=Vector((0, -14)), mass=1, radius=10, color="red")
|
||||
c = Ball(Point((0, 200)), velocity=Vector((-5, 0)), mass=2, radius=10, color="green")
|
||||
|
||||
sim = Simulation([sun, a, b, c], g=0.2)
|
||||
sim.run(1000)
|
||||
Reference in New Issue
Block a user