# # Some examples of 3d bisector computations of 3-space freeform curves. # # Gershon Elber, August 1996. # # # Set states. # save_mat = view_mat; view_mat = view_mat * sc( 0.35 ); viewobj( view_mat ); IProd = iritstate( "InterpProd", off ); ############################################################################# # # Two linear curves # c1 = cbezier( list( ctlpt( E3, 0.0, 0.1, -1.0 ), ctlpt( E3, 0.0, 0.1, 1.0 ) ) ); c2 = cbezier( list( ctlpt( E3, -1.0, -0.1, 0.0 ), ctlpt( E3, 1.0, -0.1, 0.0 ) ) ); color( c1, red ); adwidth( c1, 3 ); color( c2, red ); adwidth( c2, 3 ); BisectSrf = cbisector3D( list( c1, c2 ), 1 ); color( BisectSrf, green ); interact( list( c1, c2, BisectSrf ) ); save( "bisectr1", list( c1, c2, BisectSrf ) ); ############################################################################# # # Two linear curves animated # for ( b = 2.0, -0.02, 0.0, c1 = cbezier( list( ctlpt( E3, 0.0, -0.1 - b, -1.0 ), ctlpt( E3, 0.0, -0.1 - b, 1.0 ) ) ): c2 = cbezier( list( ctlpt( E3, -1.0, 0.1 + b, 0.0 ), ctlpt( E3, 1.0, 0.1 + b, 0.0 ) ) ): color( c1, red ): adwidth( c1, 3 ): color( c2, red ): adwidth( c2, 3 ): BisectSrf = cbisector3d( list( c1, c2 ), 1 ): color( BisectSrf, green ): view( list( c1, c2, BisectSrf ), true ) ); pause(); ############################################################################# # # Two quadratic curves # c1 = cbezier( list( ctlpt( E3, 0.0, 0.5, -1.0 ), ctlpt( E3, 0.0, 0.1, 0.0 ), ctlpt( E3, 0.0, 0.5, 1.0 ) ) ); c2 = cbezier( list( ctlpt( E3, -1.0, 1.0, 0.0 ), ctlpt( E3, 0.0, -1.5, 0.0 ), ctlpt( E3, 1.0, 1.0, 0.0 ) ) ); color( c1, red ); adwidth( c1, 3 ); color( c2, red ); adwidth( c2, 3 ); BisectSrf = cbisector3d( list( c1, c2 ), 1 ); color( BisectSrf, green ); interact( list( c1, c2, BisectSrf ) ); save( "bisectr2", list( c1, c2, BisectSrf ) ); ############################################################################# # # A line and a (approximation of a) circle. # c1 = cbezier( list( ctlpt( E3, 0.0, 0.0, -1.0 ), ctlpt( E3, 0.0, 0.0, 1.0 ) ) ); c2 = pcircle( vector( 0.0, 0.0, 0.0 ), 1 ); color( c1, red ); adwidth( c1, 3 ); color( c2, red ); adwidth( c2, 3 ); BisectSrf = cbisector3d( list( c1, c2 ), 1 ); color( BisectSrf, green ); interact( list( c1, c2, BisectSrf ) ); save( "bisectr3", list( c1, c2, BisectSrf ) ); ############################################################################# # # A line and a (approximation of a) circle. # c1 = pcircle( vector( 0.0, 0.0, 0.0 ), 1 ); c2 = cbezier( list( ctlpt( E3, -1.0, 0.0, 1.0 ), ctlpt( E3, 1.0, 0.0, -1.0 ) ) ); color( c1, red ); adwidth( c1, 3 ); color( c2, red ); adwidth( c2, 3 ); BisectSrf = cbisector3d( list( c1, c2 ), 1 ); color( BisectSrf, green ); interact( list( c1, c2, BisectSrf ) ); save( "bisectr4", list( c1, c2, BisectSrf ) ); ############################################################################# # # A line and a (approximation of a) circle. # c1 = creparam( pcircle( vector( 0.0, 0.0, 0.0 ), 1 ), 0, 1 ); c2 = cbezier( list( ctlpt( E3, -2.0, 0.0, 1.0 ), ctlpt( E3, -2.0, 0.0, -1.0 ) ) ); color( c1, red ); adwidth( c1, 3 ); color( c2, red ); adwidth( c2, 3 ); BisectSrf = cbisector3d( list( c1, c2 ), 1 ); BisectSrf1 = sregion( BisectSrf, col, 0.0, 0.3 ); BisectSrf2 = sregion( BisectSrf, col, 0.7, 1.0 ); BisectSrf3 = sregion( BisectSrf, col, 0.36, 0.64 ); color( BisectSrf1, green ); color( BisectSrf2, green ); color( BisectSrf3, green ); interact( list( c1, c2, BisectSrf1, BisectSrf2, BisectSrf3 ) ); save( "bisectr5", list( c1, c2, BisectSrf ) ); ############################################################################# # # A helix and a point # Helix = pcircle( vector( 0.0, 0.0, 0.0 ), 1 ) * rz( 90 ) * ry( -90 ); for ( i = 0, 1, sizeof( Helix ) - 1, PtH = coord( Helix, i ): Helix = cEditPt( Helix, ctlpt( E3, i / 4, coord( PtH, 2 ), coord( PtH, 3 ) ), i ) ); Helix = ( Helix + Helix * tx( 9 / 4 ) ) * sx( 0.5 ); color( Helix, red ); adwidth( Helix, 3 ); pt = point( 1.2, 0, 0 ); color( pt, yellow ); adwidth( Pt, 3 ); BisectSrf = cbisector3d( list( Helix, pt ), 1 ); color( BisectSrf, green ); interact( list( Helix, pt, BisectSrf ) ); save( "bisectr6", list( Helix, pt, BisectSrf ) ); ############################################################################# # # A bilinear surface: sphere--plane bisector # s1 = ruledSrf( ctlpt( E3, -1.0, -1.0, 0.0 ) + ctlpt( E3, 1.0, -1.0, 0.0 ), ctlpt( E3, -1.0, 1.0, 0.0 ) + ctlpt( E3, 1.0, 1.0, 0.0 ) ); color( s1, red ); pt = point( 0, 0, 1 ); adwidth( pt, 3 ); color( pt, yellow ); BisectSrf = sbisector( s1, pt ); color( BisectSrf, green ); interact( list( s1, pt, BisectSrf ) ); save( "bisectr7", list( s1, pt, BisectSrf ) ); for ( z = 1.0, -0.01, -1.0, pt = point( 0, 0, z ): adwidth( pt, 3 ): color( pt, yellow ): BisectSrf = sbisector( s1, pt ): color( BisectSrf, green ): view( list( s1, pt, BisectSrf ), 1 ) ); pause(); ############################################################################# # # A sphere--sphere/sphere-pt bisector # s = sphereSrf( 1 ); color( s, red ); s1 = sRegion( sRegion( s, row, 0.5, 1.5 ), col, 2.5, 3.5 ); s2 = sRegion( sRegion( s, row, 0.001, 1.999 ), col, 0.001, 1.999 ); pt = point( 0, 2, 0 ); adwidth( pt, 3 ); color( pt, yellow ); BisectSrf1 = sbisector( s1, pt ); BisectSrf2 = sbisector( s2, pt ); color( BisectSrf1, green ); color( BisectSrf2, green ); interact( list( s, pt, BisectSrf1, BisectSrf2 ) ); pt = point( 0, 0.6, 0 ); adwidth( pt, 3 ); color( pt, yellow ); BisectSrf = sbisector( s, pt ); color( BisectSrf, green ); interact( list( s, pt, BisectSrf ) ); save( "bisectr8", list( s, pt, BisectSrf ) ); ############################################################################# IProd = iritstate( "InterpProd", IProd ); free( IProd ); view_mat = save_mat; free( s ); free( s1 ); free( s2 ); free( Helix ); free( c1 ); free( c2 ); free( BisectSrf ); free( BisectSrf1 ); free( BisectSrf2 ); free( BisectSrf3 ); free( Pt ); free( PtH ); free( i ); free( z ); free( b );