# CG Lecture 9, Mon 2016-09-19

1. Handwritten notes on viewgraph from 09-15.
2. This Wed will be used for me to demo some more WebGL stuff, and to answer questions.
3. Error in slide 12 of 14_1_5: d is reasonably positive, so zp= -d. (If d were negative, then the other two formulae would be wrong.)
4. Reminder that there will be no classes on Oct 5 or 7. (This is listed in the Google calendar).
5. Iclicker questions.
6. We'll continue with the textbook powerpoint slides.
1. 3_6, Programming with WebGL Part 6: Three Dimensions. This mentions the depth buffer.
7. Continue My note on 3D rotation.
8. My note on quaternions. This is an alternative method to rotate in 3D. Its advantages are:
1. It starts from the intuitive axis-angle API.
2. Animating a large rotation in small steps (by varying the angle slowly) is easy. In contrast, stepping the 3 Euler angles does not work well, and there's no obvious way to gradually apply a $3\times3$ rotation matrix, $M$. (You could compute $M^{1/100}$ and apply it 100 times, but that computation is messy. Eigenvectors are useful here.)
3. When combining multiple rotations, the axis and angle of the combo is easy to find.
4. Having only 4 parameters to represent the 3 degrees of freedom of a 3D rotation is the right number. Using only 3 parameters, as Euler angles do, causes gimbal lock. That is, you cannot always represent a smooth rotation by smooth changes of the 3 parameters. OTOH, using 9 parameters, as with a matrix, gives too much opportunity for roundoff errors causing the matrix not to be exactly a rotation. (You can snap the matrix back to a rotation matrix, but that's messy.)
9. CGI Realtime HD: "From Previs to Final in 5 Minutes: Siggraph 2016 Presentation" - by Ninja Theory