PreviousUpNext

15.4.1343  src/lib/x-kit/tut/nbody/nbody-app.pkg

## nbody-app.pkg
# One way to run this app from the base-directory commandline is:
#
#     linux% my
#     eval: make "src/lib/x-kit/tut/nbody/nbody-app.lib";
#     eval: nbody_app::run ();

# Compiled by:
#     src/lib/x-kit/tut/nbody/nbody-app.lib

package nbody_app {
    #
    package v = gravity_simulator::v;

    fun make_data (x, y, vx, vy, m, r, cs)
        =
        ( (x, y),       # position
          (vx, vy),     # velocity
          m,            # mass
          r,            # radius
          cs            # "cs" was probably "color specification"
        );

    planet_data
        =
        map
            make_data
#                  position   velocity
#              (x,      y )   (vx, vy   )   mass      radius  cs
#              ------------   ------------  -------   ------  ------------
            [ (    0.0, 0.0,  0.0,    0.0,  1.99e33,  8,      THE "orange"),
              (5.85e12, 0.0,  0.0, 4.76e6,  3.29e26,  2,      THE "yellow"),
              (1.08e13, 0.0,  0.0, 3.51e6,  4.84e27,  4,      THE "green" ),
              (1.50e13, 0.0,  0.0, 2.97e6,  5.98e27,  4,      THE "blue"  ),
              (2.25e13, 0.0,  0.0, 2.43e6,  6.57e26,  3,      THE "red"   ),
              (7.80e13, 0.0,  0.0, 1.30e6,  1.90e30,  6,      THE "brown" ) 

#             ( 7.80e13, 0.0, 0.0,  1.30e6, 1.90e32,  6,      THE "brown" ),
#             (-7.80e13, 0.0, 0.0, -1.30e6, 1.90e32,  6,      THE "goldenrod1")

            ];

                                                        # animate_sim_g         is from   src/lib/x-kit/tut/nbody/animate-sim-g.pkg

    package animate_sim
        =
        animate_sim_g (
            package gravity_simulator = gravity_simulator;
            planet_data = planet_data;
        );

    run = animate_sim::do_it;

    selfcheck = animate_sim::selfcheck;
};


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext