'' 
'' COPYRIGHT (C) 1987, CACI, INC. - FEDERAL, LA JOLLA
''
''   This process will move an image along the path of a closed polygon
''-----------------------------------------------------------------------
Process IMAGE

     Define CURRENT.COURSE, NUM.SIDES, ANGLE as real variables
     Define I, J, CURRENT.TICK as integer variables
     
     For I = 1 to NUM.ROTATIONS
     Do
          Call SYSTIME.R yielding CURRENT.TICK
          Let NUM.SIDES = RANDI.F(2, 10, MOD.F(CURRENT.TICK, 9)+1)
          Let ANGLE = (2 * PI.C * (1 - 2 * RANDI.F(0,1,2))) / NUM.SIDES

          For J = 1 to NUM.SIDES 
          Do
               Let orientation.a(IMAGE) = CURRENT.COURSE
               Let velocity.a(IMAGE) = velocity.f(SPEED, CURRENT.COURSE)
               
               Wait (1000 * PI.C) / (NUM.SIDES * SPEED) units  
               Add ANGLE * min.f(NUM.SIDES - J,1) to CURRENT.COURSE
          Loop
     Loop
End '' process IMAGE

