English subtitles

← Rotation Times Rotation - Interactive 3D Graphics

Get Embed Code
2 Languages

Showing Revision 2 created 05/25/2016 by Udacity Robot.

  1. One reason that we use four by four matrices to store transforms is that a
  2. single matrix can hold any number of transforms at once. As an example, consider
  3. object three D's rotation paratmeter. Here is a snipet of code from the oil
  4. angler demo. The airplane's three rotation axis are already set. This means that
  5. the airplane is first rotated around its z axis then its y axis, then x.
  6. Internally a transform matrix is made for each rotation. Then these are
  7. multiplied together. Matrix multiplication works like this. For each location in
  8. the resulting matrix, you take the corresponding row of the first matrix.
  9. [inaudible] And the column of the second matrix, and perform a dot product
  10. between these two. For example, to compute element n two four, I compute the dot
  11. product of the fourth row of the first matrix, and the second column of the
  12. second matrix. This gives this set of terms here, added together gives n two
  13. four, 16 dot products later and you have the resulting matrix. To multiply
  14. together our three rotation matrices. We can start at either end. Multiplying Rx
  15. by Ry or Ry by Rz. I've decided to start with Ry and Rz. Multiplying these
  16. together we get some temporary matrix U. We can then multiply together the X
  17. rotation matrix by this temporary matrix. This gives us another matrix call it Q
  18. which consists of all three rotation matrices multiplied together. This
  19. resulting matrix Q can then be used to transform coordinates when an object
  20. coordinate is transformed by this single matrix the coordinate in fact is
  21. rotated by the three rotation matrices in turn it's clearly more efficient to
  22. use a single matrix than three. The scale and translation parameters in the
  23. object 3-d class do the same thing. They create matrices and these all get
  24. multiplied together. Here's the full sequence of transforms that happen for an
  25. object 3-d when using its parameters: scale, the 3 rotations, and translate.
  26. Internally, these matrices are all multiplied together to give a single
  27. resulting matrix m. The parameter in the object 3D class, is, in fact, called
  28. matrix. You can now see why I've been listing the order of matrices as from
  29. right to left. As this is the order we use for multiplying them together.
  30. Multiplying matrices together like this is called concatenation.