| 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.EXEHardware Requirements
Best when run on 800 x 600 pixel (or higher) monitor with 256-color (or higher) display.
Procedure
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
14 Sep 2004
since 1 Nov 1998