#
# Some examples to manipulation of text in IRIT.
#
#				Gershon Elber, May 1996.
#

save_mat = view_mat;

textGeom3dAux = function( Ply, Wdth, Dpth ):
    if ( thisobj("Ply" ) == poly_type,
	 return = extrude( ruledSrf( offset( Ply, -Wdth / 2, 0, 0 ),
			             offset( Ply,  Wdth / 2, 0, 0 ) ),
			   vector( 0.0, 0.0, Dpth ) ),
	 return = nil() );

textGeom3d = function( Txt, Wdth, Dpth ):
    return = 1;
textGeom3d = function( Txt, Wdth, Dpth ): i:
    if ( thisobj( "Txt" ) == list_type,
	return = nil():
	for ( i = 1, 1, sizeof( Txt ),
	     snoc( textGeom3d( nth( TxT, i ), Wdth, Dpth ), return ) ),
	return = textGeom3dAux( Txt, Wdth, Dpth ) );

TxtU = textgeom("ABCDEFGHIJKLMNOPQRSTUVWXYZ", vector( 0.1, 0, 0 ), 0.08 );
TxtL = textgeom("abcdefghijklmnopqrstuvwxyz", vector( 0.1, 0, 0 ), 0.08 );
TxtN = textgeom("01234567890#$&*()+-=;:/?.,", vector( 0.1, 0, 0 ), 0.08 );

view_mat = sc( 0.7 ) * tx( -0.9 );
All = list( TxtU,
	    TxtL * ty( -0.2 ),
	    TxtN * ty( -0.4 ) );
interact( list( view_mat, All ) );

TxtU3d = textGeom3d( TxtU, 0.01, 0.1 );
TxtL3d = textGeom3d( TxtL, 0.01, 0.1 );
TxtN3d = textGeom3d( TxtN, 0.01, 0.1 );
All = convex( list( TxtU3d,
		    TxtL3d * ty( -0.2 ),
		    TxtN3d * ty( -0.4 ) ) );
interact( list( view_mat, All ) );

free( TxtU );
free( TxtL );
free( TxtN );
free( TxtU3d );
free( TxtL3d );
free( TxtN3d );
free( All );

view_mat = save_mat;
