# # Examples for trimming offsets with the TOFFSET command. # # Gershon ELber, Nov 2002 # save_mat = view_mat; view_mat = sc( 0.4 ) * ty( -0.8 ); viewobj( view_mat ); OldIP = iritstate( "InterpProd", off ); viewstate( "PllnAprx", on ); viewstate( "PllnAprx", on ); ############################################################################# c0 = cbspline( 3, list( ctlpt( E2, -1, 3 ), ctlpt( E2, -0.3, 0 ), ctlpt( E2, 0.3, 0 ), ctlpt( E2, 1, 3 ) ), list( kv_open ) ); view( c0, 1 ); for ( i = -5, 1, 5, if ( i != 0, ofst = 0.15 * i: co = offset( c0, ofst, 0.0001, off ): none = toffset( c0, co, 15, abs( ofst * 0.999 ), 0.001 ): color( none, i + 6 ): viewobj( none ) ) ); save( "trim1off", list( c0, none ) ); pause(); ############################################################################# c0 = cbspline( 3, list( ctlpt( E2, -1, 3 ), ctlpt( E2, -0.8, 2 ), ctlpt( E2, -0.9, 1 ), ctlpt( E2, -0.3, 0 ), ctlpt( E2, 0.3, 0 ), ctlpt( E2, 0.7, 1.5 ), ctlpt( E2, -0.8, 2 ), ctlpt( E2, 1, 3 ) ), list( kv_open ) ); view( c0, 1 ); for ( i = -5, 1, 5, if ( i != 0, ofst = 0.12 * i: # co = offset( c0, ofst, 0.001, off ): # co = loffset( c0, ofst, 200, 50, 3 ): co = aoffset( c0, ofst, 0.002, 0, 0 ): none = toffset( c0, co, 5, abs( ofst * 0.99 ), 0.0001 ): color( none, i + 6 ): viewobj( none ) ) ); save( "trim2off", list( c0, none ) ); pause(); ############################################################################# c0 = cbspline( 4, list( ctlpt( E2, 0.95, 0.05 ), ctlpt( E2, 0.95, 0.76 ), ctlpt( E2, 0.30, 1.52 ), ctlpt( E2, 0.30, 1.90 ), ctlpt( E2, 0.50, 2.09 ), ctlpt( E2, 0.72, 2.24 ), ctlpt( E2, 0.72, 2.32 ), ctlpt( E2, 0.38, 2.50 ), ctlpt( E2, 0.42, 2.70 ), ctlpt( E2, 0.57, 2.81 ), ctlpt( E2, 0.57, 3.42 ), ctlpt( E2, 0.19, 3.57 ), ctlpt( E2, 0.00, 3.57 ) ), list( KV_OPEN ) ); view( c0, 1 ); for ( i = -5, 1, 5, if ( i != 0, ofst = 0.15 * i: co = offset( c0, ofst, 0.005, off ): co = loffset( c0, ofst, 300, 30, 3 ): none = toffset( c0, co, 2, abs( ofst * 0.95 ), 0 ): color( none, i + 6 ): viewobj( none ) ) ); pause(); view( c0, 1 ); for ( i = -5, 1, 5, if ( i != 0, ofst = 0.15 * i: # co = offset( c0, ofst, 0.005, off ): co = loffset( c0, ofst, 300, 30, 3 ): none = toffset( c0, co, 2, abs( ofst * 0.95 ), 0.001 ): color( none, i + 6 ): viewobj( none ) ) ); pause(); view( c0, 1 ); for ( i = -5, 1, 5, if ( i != 0, ofst = 0.15 * i: co = offset( c0, ofst, 0.001, off ): # co = loffset( c0, ofst, 500, 50, 3 ): none = toffset( c0, co, 2, abs( ofst * 0.99 ), 0.001 ): color( none, i + 6 ): viewobj( none ) ) ); save( "trim3off", list( c0, none ) ); pause(); ############################################################################# c0 = cbspline( 4, list( ctlpt( E3, -0.796, 2.44, 0 ), ctlpt( E2, -0.0441, 3.04 ), ctlpt( E2, -0.766, 4.19 ), ctlpt( E2, -1.94, 3.63 ), ctlpt( E2, -1.99, 2.57 ), ctlpt( E2, -1.63, 2.3 ), ctlpt( E2, -0.982, 2.28 ), ctlpt( E2, -0.898, 2.02 ), ctlpt( E2, -0.999, 1.79 ), ctlpt( E2, -1.43, 1.58 ), ctlpt( E2, -1.7, 1.3 ), ctlpt( E2, -1.52, 0.218 ), ctlpt( E2, -0.0677, 0.371 ), ctlpt( E2, -0.415, 1.19 ), ctlpt( E2, -0.0516, 1.75 ), ctlpt( E2, 0.359, 1.96 ), ctlpt( E2, 0.528, 1.55 ), ctlpt( E2, 0.585, 1.28 ), ctlpt( E2, 0.865, 0.895 ), ctlpt( E2, 1.09, 0.771 ), ctlpt( E2, 1.13, 0.916 ), ctlpt( E2, 0.961, 1.51 ), ctlpt( E2, 2.03, 1.93 ), ctlpt( E2, 1.79, 3.12 ), ctlpt( E2, 0.583, 3.32 ), ctlpt( E2, 0.557, 2.41 ), ctlpt( E2, 0.239, 2.04 ), ctlpt( E2, -0.538, 1.79 ) ), list( kv_periodic ) ); c0 = coerce( c0, kv_open ); view( c0, 1 ); for ( i = -3, 1, 3, if ( i != 0, ofst = 0.15 * i: co = offset( c0, ofst, 0.01, off ): # co = loffset( c0, ofst, 700, 70, 3 ): none = toffset( c0, co, 2, abs( ofst * 0.98 ), 0.001 ): color( none, i + 4 ): viewobj( none ) ) ); save( "trim4off", list( c0, none ) ); pause(); ############################################################################# free( i ); free( c0 ); free( co ); free( ofst ); free( none ); view_mat = save_mat; viewstate( "PllnAprx", off ); viewstate( "PllnAprx", off ); OldIP = iritstate( "InterpProd", OldIP ); free( OldIP );