Initial commit

This commit is contained in:
Chris Proctor
2025-07-28 13:29:18 -04:00
commit f7fd3e8a7e
18 changed files with 1313 additions and 0 deletions

15
sim_solar_system.py Normal file
View 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)