1 Sandbox patch pour avoir les valeurs du système solaire
Arthur POULET edited this page 2023-08-28 09:36:38 +02:00
diff --git a/src/tests/physics_sandbox.cr b/src/tests/physics_sandbox.cr
index b80bab9..30204e8 100644
--- a/src/tests/physics_sandbox.cr
+++ b/src/tests/physics_sandbox.cr
@@ -60,7 +60,7 @@ class Game
   @window : SF::RenderWindow
   @delta_clock : SF::Clock
 
-  ZOOM = 1/4
+  ZOOM = 1/1_000_000_000
   SECOND_IN_NANO = 1_000_000_000
 
   def accuracy_frequency_nano_rate
@@ -82,11 +82,21 @@ class Game
 
     sun_offset = Vector[3*10.0**11, 3*10.0**11]
     @bodies = {
-      vessel: Gravity::MovingBody(2).new(mass: 1.0, g: 0.1, position: Vector[10.0, 10.0]),
-      star:   Gravity::MovingBody(2).new(mass: 300000.0, g: 0.1, position: Vector[1000.0, 1000.0], speed: Vector[0.0, 0.0]),
-      pla1:   Gravity::MovingBody(2).new(mass: 15000.0, g: 0.1, position: Vector[500.0, 500.0], speed: Vector[12.0, 0.0]),
-      pla2:   Gravity::MovingBody(2).new(mass: 18000.0, g: 0.1, position: Vector[1000.0, 1500.0], speed: Vector[-6.0, -6.0]),
-      pla3:   Gravity::MovingBody(2).new(mass: 12000.0, g: 0.1, position: Vector[1500.0, 1500.0], speed: Vector[-6.0, 0.0]),
+      vessel: Gravity::MovingBody(2).new(
+        mass: 1.0, position: Vector[10.0**9, 10.0**9],
+      ),
+      star:   Gravity::MovingBody(2).new(
+        mass: 1.989*(10.0**30),
+        position: sun_offset,
+        speed: Vector[0.0, 0.0],
+      ),
+      pla1:   Gravity::MovingBody(2).new(
+        mass: 1.0,
+        position: Vector[106_066_017_177.0, 106066017177.0] + sun_offset,
+        speed: Vector[21000.0, -21000.0],
+      ),
+      pla2:   Gravity::MovingBody(2).new(mass: 1.0, position: Vector[1000.0, 1500.0], speed: Vector[-6.0, -6.0]),
+      pla3:   Gravity::MovingBody(2).new(mass: 1.0, position: Vector[1500.0, 1500.0], speed: Vector[-6.0, 0.0]),
     }
     @gravited = [
       @bodies[:pla1], @bodies[:pla2], @bodies[:pla3], @bodies[:star],