Tansfomations in Homogeneous Coodinates (Com S 4/ Notes) Yan-Bin Jia Aug 4 Complete Section 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 abcdefghk 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(uvw) of (uvw). Thus L(uvw) and L(uvw) 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.
. 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: a Tans(abc) = b c. The point p = (z) T is tanslated to the point p = Tans(abc)p a = b c = +a +b z +c Accodingl the point (z) T in the Catesian space is tanslated to (+a +bz +c) T. 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. 4 8 8 4 4 4.
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 (ab) (θ) = Tans(ab)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 p4 = ( ). 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. Thus the new vetices ae p (.99.99 Rot () (π/4) = + Appl the tansfomation above to the homogeneous coodinates of the vetices: + = +.99.99.88.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 ). Rigid Bod Tansfomation in Two Dimensions A igid bod consists of paticles whose elative distances do not change as the move. A igid bod tansfomation is an change of position which peseves the elative distance of all the points of the bod. An igid bod tansfomation is composed of a otation about some efeence point p = ( ) T and a tanslation of the efence point. In this section we will tempoail evet back to the use of Catesian coodinates. Let ( ) cosθ sinθ R(θ) = sinθ cosθ 4.
p q p R(p q )+b b q p p R Figue : Rotation independent of the efeence point in a igid bod tansfomation. be the otation mati and b = (b b ) T be the tanslation vecto. Then a point p is tansfomed into p = R(p p )+p +b. It tuns out that the otation pat of a igid bod tansfomation does not depend on the efeence point chosen. Suppose that a diffeent point q has been chosen as the efeence point. Then we ewite p = R(p q +q p )+p +b = R(p q )+q +c whee c = R(q p )+p q +b is the new tanslation vecto. The same tansfomation fom p to p can also be egaded as a tanslation followed b a otation fo we have p = R(p p +R b) = R(p+e ) whee e = p +R b is the tanslation and the otation is about the new efeence point. Since otation does not depend on the choice of efeence point and it can be made befoe tanslation we choose the oigin as the efeence point and epesent a igid bod tansfomation as T : p Rp+b. If the igid bod tansfomation T is in the plane it is called a plana displacement. Suppose that T contains a otation though the angle θ with θ. Thee eists a point s that does not move unde the tansfomation. It is obtained fom solving the equation s = Rs+b: s = (I R) b whee is the identit mati and I = ( ) ( cosθ sinθ R = sinθ cosθ )
is the otation mati. We can easil veif that the mati I R has deteminant cosθ which is non-zeo since cosθ. The fied point s called the pole eists unless T is a pue tanslation. 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. 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(hk) = Tans( h k) Rot(θ) = 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(hk) followed b a scaling Scale(s s ) has the homogeneous tansfomation mati Scale(s s ) Tans(hk) 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 6
mati poduct: L = ( ) Tans( ) Rot( π/) = Rot( π/) Tans( ) = Rot(π/) Tans( ) = + +. 4 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 (abc) = 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. Rotations about the Coodinate Aes Like a otation in theplane 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 (θ ) = Rot (θ ) = Rot z (θ z ) =. cosθ sinθ sinθ cosθ cosθ sinθ sinθ cosθ cosθ z sinθ z sinθ z cosθ z Figue 4(a) shows the diection in which the pima otations take when the otation angle is positive. Figue 4(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) =. =. 8
z θ z z θ θ (a) Figue 4: Rotations about the coodinate aes. (b) 6 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 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 (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 : Rotation about an abita ais pefomed b tansfoming the ais to the z-ais appling the otation and tansfoming back to the oiginal ais. 9
is aligned with the -ais and θ =. Othewise we have sinθ = cosθ = (4) +. () + Thedesiedotation Rot (θ )maps tothepoint = ( + )showninfigue(b).. Rotate the vecto about the -ais to align it with the z-ais. This step is shown in Figue (b). The equied angle is found to be θ whee sinθ = cosθ = (6) + + +. () + + 4. Appl a otation though an angle θ about the z-ais as shown in Figue (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 ) (8) whee sinθ cosθ sinθ and cosθ ae given in (4) () 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θ + cosθ sinθ + 6 cosθ 6 sinθ 6 sinθ + cosθ + 6 = cosθ sinθ sinθ cosθ 6 cosθ+ 6 sinθ 6 8 8 cosθ cosθ sinθ 8 9 cosθ+ 6 sinθ + 8 sinθ + 9 8 cosθ + 8 4 sinθ cosθ + 9 cosθ+ sinθ +.
A 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 = (abc).. Then following steps of the method of geneal otation in Section 6 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 (4) and () espectivel. Meanwhile cosθ and sinθ ae given b (6) and ().. 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 ). (9) 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 (9) 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 (9) becomes
4 8 8 4 4 4 8 4 8 9 = 9 We can simpl emovethe multiplie 9 in font ofthe mati abovesince homogeneouscoodinates aeused. 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. http://mathwold.wolfam.com/euleangles.html.