home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / gfx / 3d / irit / scripts / loops.irt < prev    next >
Encoding:
Text File  |  1994-02-22  |  1.5 KB  |  78 lines

  1. #
  2. # This file existance is justified to demonstrate loops:
  3. #
  4.  
  5. #
  6. # This loop uses the beep function to generate tones in different frequency
  7. # and time. Unix systems does not support it.
  8. #
  9.  
  10. step = 10;
  11.  
  12. save_mat = view_mat;
  13.  
  14. b = surfRev( ctlpt( E3, 0.0, 0.0, -0.5 ) +
  15.          ctlpt( E3, 0.3, 0.0, -0.5 ) +
  16.          ctlpt( E3, 0.0, 0.0,  0.5 ) );
  17.  
  18. rotstepx = rotx(step);
  19. rotstepy = roty(step);
  20. rotstepz = rotz(step);
  21.  
  22. #
  23. # Rotate around    the X axis:
  24. #
  25. for ( a = 1, 1, 360 / step,
  26.     view_mat = rotstepx * view_mat:
  27.     view(list(view_mat,b,axes), on)
  28.     );
  29.  
  30.  
  31. #
  32. # Rotate around    the Y axis:
  33. #
  34. for ( a = 1, 1, 360 / step,
  35.     view_mat = rotstepy * view_mat:
  36.     viewobj(view_mat)
  37.     );
  38.  
  39.  
  40. #
  41. # Rotate around    the Z axis:
  42. #
  43. for ( a = 1, 1, 360 / step,
  44.         view_mat = rotstepz * view_mat:
  45.     viewobj(view_mat)
  46.     );
  47.  
  48. free(rotstepx); free(rotstepy); free(rotstepz);
  49.  
  50. #
  51. # Direct use of homomat to create perspective views.
  52. #
  53. for ( a = 1, 1, 720 / step,
  54.     view_mat = save_mat *
  55.            homomat( list( list( 1, 0, 0, 0 ),
  56.                   list( 0, 1, 0, 0 ),
  57.                   list( 0, 0, 1, -a*step/500 ),
  58.                   list( 0, 0, a*step/500, 1 ) ) ):
  59.     viewobj(view_mat)
  60.     );
  61. view_mat = save_mat;
  62. view(list(view_mat), 0);
  63. #
  64. # Direct use of homomat to create shear effects.
  65. #
  66. shearb = b;
  67. for ( a = 1, 1, 360 / step,
  68.     shearb = b * homomat( list( list( 1, a*step/360, 0, 0 ),
  69.                     list( 0, 1, 0, 0 ),
  70.                     list( 0, 0, 1, 0 ),
  71.                     list( 0, 0, 0, 1 ) ) ):
  72.     view(list(shearb,axes), on)
  73.     );
  74. free(shearb);
  75.  
  76. view_mat = save_mat;
  77. view(list(view_mat), 0);
  78.