Process IMAGE.MOTION

'' Describes motion behaviour of graphical entity IMAGE
'' by setting orientation and velocity of the 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


          let NUM.SIDES = 4
          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)
               
               Work (1000 * PI.C) / (NUM.SIDES * SPEED) units  
               Add ANGLE * min.f(NUM.SIDES - J,1) to CURRENT.COURSE
          Loop
     Loop
End '' process IMAGE.MOTION
