Skip to content

Commit

Permalink
Fixed example for new lib
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-mcdaniel committed Sep 18, 2024
1 parent 57e5f59 commit 4382106
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
8 changes: 5 additions & 3 deletions examples/frontend/test_std_physics.sg
Original file line number Diff line number Diff line change
Expand Up @@ -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: ");
Expand All @@ -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}
}
Expand Down
16 changes: 8 additions & 8 deletions examples/test-output/test_std_physics.txt
Original file line number Diff line number Diff line change
@@ -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}

0 comments on commit 4382106

Please sign in to comment.