home *** CD-ROM | disk | FTP | other *** search
- echosrc = false;
-
- demo = procedure():
- include("demo.irt");
-
- #
- # Some simple functions.
- #
- min = function(x, y):
- if (x > y, return = y, return = x);
- max = function(x, y):
- if (x > y, return = x, return = y);
- sqr = function(x):
- return = x * x;
- normalize = function(x):len:
- return = 1.0:
- if (thisobj(x) == vector_type,
- len = sqrt(x * x):
- return = vector(coord(x, 0) / len,
- coord(x, 1) / len,
- coord(x, 2) / len)):
- if (thisobj(x) == point_type,
- len = sqrt(x * x):
- return = point(coord(x, 0) / len,
- coord(x, 1) / len,
- coord(x, 2) / len)):
- if (thisobj(return) == numeric_type,
- printf("NORMALIZE: Can handle only vectors or points, found %8.6lDg\n",
- list(x)));
-
- #
- # Emulation of view, interact and other useful viewing functions using VIEWOBJ
- #
- viewclear = procedure():command_: # Clear the screen.
- command_ = "CLEAR":
- viewobj(command_);
- viewdclear = procedure():command_: # Delayed clear screen.
- command_ = "DCLEAR":
- viewobj(command_);
- viewdisc = procedure():command_: # Disconnect from this display device
- command_ = "DISCONNECT":
- viewobj(command_);
- viewexit = procedure():command_: # Force Display device to exit.
- command_ = "EXIT":
- viewobj(command_);
- viewsave = procedure(name):command_: # Save viewing matrix under name.
- command_ = "MSAVE " + name:
- viewobj(command_);
- viewremove = procedure(name):command_: # Remove an object from display.
- command_ = "REMOVE " + name:
- viewobj(command_);
- beep = procedure():command_: # Make some noise.
- command_ = "BEEP":
- viewobj(command_);
- viewstate = procedure(state):command_: # Change state of display device.
- command_ = "STATE " + state:
- viewobj(command_);
- view = procedure(none,clear): # Emulation of old VIEW command.
- if (clear != 0.0, viewdclear()):
- viewobj(none);
- interact = procedure(none): # Emulation of old INTERACT command.
- viewdclear():
- viewobj(none):
- pause(1);
-
- echosrc = true;
-