home *** CD-ROM | disk | FTP | other *** search
- #
- # This file existance is justified to demonstrate loops:
- #
-
- #
- # This loop uses the beep function to generate tones in different frequency
- # and time. Unix systems does not support it.
- #
-
- step = 10;
-
- save_mat = view_mat;
-
- b = surfRev( ctlpt( E3, 0.0, 0.0, -0.5 ) +
- ctlpt( E3, 0.3, 0.0, -0.5 ) +
- ctlpt( E3, 0.0, 0.0, 0.5 ) );
-
- rotstepx = rotx(step);
- rotstepy = roty(step);
- rotstepz = rotz(step);
-
- #
- # Rotate around the X axis:
- #
- for ( a = 1, 1, 360 / step,
- view_mat = rotstepx * view_mat:
- view(list(view_mat,b,axes), on)
- );
-
-
- #
- # Rotate around the Y axis:
- #
- for ( a = 1, 1, 360 / step,
- view_mat = rotstepy * view_mat:
- viewobj(view_mat)
- );
-
-
- #
- # Rotate around the Z axis:
- #
- for ( a = 1, 1, 360 / step,
- view_mat = rotstepz * view_mat:
- viewobj(view_mat)
- );
-
- free(rotstepx); free(rotstepy); free(rotstepz);
-
- #
- # Direct use of homomat to create perspective views.
- #
- for ( a = 1, 1, 720 / step,
- view_mat = save_mat *
- homomat( list( list( 1, 0, 0, 0 ),
- list( 0, 1, 0, 0 ),
- list( 0, 0, 1, -a*step/500 ),
- list( 0, 0, a*step/500, 1 ) ) ):
- viewobj(view_mat)
- );
- view_mat = save_mat;
- view(list(view_mat), 0);
- #
- # Direct use of homomat to create shear effects.
- #
- shearb = b;
- for ( a = 1, 1, 360 / step,
- shearb = b * homomat( list( list( 1, a*step/360, 0, 0 ),
- list( 0, 1, 0, 0 ),
- list( 0, 0, 1, 0 ),
- list( 0, 0, 0, 1 ) ) ):
- view(list(shearb,axes), on)
- );
- free(shearb);
-
- view_mat = save_mat;
- view(list(view_mat), 0);
-