home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / i / iritsm3s.zip / irit / solid5.irt < prev    next >
Text File  |  1992-02-25  |  1KB  |  61 lines

  1. #
  2. # This solid uses free form surfaces to create a rolling-pin. This
  3. # file pushed the IBM PC version to its (memory) limits. Take <4 minutes
  4. # on my 286 12MHz with 287.
  5. #   One could do it much easier as one surface of revolution.
  6. # final = surfrev(T1 + -T2) should do it. The unary minus flips the curve
  7. # and the add, chain them together into a single curve by adding a linear
  8. # segment (practically the rolling pin itself) between them.
  9. #
  10. #                Created by Gershon Elber,    May 90
  11. #
  12.  
  13. tm = time(true);
  14.  
  15. save_mat = view_mat;
  16. view_mat = view_mat * scale( vector( 0.5, 0.5, 0.5 ) );
  17. save_res = resolution;
  18.  
  19.  
  20. # normal(TRUE, 0.1, YELLOW);
  21.  
  22. resolution = 12;
  23.  
  24. T1 = cbspline( 3,
  25.            list( ctlpt( E3, 0.25,  0.0, 1.0 ),
  26.              ctlpt( E3, 0.01,  0.0, 1.0 ),
  27.              ctlpt( E3, 0.04,  0.0, 1.1 ),
  28.              ctlpt( E3, 0.04,  0.0, 1.25 ),
  29.              ctlpt( E3, 0.04,  0.0, 1.3 ),
  30.              ctlpt( E3, 0.001, 0.0, 1.3 ) ),
  31.            list( 0, 0, 0, 1, 2, 3, 4, 4, 4 ) );
  32. T1 = surfrev( T1 );
  33.  
  34. T2 = T1 * rotx( 180 );
  35. T = gpolygon(list( T1, T2 ) );
  36. free( T1 );
  37. free( T2 );
  38. interact( T, false );
  39.  
  40. resolution = 20;
  41.  
  42. T3 = cylin( vector( 0.0, 0.0, -2.0 ), vector( 0.0, 0.0, 4.0 ), 0.12 );
  43. view( list( T3 ), false );
  44.  
  45. S1 = T3 * T;
  46. free( T );
  47. free( T3 );
  48.  
  49. final = convex( S1 );
  50. free( S1 );
  51.  
  52. tm = time( false );
  53. tm; # In Seconds
  54.  
  55. interact( list( final ), false );
  56.  
  57. save( "solid5", list( view_mat, final ) );
  58.  
  59. view_mat = save_mat;
  60. resolution = save_res;
  61.