Gaal 2/22 KOMPUTER GRAFIK (3SKS) CucunVer Angkoo,ST,MT :: Pertemuan ke :: General Tranformation A tranformation map point to other point and/or ector to other ector QT(P) 3 TRANSFORMASI 2D A Matrik Tranformai dan Koordinat Homogen Kombinai bentuk perkalian dan tranlai untuk tranformai geometri 2D ke dalam uatu matrik dilakukan dengan mengubah matrik 2 x 2 menjadi matrik 3 x 3 A Matrik Tranlai ' tx t P T(tx, t) P Untuk itu maka koordinat carteian (x,) dinatakan dalam bentuk koordinat homogen (xh, h, h), dimana : x xh / h h / h Dimana untuk geometri 2D parameter h biaana h, ehingga etiap poii koordinat 2D dapat dinatakan dengan (x,,) A2 Matrik Rotai co in ' in co P R() P Untuk tranformai 3D biaana parameter h Dengan menatakan poii titik dalam koordinat homogen, emua tranformai geometri dinatakan dalam bentuk matrik Koordinat dinatakan dalam tiga elemen ektor kolom dan operai tranformai dituli dengan matrik 3x3 A3 Matrik Skala x ' P S(x, ) P
Pipeline Implementation u u T tranformation (from application program) raterizer ertice ertice pixel frame buffer Rotation (2D) Conider rotation about the origin b degree } radiu ta the ame, angle increae b x r co (φ + ) r in (φ + ) x x co in x in + co x r co φ r in φ 5 7 Tranlation Matrix We can alo expre tranlation uing a 4 x 4 matrix T in homogeneou coordinate p Tp where dx d T T(d x, d, d z ) d z Thi form i better for implementation becaue all affine tranformation can be expreed thi wa and multiple tranformation can be concatenated together Rotation about the z axi } Rotation about z axi in three dimenion leae all point with the ame z } Equialent to rotation in two dimenion in plane of contant z x x co in x in + co z z } or in homogeneou coordinate p R z ()p 6 8
Rotation Matrix Scaling Expand or contract along each axi (fixed point of origin) R R z () co in in co x x x x z z x p Sp S S( x,, z ) x z 9 Rotation about x and axe } Same argument a for rotation about z axi } For rotation about x axi, x i unchanged } For rotation about axi, i unchanged Reflection correpond to negatie cale factor R R x () co -in in co x - original R R () co - in in co x - - x - 2
Inere } Although we could compute inere matrice b general formula, we can ue imple geometric oberation } Tranlation: T - (d x, d, d z ) T(-d x, -d, -d z ) } Rotation: R - () R(-) } Hold for an rotation matrix } Note that ince co(-) co() and in(-)-in() R - () R T () } Scaling: S - ( x,, z ) S(/ x, /, / z ) Order of Tranformation } Note that matrix on the right i the firt applied } Mathematicall, the following are equialent p ABCp A(B(Cp)) } Note man reference ue column matrice to repreent point In term of column matrice p T p T C T B T A T 3 5 Concatenation } We can form arbitrar affine tranformation matrice b multipling together rotation, tranlation, and caling matrice } Becaue the ame tranformation i applied to man ertice, the cot of forming a matrix MABCD i not ignificant compared to the cot of computing Mp for man ertice p } The difficult part i how to form a deired tranformation from the pecification in the application 4 General Rotation About the Origin A rotation b about an arbitrar axi can be decompoed into the concatenation of rotation about the x,, and z axe R() R z ( z ) R ( ) R x ( x ) x z are called the Euler angle Note that rotation do not commute We can ue rotation in another order but with different angle z 6 x
Rotation About a Fixed Point other than the Origin Moe fixed point to origin Rotate Moe fixed point back M T(p f ) R() T(-p f ) Shear } Helpful to add one more baic tranformation } Equialent to pulling face in oppoite direction 7 9 Intancing } In modeling, we often tart with a imple object centered at the origin, oriented with the axi, and at a tandard ize } We appl an intance tranformation to it ertice to Scale Orient Locate 8 Shear Matrix Conider imple hear along x axi x x + cot z z H() cot 2