Pro OpenGL ES for iOS

(singke) #1

CHAPTER 2: All That Math Jazz (^39)
Note Moving back and forth from one frame of reference to another is the quickest road to
insanity next to trying to figure out why Fox canceled Firefly. The classic 1973 book Principles
of Interactive Computer Graphics has z going up and +y going into the screen. In his book,
Bruce Artwick, the creator of Microsoft’s Flight Simulator, shows x and y in the viewing plane
but +z going into the screen. And yet another book has (get this!) z going up, y going right, and
x coming toward the viewer. There oughtta be a law....
Figure 2-4. The z-axis comes toward the viewer.
First we’ll look at 3D transformation. Just as the 2D variety was merely adding the
desired deltas to the original location, the same thing goes for 3D. And the matrix that
describes that would look like the following:












1
0 0 1 0
0 1 0 0
1 0 0 0
Tx Ty Tz
T so




































(^11)
0 0 1 0
0 1 0 0
1 0 0 0
1
'
'
'
z
y
x
T T T
z
y
x
x y z
And of course that would yield the following:
x′=x+Tx, y′=y+Ty and z′=z+Tz
Notice the extra 1 that’s been added; it’s the same as for the 2D stuff, so our point
location is now in homogeneous form.
So, let’s take a look at rotation. One can safely assume that if we were to rotate around
the Z-axis (Figure 2-5), the equations would map directly to the 2D versions. Using the

Free download pdf