home *** CD-ROM | disk | FTP | other *** search
/ Mega CD-ROM 1 / megacd_rom_1.zip / megacd_rom_1 / IRIT / IRITS.ZIP / BUG.IRT < prev    next >
Text File  |  1989-04-18  |  1KB  |  51 lines

  1. #
  2. # A teeth wheel:
  3. #                        Gershon Elber, Apr 89
  4. #
  5.  
  6. tm = time(true);
  7.  
  8. save_mat = view_mat;
  9. save_res = resolution;
  10.  
  11. # Number of samples per circle:
  12. resolution = 4;
  13.  
  14. # Note angle must be power of 2 as we multiply it by 2 each iteration, and
  15. # angle_log should hold the base 2 log of the divider in angle: log2 16 = 4.
  16. angle = 360/4;
  17. angle_log = 2; 
  18.  
  19. C = cylin(vector( 0.6, 0.0, -0.1), vector( 0.0, 0.0, 0.3), 0.3);
  20. view(list(C,axes), true);
  21.  
  22. for ((i=1), 1, angle_log,
  23.     (C = C + C * rotz(angle)):
  24.     (angle = angle * 2):
  25.     view(list(C,axes), true)
  26. );
  27.  
  28. #
  29. # Now lets create the wheel, make a hole in it to make it looks more real,
  30. # and subtract all the teeth from it:
  31. #
  32.  
  33. resolution = 32;
  34. wheel = cylin(vector( 0.0, 0.0, 0.0), vector( 0.0, 0.0, 0.08), 0.6);
  35. beep(1200,200);
  36.  
  37. wheel = wheel - C;
  38. free(C);
  39. beep(1200,200);
  40. view(list(wheel), true);
  41.  
  42. gdump("bug", wheel);
  43.  
  44. wheel = convex(wheel);
  45. interact(list(wheel), true);
  46.  
  47. resolution = save_res;
  48. view_mat = save_mat;
  49.  
  50. 
  51.