home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / gfx / 3d / irit / scripts / solid5.irt < prev    next >
Encoding:
Text File  |  1994-09-04  |  1.3 KB  |  57 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. 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. resolution = 12;
  20.  
  21. T1 = cbspline( 3,
  22.            list( ctlpt( E3, 0.25,  0.0, 1.0 ),
  23.              ctlpt( E3, 0.01,  0.0, 1.0 ),
  24.              ctlpt( E3, 0.04,  0.0, 1.1 ),
  25.              ctlpt( E3, 0.04,  0.0, 1.25 ),
  26.              ctlpt( E3, 0.04,  0.0, 1.3 ),
  27.              ctlpt( E3, 0.001, 0.0, 1.3 ) ),
  28.            list( 0, 0, 0, 1, 2, 3, 4, 4, 4 ) );
  29. T1 = surfrev( T1 );
  30.  
  31. T2 = T1 * rotx( 180 );
  32. T = gpolygon( list( T1, T2 ), on );
  33. free( T1 );
  34. free( T2 );
  35. interact( list( view_mat, T ) );
  36.  
  37. resolution = 20;
  38.  
  39. T3 = cylin( vector( 0.0, 0.0, -2.0 ), vector( 0.0, 0.0, 4.0 ), 0.1 );
  40. view( T3, false );
  41.  
  42. S1 = T3 * T;
  43. free( T );
  44. free( T3 );
  45.  
  46. final = convex( S1 );
  47. free( S1 );
  48.  
  49. time( false ); # In Seconds
  50.  
  51. interact( final );
  52.  
  53. save( "solid5", final );
  54.  
  55. view_mat = save_mat;
  56. resolution = save_res;
  57.