From 4382106a8e24856e664876dba55a079a6f4db2c3 Mon Sep 17 00:00:00 2001 From: Adam McDaniel Date: Tue, 17 Sep 2024 23:52:56 -0400 Subject: [PATCH] Fixed example for new lib --- examples/frontend/test_std_physics.sg | 8 +++++--- examples/test-output/test_std_physics.txt | 16 ++++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/examples/frontend/test_std_physics.sg b/examples/frontend/test_std_physics.sg index 1b358c64..c6974f95 100644 --- a/examples/frontend/test_std_physics.sg +++ b/examples/frontend/test_std_physics.sg @@ -9,8 +9,6 @@ fun main() { d.print(); println(); - let instant = Instant.from_date(d); - for let mut i=0; i<8; i+=1; { let planet = Planet.PLANETS[i]; print("Planet: "); @@ -27,11 +25,15 @@ fun main() { println( "Position (meters, Sun relative): ", - convert_to_int(planet.position_at_instant(instant)) + convert_to_int(planet.position_on_date(d).convert(au_to_m)) ); } } +fun au_to_m(au: Float): Float { + au * 149597870700.7 +} + fun convert_to_int(x: Point3D): {x: Int, y: Int, z: Int} { {x=x.x as Int, y=x.y as Int, z=x.z as Int} } diff --git a/examples/test-output/test_std_physics.txt b/examples/test-output/test_std_physics.txt index 3e3457c5..c83dfc4b 100644 --- a/examples/test-output/test_std_physics.txt +++ b/examples/test-output/test_std_physics.txt @@ -1,17 +1,17 @@ On 2024-9-18 Planet: Mercury -Position (meters, Sun relative): {x=33383204033, y=35761196060, z=17482615609} +Position (meters, Sun relative): {x=-31643647898, y=32191865528, z=20458410057} Planet: Venus -Position (meters, Sun relative): {x=11027909171, y=108447650387, z=818212376} +Position (meters, Sun relative): {x=-46501068354, y=-90290675415, z=-37680336395} Planet: Earth -Position (meters, Sun relative): {x=135085714027, y=-4079248623, z=57523897417} +Position (meters, Sun relative): {x=149854530247, y=-10637234519, z=-4611807541} Planet: Mars -Position (meters, Sun relative): {x=-183253301950, y=87942739441, z=-89682031118} +Position (meters, Sun relative): {x=123729030443, y=169141485920, z=74236731803} Planet: Jupiter -Position (meters, Sun relative): {x=365041661741, y=-617809226669, z=198651062155} +Position (meters, Sun relative): {x=280695820756, y=646680298840, z=270373647406} Planet: Saturn -Position (meters, Sun relative): {x=-779145757340, y=-1201641044586, z=-261550590693} +Position (meters, Sun relative): {x=1403304029894, y=-306422538267, z=-186954485413} Planet: Uranus -Position (meters, Sun relative): {x=1645995896811, y=-2256125631718, z=896288551314} +Position (meters, Sun relative): {x=1722593095389, y=2173366890976, z=927492758434} Planet: Neptune -Position (meters, Sun relative): {x=-1192938488445, y=-4305878018189, z=-196045534921} +Position (meters, Sun relative): {x=4366845262214, y=-837504145712, z=-451460391989}