Graphics
3D Lab  Report
Interactively View Several 3D Objects

Purpose
With the "3D Lab" you can choose a figure to display (Cube | Sphere | Cube & Sphere | f(x,y) Surface | Football field) and then use spinboxes to decide where your eye is.

Materials and Equipment

Software Requirements
Windows 95
Delphi 3 (to recompile)
ThreeDLab.EXE

Hardware Requirements
VGA Display

Procedure

  1. Double click on the ThreeDLab.EXE icon to start the program.
  2. Select one of the figures to display from the Combobox: Cube | Sphere | Sphere In Cube | Surface | Football Field
  3. Use the spinboxes to change the eye position, or the screen parameters.

Discussion
The DrawFigures.PAS unit defines the various objects in 3D space using "world coordinates."

The default viewing azimuth, elevation and distance is set when an object is selected. See the "absolute" trick used in the GraphicsMathLibrary.PAS unit in defining parameters to ViewTransformMatrix to be either (x,y,z) or (azimuth,elevation,distance).

A large ScreenToCameraDistance/ScreenHeight ratio specifies a narrow aperture -- a telephoto view. Conversely, a small ratio specifies a large aperture, which is a wide-angle view.

Hold down on the spinboxes (assuming you have enough spare cycles -- it works fine on a 166 MHz Pentium with 32 MB memory) to see the figure rotate left-or-right or up-or-down, or change the viewing distance. Changing these values directly changes the ViewTransformMatrix used to display the object.

Conclusions
This program is a convenient way to interactively view one of the selected objects.


Keywords
2D/3D vector graphics, translation, rotation, scaling, view transform, homogeneous coordinates, clipping, projections, vectors, matrices, TPantograph, telephoto view, wide angle view, Delphi 3

Download
Delphi 3 Source and EXE (160 KB): ThreeDLab.ZIP

No changes are needed to compile in Delphi 4. EXE is 274 KB in D3 while it's 361 KB in D4.


Updated
26 Feb 2005


since 1 Nov 1998