• Aucun résultat trouvé

Rotation About an Arbitrary Axis

N/A
N/A
Protected

Academic year: 2022

Partager "Rotation About an Arbitrary Axis"

Copied!
9
0
0

Texte intégral

(1)

Rotation About an Arbitrary Axis

9.1 Quick Review

Given a pointP = (x; y; z;1)in homogeneous coordinates, letP0= (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 thex-axis by an angle x, counterclockwise (looking along thex-axis towards the origin). ThenP0=RxPwhere the rotation matrix, Rx,is given by:

Rx= 2 66 4

1 0 0 0

0 cos x sin x 0 0 sin x cos x 0

0 0 0 1

3 77 5

2. Rotation about they-axis by an angle y, counterclockwise (looking along they-axis towards the origin). ThenP0=RyPwhere the rotation matrix, Ry,is given by:

Ry = 2 66 4

cos y 0 sin y 0

0 1 0 0

sin y 0 cos y 0

0 0 0 1

3 77 5

3. Rotation about thez-axis by an angle z, counterclockwise (looking along thez-axis towards the origin). ThenP0=RzP where the rotation matrix, Rz,is given by:

Rz= 2 66 4

cos z sin z 0 0 sin z cos z 0 0

0 0 1 0

0 0 0 1

3 77 5

117

(2)

Note that the above transformations also apply to vectors.

You will also recall that

Rx1 = RTx Ry1 = RTy Rz1 = RTz

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

Rxyz=RxRyRz= 2

4 CyCz CySz Sy

SxSyCz+CxSz SxSySz+CxCz SxCy CxSyCz+SxSz CxSySz+SxCz CxCy

3 5 (9.1)

where

Ci = cos i andSi = sin i fori=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 vectorv= (x; y; z)about a general axis with direction vectorrb (assume br is a unit vector, if not, normalize it) by an angle (see …gure 9.1).

Because it is clear we are talking about vectors, and vectors only, we will omit the arrow used with vector notation.

We begin by decomposingvinto two components: one parallel tobrand one perpendicular tobr. Let us denote vk the component parallel to brand v? the component perpendicular tor. You will recall from our study of vectors thatb

vk = compbrv

= v br kbrk2rb

= (v br)rbsincebris a unit vector Similarly,

v? = orthbrv

= v (v r)b br

(3)

And we have

v=vk+v?

Figure 9.1: Rotation about a general axis through the origin, showing the axis of rotation and the plane of rotation (see [VB1])

LetT denote the rotation we are studying. We need to compute T(v).

T(v) = T vk+v?

= T vk +T(v?) sinceT is a linear transformation. Also,

T vk =vk

(4)

Figure 9.2: Rotation about a general axis through the origin, showing vectors on the plane of rotation (see [VB1])

(5)

since vk has the same direction as brand we are rotating around an axis with direction vectorr(see …gure 9.1). Therefore,b

T(v) =vk+T(v?)

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 …gure 9.1 and 9.2). We will use v? as our …rst basis vector. For our second, we can use

w = br v? (9.2)

= br v Looking at …gure 9.2, we see that

T(v?) = cos v?+ sin w

= cos v?+ sin (br v) and therefore

T(v) = vk+T(v?)

= (v r)b br+ cos v?+ sin (br v)

= (v r)b br+ cos [v (v br)br] + sin (br v)

= (v r)b br+ cos v cos (v br)rb+ sin (rb v)

= (1 cos ) (v br)br+ cos v+ sin (br v)

We would like to express this as a matrix transformation, in other words, we want to …nd the matrix R such that T(v) = Rv. For this, we …rst establish some intermediary results.

Lemma 97 If u= (ux; uy; uz) andv= (vx; vy; vz)then

u v= 2

4 0 uz uy

uz 0 ux

uy ux 0 3 5v Proof.

u v =

i j k ux uy uz

vx vy vz

= 2

4 uyvz uzvy uzvx uxvz uxvy uyvx

3 5

= 2

4 0 uz uy uz 0 ux

uy ux 0 3 5v

(6)

Lemma 98 Using the notation of the previous lemma, we have

(u v)u= 2

4 u2x uxuy uxuz uxuy u2y uyuz

uxuz uyuz u2z 3 5v

Proof.

u v=uxvx+uyvy+uzvz So,

(u v)u = (uxvx+uyvy+uzvz)u

= (uxvx+uyvy+uzvz) 2 4 ux

uy uz

3 5

= 2

4 u2x uxuy uxuz

uxuy u2y uyuz

uxuz uyuz u2z 3 5v

We are now ready to write T(v)as a matrix transformation.

T(v) = (1 cos ) (v r)b br+ cos v+ sin (rb v)

= (1 cos ) 2

4 u2x uxuy uxuz

uxuy u2y uyuz

uxuz uyuz u2z 3 5v+

2

4 1 0 0 0 1 0 0 0 1

3

5cos v+ sin 2

4 0 uz uy

uz 0 ux

uy ux 0 3 5v

= 8<

:(1 cos ) 2

4 u2x uxuy uxuz

uxuy u2y uyuz

uxuz uyuz u2z 3 5+

2

4 1 0 0 0 1 0 0 0 1

3

5cos + sin 2

4 0 uz uy uz 0 ux

uy ux 0 3 5

9=

;v

= 2

4 tu2x+C tuxuy Suz tuxuz+Suy tuxuy+Suz tu2y+C tuyuz Sux

tuxuz Suy tuyuz+Sux tu2z+C 3 5v

where

b

r = (ux; uy; uz) C = cos

S = sin t = 1 cos .

9.3 Assignment

1. Prove that the product of two orthogonal matrices is also an orthogonal matrix.

(7)

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.

(8)

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

(9)

[WG1] Wall, David, and Gri¢ 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.

Références

Documents relatifs

Annales Academie Scientiarum Fennicre Series A. The case a:F:1 is an irrelevant exception to the inequality. Aithough the case a:0 had been treated, we neglected to

Exprime en fonction de x et sous la forme d'une expression simplifiée l'aire du rectangle

Effectue ce programme pour un nombre x de départ et écris une expression simplifiée du résultat en fonction de

Si le conducteur roule à la même vitesse qu'à la question précédente, quelle sera sa distance de freinage.. À quelle vitesse peut-il rouler sans risquer un accident en cas

• Dans le cas particulier de deux vecteurs à trois coordonnées, on constate que le tenseur antisymétrique ainsi associé n'a que trois coordonnées

Please at- tach a cover sheet with a declaration http://tcd-ie.libguides.com/plagiarism/declaration confirming that you know and understand College rules on plagiarism1. On the

This function product is

Degree 3: reducibility for degree 3 is still equivalent to having a root, so we just need to avoid the polynomials with root 0 (constant term 0) and root 1 (sum of coefficients