
Chapter 9 Rotation About an Arbitrary Axis 9.1 Quick Review Given a point P = (x, y, z, 1) in homogeneous coordinates, let P 0 = (x0, y0, z0, 1) be the corresponding point after a rotation around one of the coordinate axis has been applied. You will recall the following from our studies of transformations: 1. Rotation about the x-axis by an angle x, counterclockwise (looking along the x-axis towards the origin). Then P 0 = RxP where the rotation matrix, Rx,is given by: 1 0 0 0 0 cos x sin x 0 Rx = 2 3 0 sin x cos x 0 6 0 0 0 1 7 6 7 4 5 2. Rotation about the y-axis by an angle y, counterclockwise (looking along the y-axis towards the origin). Then P 0 = RyP where the rotation matrix, Ry,is given by: cos y 0 sin y 0 0 1 0 0 Ry = 2 3 sin y 0 cos y 0 6 0 0 0 1 7 6 7 4 5 3. Rotation about the z-axis by an angle z, counterclockwise (looking along the z-axis towards the origin). Then P 0 = RzP where the rotation matrix, Rz,is given by: cos z sin z 0 0 sin cos 0 0 R = z z z 2 0 0 1 0 3 6 0 0 0 1 7 6 7 4 5 117 118 CHAPTER 9. ROTATION ABOUT AN ARBITRARY AXIS Note that the above transformations also apply to vectors. You will also recall that 1 T Rx = Rx 1 T Ry = Ry 1 T Rz = Rz This means in particular that these matrices are orthogonal. It can also be proven that the product of two orthogonal matrices is itself an orthogonal matrix (see problems at the end of the chapter). So, if we combine several rotations about the coordinate axis, the matrix of the resulting transformation is itself an orthogonal matrix. One way of implementing a rotation about an arbitrary axis through the origin is to combine rotations about the z, y, and x axes. The matrix of the resulting transformation, Rxyz, is CyCz CySz Sy Rxyz = RxRyRz = SxSyCz + CxSz SxSySz + CxCz SxCy (9.1) 2 3 CxSyCz + SxSz CxSySz + SxCz CxCy 4 5 where Ci = cos i and Si = sin i for i = x, y, z From what we noticed above, Rxyz is an orthogonal matrix. This means that its inverse is its transpose. 9.2 Rotation About an Arbitrary Axis Through the Origin Goal: Rotate a vector v = (x, y, z) about a general axis with direction vector r (assume r is a unit vector, if not, normalize it) by an angle (see figure 9.1). Because it is clear we are talking about vectors, and vectors only, we will omitb the arrowb used with vector notation. We begin by decomposing v into two components: one parallel to r and one perpendicular to r. Let us denote v the component parallel to r and v the k ? component perpendicular to r. You will recall from our study of vectorsb that b b v = comprv k b v r = · rb r 2 k k = (v br) r since r is a unit vector · b b Similarly, b b b v = orthrv ? = v (v r) r b · b b 9.2. ROTATION ABOUT AN ARBITRARY AXIS THROUGH THE ORIGIN119 And we have v = v + v k ? Figure 9.1: Rotation about a general axis through the origin, showing the axis of rotation and the plane of rotation (see [VB1]) Let T denote the rotation we are studying. We need to compute T (v). T (v) = T v + v k ? = T v + T (v ) k ? since T is a linear transformation. Also, T v = v k k 120 CHAPTER 9. ROTATION ABOUT AN ARBITRARY AXIS Figure 9.2: Rotation about a general axis through the origin, showing vectors on the plane of rotation (see [VB1]) 9.2. ROTATION ABOUT AN ARBITRARY AXIS THROUGH THE ORIGIN121 since v has the same direction as r and we are rotating around an axis with directionk vector r(see figure 9.1). Therefore, T (v) =b v + T (v ) b k ? So, T (v ) is the only quantity we need to compute. For this, we create a two dimensional? basis in the plane of rotation (see figure 9.1 and 9.2). We will use v as our first basis vector. For our second, we can use ? w = r v (9.2) ? = r v b Looking at figure 9.2, we see that b T (v ) = cos v + sin w ? ? = cos v + sin (r v) ? and therefore b T (v) = v + T (v ) k ? = (v r) r + cos v + sin (r v) · ? = (v r) r + cos [v (v r) r] + sin (r v) · · = (v rb) rb+ cos v cos (v br) r + sin (r v) · · = (1 bcosb )(v r) r + cosbvb + sin (rb v) · b b b b b We would like to express this as a matrix transformation, in other words, we want to find the matrix R such thatbTb(v) = Rv. For this,b we first establish some intermediary results. Lemma 97 If u = (ux, uy, uz) and v = (vx, vy, vz) then 0 uz uy u v = uz 0 ux v 2 3 uy ux 0 4 5 Proof. i j k u v = ux uy uz vx vy vz uyvz uzvy = uzvx uxvz 2 3 uxvy uyvx 4 0 uz 5uy = uz 0 ux v 2 3 uy ux 0 4 5 122 CHAPTER 9. ROTATION ABOUT AN ARBITRARY AXIS Lemma 98 Using the notation of the previous lemma, we have 2 ux uxuy uxuz 2 (u v) u = uxuy uy uyuz v · 2 2 3 uxuz uyuz uz 4 5 Proof. u v = uxvx + uyvy + uzvz · So, (u v) u = (uxvx + uyvy + uzvz) u · ux = (uxvx + uyvy + uzvz) uy 2 3 uz 2 4 5 ux uxuy uxuz 2 = uxuy uy uyuz v 2 2 3 uxuz uyuz uz 4 5 We are now ready to write T (v) as a matrix transformation. T (v) = (1 cos )(v r) r + cos v + sin (r v) · 2 ux uxuy uxuz 1 0 0 0 uz uy 2 = (1 cos ) uxbuby uy uyuz bv + 0 1 0 cos v+ sin uz 0 ux v 2 2 3 2 3 2 3 uxuz uyuz u 0 0 1 uy ux 0 z 4 2 5 4 5 4 5 ux uxuy uxuz 1 0 0 0 uz uy 2 = (1 cos ) uxuy uy uyuz + 0 1 0 cos + sin uz 0 ux v 8 2 2 3 2 3 2 39 uxuz uyuz u 0 0 1 uy ux 0 < z = 2 4 5 4 5 4 5 tux + C tuxuy Suz tuxuz + Suy : 2 ; = tuxuy + Suz tuy + C tuyuz Sux v 2 2 3 tuxuz Suy tuyuz + Sux tu + C z 4 5 where r = (ux, uy, uz) C = cos Sb = sin t = 1 cos . 9.3 Assignment 1. Prove that the product of two orthogonal matrices is also an orthogonal matrix. 9.3. ASSIGNMENT 123 2. Prove equation 9.1 3. Prove equation 9.2 4. How would you implement rotation about an axis not going through the origin? First, consider the cases in which the axis of rotation is parallel to one of the coordinate axes. Then, consider the general case. In each case, derive the corresponding transformation matrix. Bibliography [BF1] Burden, Richard L., and Faires, Douglas J., Numerical Analy- sis,Brooks/Cole, sixth edition, 1997. [BG1] Burger, Peter, and Gillies, Duncan, Interactive Computer Graphics, Addison-Wesley, 1990. [DD1] Deitel, H.M., and Deitel, P. J., Java, How to Program, Prentice Hall, 1999. [DP1] Dunn, Fletcher and Parberry, Ian, 3D Math Primer for Graphics and Game Development, Wordware Publishing, Inc., 2002. [FD1] Foley, J.D., Van Dam, A., Feiner, S.K., and Hughes, J.F., Computer Graphics, Principles and Practices, Addison-Wesley, 1995. [FD2] Foley, J.D., Van Dam, A., Feiner, S.K., Hughes, J.F., and Philipps, R.L., Introduction to Computer Graphics, Addison-Wesley, 1997. [H1] Hill, F.S. JR., Computer Graphics Using Open GL, Prentice Hall, 2001. [LE1] Lengyel, Eric, Mathematics for 3D Game Programming & Computer Graphics, Charles River Media, Inc., 2002. [SH1] Schildt, Herbert, Java2, The Complete Reference, McGraw-Hill, 2001 [SE1] Schneider, Philip J., and Eberly, David H., Geometric Tools for Computer Graphics, Morgan Kaufman Publishers, 2003. [SP1] Shirley, Peter, Fundamentals of Computer Graphics, A K Peters, 2002. [SJ1] Stewart, James, Calculus, Concepts and Contexts, second edition, Brooks/Cole, 2001. [TC1] Tremblay, Christopher, Mathematics for Game Developers, Thomson Course Technology, 2004. [VB1] Van Verth, James M. and Bishop Lars M., Essential Mathematics For Games and Interactive Applications, A Programmer’s Guide, Morgan Kaufmann Publishers, 2004. 133 134 BIBLIOGRAPHY [WG1] Wall, David, and Griffi th, Arthur, Graphics Programming with JFC, Wiley, 1999. [AW1] Watt, Alan, 3D Computer Graphics, Addison-Wesley, 2000. [AW2] Watt, Alan, The Computer Image, Addison-Wesley, 1999..
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages9 Page
-
File Size-