| Sphere In Cube | Lab Report |
Purpose
"Sphere in Cube" shows six perspective views and three
orthographic views of a sphere inside a cube.
Materials and Equipment
Software Requirements
Windows 95
Delphi 3 (to recompile)
SphereInCube.EXEHardware Requirements
VGA display
Procedure
Discussion
The DrawNineViews routine uses various viewports to draw a
3-by-3 matrix of views. The top row shows orthographic views, X-Y, X-Z and Y-Z, while the
middle and bottom rows show various perspective views. When the Draw button is
pressed, DrawNineViews is called twice to fill the two TImages, ImageBig
and ImageSmall.
FillRect is used by the Clear button method to clear both TImages.
The TPantograph class needs documentation so others can use it effectively.
Conclusions
This example shows how to show various orthographic and
perspective views of a sphere in a cube using the TPantograph object that maps
real-world coordinates to a viewport area.
Keywords
2D/3D vector graphics, translation, rotation, scaling, view transform, homogeneous
coordinates, clipping, projections, vectors, matrices, pOrthoXY, pOrthoXZ, pOrthoYZ,
pPerspective, TPantograph, Delphi 3
Download
Delphi 3 Source and EXE (139 KB): SphereInCube.ZIP
No change to compile in Delphi 4. EXE size is 229 KB in D3 while it's 319 KB in D4.
Updated
14 Sep 2004
since 1 Nov 1998