PDA

View Full Version : Question (3D Math Primer for Graphics and Game Development)

S.A. Lowell
09-05-2008, 12:36 AM
Right now I'm reading the book: 3D Math Primer for Graphics and Game Development. I fully understand everything so far, except one little bit.

the very last step in this image:

img.photobucket.com/albums/v227/DarkRageChaos/Vectors.jpg

Basically. I could use some help in understand the process required to go from the 2nd to last step, to the very last step:

img.photobucket.com/albums/v227/DarkRageChaos/Vectors2.jpg

HallsofIvy
09-05-2008, 10:23 AM
Right now I'm reading the book: 3D Math Primer for Graphics and Game Development. I fully understand everything so far, except one little bit.

the very last step in this image:

img.photobucket.com/albums/v227/DarkRageChaos/Vectors.jpg

Basically. I could use some help in understand the process required to go from the 2nd to last step, to the very last step:

img.photobucket.com/albums/v227/DarkRageChaos/Vectors2.jpg
It's pretty straightforward algebra.

You have a vector with 3 components:
cos(theta)- cos(theta)n_x^2+nx^2
-n_xn_ycos(theta)+ n_z sin(theta)+ n_xn_y
-n_xn_zcos(theta)- n_y sin(theta)+ n_xn_z

Look at each separately.

We can rearrange
cos(theta)- cos(theta)n_x^2+nx^2 to
(n_x^2- cos(theta)n_x^2)+ cos(theta)
so that the first terms have n_x^2 in common. Factor that out:
(1- cos(theta))n_x^2+ cos(theta)
which is the first row in the next line.

Rearrange
-n_xn_ycos(theta)+ n_z sin(theta)+ n_xn_y to
(n_xn_y- n_xn_y cos(theta))+ n_z sin(theta)
and now the first terms have n_xn_y in common. Factor that out:
(1- cos(theta))n_xn_y+ n_z sin(theta)
which is the second row on the next line.

Finally, rearrange
-n_xn_zcos(theta)- n_y sin(theta)+ n_xn_z to
(n_xn_z- n_xn_z cos(theta))- n_y sin(theta)
and now the first two terms have n_xn_z in common. Factor that out:
(1- cos(theta))n_xn_z- n_y sin(theta)
which is the third row on the next line.

S.A. Lowell
09-05-2008, 04:07 PM
Wow uhh... after reading what you responded with, I had the biggest "DUH" moment of my life O_o. Thank you for taking the time to explain.