1 Tansfomations in Homogeneous Coodinates (Com S 4/ Notes) Yan-Bin Jia Aug, 6 Homogeneous Tansfomations A pojective tansfomation of the pojective plane is a mapping L : P P defined as u a b c u au + bv + cw v d e f v = du + ev + fw, () w g h k w gu + hv + kw whee a,b,c,d,e,f,g,h,k R. The mati epesenting the mapping L of the pojective plane is called a homogeneous tansfomation mati. When g = h = and k, the mapping L is an affine tansfomation intoduced in the pevious lectue. Affine tansfomations coespond to tansfomations of the Catesian plane. Note that homogeneous coodinates (u,v,w) unde the mapping () has image au + bv + cw du + ev + fw gu + hv + kw A division b gives the image L(u,v,w) of (u,v,w). Thus L(u,v,w) and L(u,v,w) ae equivalent and coespond to the same point in homogeneous coodinates. Theefoe the definition of a tansfomation does not depend on the choice of homogeneous coodinates fo a given point. A tansfomation of the pojective space is a mapping M : P P given b s u v w. m m m m 4 m m m m 4 m m m m 4 m 4 m 4 m 4 m 44 The 4 4 mati (m ij ) is called the homogeneous tansfomation mati of M. If the mati is nonsingula, then M is called a non-singula tansfomation. If m 4 = m 4 = m 4 = and m 44, then M is said to be an affine tansfomation. Affine tansfomations coespond to tanslations, scalings, otations, eflections, etc. of the thee-dimensional space. Appendices ae optional fo eading unless specificall equied. s u v w.
2 . Tanslation and Scaling We fist descibe the homogeneous tansfomation matices fo tanslations and scalings, in the plane and the space. Let us stat with tanslation: h Tans(h, k) = k. Then h k = + h + k which veifies that the point (,) is tanslated to ( + h, + k). A tanslation b a, b, c in the -, -, and z-diections, espectivel, has the tansfomation mati: Tans(a,b,c) = The point p = (,,z,) is tanslated to the point p a b c = Tans(a,b,c)p a = b c = + a + b z + c Accodingl, the point (,,z) in the Catesian space is tanslated to ( + a, + b,z + c). The homogeneous scaling mati is s Scale(s,s ) = s. Then s s. = Eample. The unit squae with vetices (, ), (, ), (, ), and (, ) is scaled about the oigin b factos of 4 and in the - and - diections, espectivel. We have 4 = z s s,..
3 So the image is a squae with vetices (4, ), (8, ), (8, 4), and (4, 4). A scaling about the oigin b factos s /s w, s /s w, and s z /s w in the -, -, and z-diections, espectivel, has the tansfomation mati (often, s w is chosen to be ): s Scale(s,s,s z,s w ) = s s z. s w Simila to the cases of tanslation and scaling, the tansfomation mati fo a plana otation about the oigin though an angle θ is cos θ sinθ Rot(θ) = sinθ cos θ.. Plana Rotation about a Point A otation though an angle θ about a point (a,b) is obtained b pefoming a tanslation which maps (a,b) to the oigin, followed b a otation though an angle θ about the oigin, and followed b a tanslation which maps the oigin to (a,b). The otation mati is Rot (a,b) (θ) = Tans(a,b)Rot(θ)Tans( a, b) a cos θ sinθ = b sin θ cos θ = cos θ sinθ acos θ + bsin θ + a sinθ cos θ asin θ bcos θ + b a b. () Eample. A squae has vetices p = (, ), p = (, ), p = (, ), and p 4 (, ). Detemine the new vetices of the squae afte a otation about p though an angle of π/4. The tansfomation mati is p 4 p 4 p p p p p, p Figue : Rotation about p. Rot (,) (π/4) = + Appl the tansfomation above to the homogeneous coodinates of the vetices: + =
4 Thus the new vetices ae p (.99,.99), p = (, ), p (.99,.), and p 4 (.88,.), as illustated in Figue.. Application Instancing A geometic object is ceated b defining its components. Fo eample, the font of a house in Figue consists of ectangles, which fom the walls, windows, and doo of the house. The ectangles ae scaled fom a squae, which is an eample of a pictue element. Fo convenience, pictue elements ae defined in thei own local coodinate sstems, and ae constucted fom gaphical pimitives which ae the basic building blocks. Pictue elements ae defined once but ma be used man times in the constuction of objects. Fo eample, a squae with vetices (,), (,), (,), and (,) can be obtained using the gaphical pimitive Line fo the line segment joining the points (, ) and (, ) though otations and tanslations. A tansfomed cop of a gaphical pimitive doo Figue : Font of a house obtained fom instances of squae and point. o pictue element is efeed to as an instance. The afoementioned squae, denoted Squae, is defined b fou instances of the line. The completed eal object is defined in wold coodinates b appling a tansfomation to each pictue element. The house in the figue is defined b si instances of the pictue element Squae, and one instance of the pimitive Point (fo the doo handle). In paticula, the font doo is obtained fom Squae b appling a scaling of. unit in the -diection, followed b a tanslation of units in the -diection and unit in the -diection. In homogeneous coodinates, the tansfomation mati is given b Tans(,) Scale(.,) =. =. The vetices of the doo ae obtained b appling the above tansfomation mati to the vetices of the Squae pimitive, giving... =. So the vetices of the doo in wold coodinates ae (,), (.,), (.,), and (,).. Invese Tansfomations The identit tansfomation I is the tansfomation that leaves all points of the plane unchanged. Moe pecisel, I is the tansfomation fo which I L = L I = L, fo an plana tansfomation L. The tansfomation mati of the identit tansfomation in homogeneous coodinates is the identit mati I. The invese of a tansfomation L, denoted L, maps images of L back to the oiginal points. Moe pecisel, the invese L satisfies that L L = L L = I. 4
5 Lemma Let T be the mati of the homogeneous tansfomation L. If the invese tansfomation L eists, then T eists and is the tansfomation mati of L. Convesel, if T eists, then the tansfomation epesented b T is the invese tansfomation of L. Poof Suppose L has an invese L with tansfomation mati R. The concatenations L L and L L must be identit tansfomations. Accodingl, the tansfomation matices TR and RT ae equal to I. Thus R is the invese of mati T, that is, R = T. Convesel, suppose the mati T has an invese T, which defines a tansfomation R. Since T T = TT = I, it follows that R L and L R ae the identit tansfomation. B definition, R is the invese tansfomation. We easil obtain the inveses of tanslation, otation, and scaling: Tans(h,k) Rot(θ) = Tans( h, k), = Rot( θ), Scale(s,s ) = Scale(/s,/s ). A tansfomation L : P P with an invese L is called a non-singula tansfomation. Lemma implies that a tansfomation is non-singula if and onl if its tansfomation mati is non-singula. Non-singula matices A and B satisfies (AB) = B A. In homogeneous coodinates, the concatenation of tansfomations T and T, denoted T T, can be caied out with mati multiplications alone. Fo eample, a otation Rot(θ) about the oigin followed b a tanslation Tans(h,k) followed b a scaling Scale(s,s ) has the homogeneous tansfomation mati Scale(s,s ) Tans(h,k) Rot(θ) = = s s h k s cos θ s sin θ s h s sinθ s cos θ s k cos θ sin θ sin θ cos θ Eample. Detemine the tansfomation mati of the invese of the concatenation of tansfomations Tans(, ) Rot( π/). The tansfomation mati L of the invese is the invese of the coesponding mati poduct: L = ( ) Tans(, ) Rot( π/) = Rot( π/) Tans(, ) = Rot(π/) Tans(, ) + = +.
6 Reflection in an Abita Line How to detemine the tansfomation mati fo eflection in an abita line a + b + c =? If c = and eithe a = o b =, then it is the eflection in eithe - o -ais that we consideed befoe. The mati is o. () In geneal, the eflection is obtained b tansfoming the line to one of the aes, eflecting in that ais, and then taking the invese of the fist tansfomation. Suppose b. Moe specificall, the eflection is accomplished in the following five steps:. The line intesects the -ais in the point (, c/b).. Make a tanslation that maps (, c/b) to the oigin.. The slope of the line is tan θ = a/b, whee the angle θ made b the line with the -ais emains the same afte the tanslation. Rotate the line about the oigin though an angle θ. This maps the line to the -ais. 4. Appl a eflection in the -ais.. Rotate about the oigin b θ and then tanslate b (, c/b). The concatenation of the above tansfomation is cos θ sinθ c/b sinθ cos θ = cos θ sin c θ sin θ cos θ b sin θ cos θ sin θ cos θ sin θ cos θ c b cos θ. cos θ sinθ sinθ cos θ c/b Since tan θ = a/b, it follows that cos θ = /( + tan θ) = b /(a + b ) and sin θ = cos θ = a /(a + b ). So sin θ cos θ = tan θ cos θ = ab/(a + b ). Substituting these epessions into (4) ields b a a +b ab a +b ab a +b a b a +b ac a +b bc a +b In homogeneous coodinates, multiplication b a facto does not change the point. So the above mati can be scaled b a facto a + b to emove all the denominatos in the enties, ielding the eflection mati b a ab ac Ref (a,b,c) = ab a b bc. a + b Note that the above mati agees with () in the cases of eflection in - and -aes. Thus we have emoved the assumption b made fo deiving the eflection mati. 6.
7 4 Reflection in an Abita Plane Reflection in a plane a+b +cz +d = is obtained b tansfoming the eflection plane to one of the -, z-, o z-planes, eflecting in that plane, and finall tansfoming the plane back to the eflection plane. In this appendi, we ae back to the use of homogeneous coodinates so all the matices ae 4 4. Moe specificall, the tansfomation is obtained in the following steps.. Choose a point p = (p,p,p ) on the plane. Tanslate this point to the oigin so that the eflection plane becomes a + b + cz =. Denote = (a,b,c).. Then following steps of the method of geneal otation in Section A thee ae two angles θ and θ such that the composition of otations Rot ( θ ) Rot (θ ) aligns the vecto with the z-ais, and maps the tanslated eflection plane to the -plane. We have θ = if = = ; othewise, sinθ and cos θ ae defined in () and (6), espectivel. Meanwhile, cos θ and sin θ ae given b () and (8).. Appl the eflection in the -plane. 4. Appl the invese of the tansfomations in steps in evese ode. The geneal eflection mati is thus Tans(p,p,p )Rot ( θ )Rot (θ )Ref Rot ( θ )Rot (θ )Tans( p, p, p ). (4) We can easil veif the above eflection mati in the special cases whee the plane is paallel to the z-plane, -plane, o z-plane. In the fist case, the mati (4) educes to Tans(p,p,p )Ref z Tans( p, p, p ). Eample 6. Let us detemine the tansfomation mati fo a eflection in the plane + z =. Pick a point, sa, (,, ), in the plane and tanslate it to the oigin. The tanslated plane is +z = which has a nomal (,, ). Net, we detemine that sin θ =, cosθ =, sin( θ ) = sin θ =. cos( θ ) = cosθ =. The eflection mati (4) becomes
8 = 9 We can simpl emove the multiplie 9 in font of the mati above since homogeneous coodinates ae used. Rotations about the Coodinate Aes Like a otation in the plane, a otation in the space takes about a line efeed to as its otation ais. An otation can be decomposed into thee pima otations about the -, and -, and z-aes: Rot (θ ) = cos θ sinθ sin θ cos θ, Rot (θ ) = Rot z (θ z ) = cos θ sin θ sinθ cos θ cos θ z sin θ z sin θ z cos θ z Figue (a) shows the diection in which the pima otations take when the otation angle is positive. Figue (b) is a mnemonic that helps to emembe the diections. Fo instance, the positive sense of a otation about the -ais has the effect of moving points on the z-ais towad the -ais. Eample 4. A otation though an angle π/6 about the -ais followed b a tanslation b,, espectivel along the -, -, and z-aes has the tansfomation mati Tans(,, )Rot (π/6) = =.,. A Rotation about an Abita Line When the otation ais is an abita line, we obtain the tansfomation mati as follows. Fistl, tansfom the otation ais to one of the coodinate aes. Secondl, pefom a otation of the 8
9 z θ z z θ θ (a) Figue : Rotations about the coodinate aes. (b) equied angle θ about the coodinate ais. Finall, tansfom the coodinate ais back to the oiginal otation ais. Moe specificall, let the otation ais be the line l though the points p = (p,p,p ) and q = (q,q,q ). Denote = q p = (,, ). Then we pefom the following steps:. Tanslate the point p b ( p, p, p ) to the oigin O and the otation ais to the line O though O and the point.. Rotate the vecto about the -ais until it lies in the z-plane. This is shown in Figue 4(a). Suppose that the line O makes an angle θ with the z-plane. If = =, then the line z z z θ p q θ θ θ θ O θ (a) (b) (c) Figue 4: Rotation about an abita ais pefomed b tansfoming the ais to the z-ais, appling the otation, and tansfoming back to the oiginal ais. is aligned with the -ais and θ =. Othewise, we have sinθ =, () + cos θ =. (6) + 9
10 The desied otation Rot (θ ) maps to the point = (,, + ) shown in Figue 4(b).. Rotate the vecto about the -ais to align it with the z-ais. This step is shown in Figue 4(b). The equied angle is found to be θ whee sinθ = cos θ = + +, () (8) 4. Appl a otation though an angle θ about the z-ais, as shown in Figue 4(c).. Appl the inveses of the tansfomations in steps in evese ode. Thus, the geneal otation though an angle θ about the line though two points p = (p,p,p ) and q = (q,q,q ) has the tansfomation mati Tans(p,p,p )Rot ( θ )Rot (θ )Rot z (θ)rot ( θ )Rot (θ )Tans( p, p, p ), (9) whee sin θ, cos θ, sinθ, and cos θ ae given in () (8) with (,, ) = q p. Eample. Compute the tansfomation mati of the otation though an angle θ about the line though the points p = (,, ) and q = (4,, ). We have = q p = (, 6, ). So + =, and sinθ =, cosθ =, sin θ =, and cosθ =. The otation mati is 4 cosθ + 4 cosθ sin θ + 6 cosθ 6 sin θ 6 cosθ + sin θ + cosθ + 6 = cosθ sinθ sinθ cosθ 6 cosθ + 6 sin θ 6 8 cosθ 8 cosθ 8 sin θ 9 cosθ + 6 sin θ + 8 sin θ cosθ sin θ cosθ + 9 cosθ + sin θ +. Refeences  D. Mash. Applied Geomet fo Compute Gaphics and CAD. Spinge-Velag, 999.  J. Caig. Intoduction to Robotics: Mechanics and Contol. nd ed., Addison-Wesle, 989.  Wolfam MathWold.