# # Intersection of cone and a cylinder: # Try this one with resolution equal 20 - slower, but much nicer! # # Created by Gershon Elber, Jan. 89 # save_mat = view_mat; view_mat = view_mat * scale( vector( 0.2, 0.2, 0.2 ) ); save_res = resolution; resolution = 8; cone1 = con2( vector( 0, 0, -1 ), vector( 0, 0, 4 ), 2, 1, 3 ); cylin1= cylin( vector( 0, 3, 0 ), vector( 0, -6, 2 ), 0.7, 3 ); a = cone1 + cylin1; free( cylin1 ); free( cone1 ); beep(); interact( list( view_mat, a ) ); # # Currently variables can not be introduced in a loop (except the iteration # variable), so we prepare all variables in advance. # cntrs = nil(); IntrCrv = iritstate( "intercrv", true ); for ( i = -0.9, 0.1, 2.9, p = circpoly( vector( 0.0, 0.0, 1.0 ), vector( 0.0, 0.0, i ), 6.0 ): c = a * p: viewobj( c ): snoc(c, cntrs) ); free( i ); IntrCrv = iritstate( "intercrv", IntrCrv ); free( IntrCrv ); viewremove("c"); viewobj(cntrs); pause(); save( "contours", cntrs ); free( a ); free( p ); free( c ); free( cntrs ); resolution = save_res; view_mat = save_mat;