Preamble
''
'' COPYRIGHT (C) 1993, CACI Products Company.
'' AUTHOR: Steve Bailey
'' DATE: 9-22-93
'' DESCRIPTION:
''     Preamble for this bouncing ball program.  This program should only be 
''     run under SIMSCRIPT with SIMGRAPHICS II.  Some newer features of 
''     SIMGRAPHICS II are demonstrated including pullright menus
''     and the useage of raster (bitmap) files.  
''
''     The pullright menu interface allows the user to asyncronously change
''     floor stiffness, air resistance, and gravity force.  This interface 
''     will also enable a user to set attributes for the next ball to be 
''     created including its mass, initial x and y velocities, and bitmapped 
''     icon representation.
''
''     Continuous simulation is used to evaluate the dynamic equation of 
''     the damped motion of an object against a spring. i.e. 
''     G = M * d2x/dt2 + KV * dx/dt + KS * x.  Any number of objects can 
''     be created by the user at runtime through the menu interface.
''     Each object (ball) is both a process and a graphic entity containing
''     continuous double variables and set membership as defined below.
''

processes include OUTPUT, MENU, PALETTE, POPUP.MENU
    every BALL has 
      a X,
      a Y,
      a VX,
      a VY,
      a MASS,
      and a DONE.FLAG

    define X, Y, VX, VY as continuous double variables
    define MASS as double variables
    define DONE.FLAG as an integer variable

temporary entities
    every BALL may belong to a BALL.SET

dynamic graphic entities include BALL, FLOOR, WALL, ICON

the system owns the BALL.SET
    define BALL.SET as a fifo set

'' globals
    define BALL.ICON as a text variable
    define BALL.MASS, BALL.XVEL, BALL.YVEL as double variables
    define WINDOW.ID, MENU.PTR as a pointer variable
    define SIMULATION.DONE as an integer variable
    define DONE as a integer function

'' left motitored variables.  A routine is called automatically when
'' these are assigned
    define EVRN.GRAVITY, EVRN.FLOOR, EVRN.AIRRES 
       as double variables monitored on the left

'' constants
    define .TRUE to mean 1
    define .FALSE to mean 0
    define .FLOOR.POS to mean 0.0
    define .LEFT.WALL.POS to mean -46.0
    define .RIGHT.WALL.POS to mean 46.0
    define .WALL.STIFFNESS to mean 500.0
    define .MASS.HEAVY to mean 15.0       '' weight of the next ball added
    define .MASS.MEDIUM to mean 5.0
    define .MASS.LIGHT to mean 1.0
    define .VELOCITY.FAST to mean 25.0    '' initial speed of next ball
    define .VELOCITY.MEDIUM to mean 5.0
    define .VELOCITY.SLOW to mean 0.0
    define .GRAVITY.HIGH to mean 80.0     '' gravity constant
    define .GRAVITY.MEDIUM to mean 32.0
    define .GRAVITY.LOW to mean 5.3
    define .FLOOR.HIGH to mean 200.0      '' floor stiffness
    define .FLOOR.MEDIUM to mean 100.0
    define .FLOOR.LOW to mean 25.0
    define .AIRRES.HIGH to mean 5.0       '' air resistance damping
    define .AIRRES.MEDIUM to mean 1.0
    define .AIRRES.LOW to mean 0

define POPUP.F as a text function

End '' preamble
