home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Professional
/
OS2PRO194.ISO
/
os2
/
graphic
/
irit
/
wheel.irt
< prev
Wrap
Text File
|
1991-09-04
|
1KB
|
72 lines
#
# A teeth wheel:
# Gershon Elber, Apr 89
#
tm = time(true);
save_mat = view_mat;
save_res = resolution;
# Number of samples per circle:
resolution = 8;
# Note angle must be power of 2 as we multiply it by 2 each iteration, and
# angle_log should hold the base 2 log of the divider in angle: log2 16 = 4.
angle = 360/16;
angle_log = 4;
C = cylin(vector( 0.6, 0.0, -0.1), vector( 0.0, 0.0, 0.3), 0.1);
view(list(C,axes), true);
for ((i=1), 1, angle_log,
(C = C + C * rotz(angle)):
(angle = angle * 2):
view(list(C,axes), true)
);
#
# Now lets create the wheel, make a hole in it to make it looks more real,
# and subtract all the teeth from it:
#
resolution = 32;
wheel = cylin(vector( 0.0, 0.0, 0.0), vector( 0.0, 0.0, 0.08), 0.6);
beep(1200,200);
resolution = 16;
H1 = CYLIN(vector( 0.0, 0.0, -0.1), vector( 0.0, 0.0, 0.3), 0.1);
H2 = BOX(vector( -0.2, -0.05,-0.1), 0.4, 0.1, 0.3);
H = H1 + H2;
free(H1);
free(H2);
beep(1200,200);
view(list(wheel,H), true);
wheel = wheel - H;
free(H);
wheel = convex(wheel);
beep(1200,200);
interact(list(wheel), false);
wheel = wheel - C;
free(C);
beep(1200,200);
interact(list(wheel), false);
final = convex(wheel);
free(wheel);
tm = time(false);
tm; # In Seconds
beep(1200,200);
interact(list(final), false);
save("wheel", list(view_mat,final));
free(final);
resolution = save_res;
view_mat = save_mat;