You are here

Writing Mathlets II: A Call to Math Professionals - Basic Graphing -- Three Dimensions: Projection

Author(s): 
Tom Leathrum

For graphing a surface in space, as in the first applet, the fundamental problem is one of presenting the three-dimensional object in a two-dimensional image (on the computer screen). Given a point \((x_3,y_3,z_3)\) in space, this amounts to finding a corresponding point \((x_2,y_2)\) in the plane, with suitable coordinate systems. Once \((x_2,y_2)\) has been found, it can be converted to pixel position by the transformations in part 3. To simplify the computations, it is reasonable to require that this projection have the property that the point \((0,0,0)\) in space projects to the point \((0,0)\) in the plane.

So how is this projection accomplished? Note that the word "projection" here is being used in a sense somewhat different from the linear algebra definition of a projection, of one vector onto another. The two notions of projection are closely related, though -- in fact, the linear algebra projection will be used to compute the projection from three dimensions to two. To see this, it is important to see first the key vector used in the projection: The view vector is the unit vector in space pointing from the origin of the three-dimensional coordinate system directly perpendicular to the computer screen. This vector determines the direction from which the viewer sees the object in space being presented on the screen. The applet below allows the same graph rotations as the first three-dimensional graphing applet -- which have the effect of changing the view vector -- it also includes a shown vector, indicated by a blue arrow. (In the initial default settings, this arrow is concealed by the axes -- rotate the graph a bit to reveal it.) The green lines and arcs in the applet show how two angles can be used to specify the shown vector.

 

The angles used to specify the shown vector (or any unit vector in space) are the angles \(\theta\), measured counterclockwise from the positive \(x\)-axis in the \(xy\)-plane (denoted "a" in the applet), and \(\phi\), measured down from the \(z\)-axis (denoted "b"), as used in spherical coordinates. These angles \(a\) and \(b\) for the view vector will be called here the view angles. The "Up" and "Down" buttons transfer the angles from one vector to the other: "Up" from the shown vector to the view vector, not changing the shown vector but rotating the graph so that the shown vector is perpendicular to the computer screen; or "Down" from view vector to shown vector, not rotating the graph but changing the shown vector so that it is perpendicular to the computer screen (the same direction as the view vector). The "Reset to Default" button sets all angles to 45 degrees, the initial default settings.

Notice the effects of mouse motions (when clicking and dragging on the graph for graph rotations) on the view angles: Horizontal mouse motions affect only \(a\), and vertical mouse motions affect only \(b\). This is a natural way to establish the rotations from mouse motions, but further reinforces the puzzle of this article: If every view vector can be described using these two view angles, and the mouse position can be used to change both angles, why is the motion of the z-axis so restricted?

Tom Leathrum, "Writing Mathlets II: A Call to Math Professionals - Basic Graphing -- Three Dimensions: Projection," Loci (November 2004)

JOMA

Journal of Online Mathematics and its Applications

Dummy View - NOT TO BE DELETED