Programming and Graphics

(Kiana) #1

248 Introduction to C++ Programming and Graphics


Figure 7.7.1 Graphics display of codeplot3d.

Since these variables are declared as external, their values are supplied from
another code upon linking – in this case, from the main program. If these
variables were defined and evaluated in the header file, multiple definitions
would occur upon linking resulting in an exception, as discussed in Section 4.7.


The graphics output of the code is shown in Figure 7.7.1.


Problems


7.7.1. Run the codeplot3dto draw the wireframe of a sphere defined by
azimuthal and meridional circles.

7.7.2. Modify the codeplot3dto animate the motion of a three-dimensional
line.

7.8 Three-dimensional interactive object drawing


By a straightforward modification of the functions and main program discussed
in Section 7.7 we are able to produce a code that draws an object in three di-

Free download pdf