Graphics
Football  Lab Report
Show Three Perspective Views and an Orthographic View of a Football Field
See Actual Satellite View of Above Football Field from Microsoft's TerraServer
The satellite view is the same as the orthographic view at the lower left above.

Purpose
The Football program shows how to define a football field mathematically and display it in various perspective views.

Materials and Equipment

Software Requirements
Windows 95/98/NT
Delphi 3/4 (to recompile)
Football.EXE

Hardware Requirements
Best when run on 800 x 600 pixel (or higher) monitor with 256-color (or higher) display.

Procedure

  1. Double click on the Football.EXE icon.
  2. Select the Draw button to see the above screen display with a 400-by-400 pixel image.
  3. If desired, select the Clear button and repeat Step 2.
  4. Select the Print button to print the same image as shown above on a full sheet of paper in portrait orientation using the Printer.Canvas.
  5. Select the Write BMP button to create a 600-by-600 pixel bitmap containing the images shown above. The filename is KSUField.BMP.

Discussion
The DrawFields procedure is used to draw on any canvas, namely, the Image.Canvas, Printer.Canvas, or the Bitmap.Canvas. This shows how to write a single routine for various types of display, either on the screen, printed output, or even a file.

DrawFields
defines its own viewports for writing on specific areas of a canvas with the help of a TPantograph object.

The pOrthoXY projection in DrawFields gives an orthographic view of the field, i.e., an X-Y view of the X-Y-Z field. The WorldCoordinatesRange for this 2D orthographic view are defined in feet, which is how the coordinates of the field are defined in DrawFootbalField in the DrawFigures unit.


The pPerspective projections in DrawFields show three perspective views. The ViewTransformMatrix routine creates the transformation from object space to "camera" point-of-view space, after translating the origin of the field to its center.

FillRect is used to clear the canvas via the Clear button.

See the 3D Lab to interactively change the camera viewpoint of the football field.

Conclusions
The TPantograph is quite useful for mapping an object in its 2D or 3D world coordinates to screen coordinates for display or printed output.


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

Download
Delphi 3 Source and EXE (140 KB): Football.ZIP

Compiles without any changes in Delphi 4. Note: Delphi 3 EXE = 229 KB, Delphi 4 KB EXE = 319 KB.


Updated
26 Feb 2005


since 1 Nov 1998