CS5600 1Transformations ICS5600Computer GraphicsbyRich Riesenfeld27 February 2002Lecture Set 5CS56002Transformations and Matrices• Transformations are functions• Matrices are functions representations• Matrices represent linear transf’s•{}{ }s'TransfLinear 2Matrices22 Dx ⇔CS5600 2CS56003What is a 2D Linear Transf ?Recall from Linear Algebra: . and vectorsand ascalar for ,)()()(:yxyTxaTyxaTDefinition+=+CS56004Example: Scale in x()),2(),2(),(2:say 2,by in x, Scale11001010yxyxyyxx+=++CS5600 3CS56005Example: Scale in x by 2What is the graphical view?CS56006),00( yx),002( yx),11( yx),112( yxScale in x by 2yxCS5600 4CS56007xy),002( yx),112( yx()yyxx1010,22 ++()yyxx1010,22 ++CS56008y),00( yx),11( yx()yyxx1010),(2++()yyxx1010),(++()yyxx1010),(2 ++xCS5600 5CS56009y()yyxx1010),(2++()yyxx1010),(++()yyxx1010),(2 ++yxCS560010Summary on Scale• “Scale then add,” is same as• “Add then scale”CS5600 6CS560011Matrix Representation»¼º«¬ª=»¼º«¬ª»¼º«¬ªyxyx 21002Scale in x by 2:CS560012Matrix Representation»¼º«¬ª=»¼º«¬ª»¼º«¬ªyxyx22001Scale in y by 2:CS5600 7CS560013Matrix Representation»¼º«¬ª=»¼º«¬ª=»¼º«¬ª»¼º«¬ªyxyxyx2222002Overall Scale by 2:CS560014Matrix RepresentationShowing Same»¼º«¬ª++=»¼º«¬ª++=»¼º«¬ª++»¼º«¬ª)(22)()(21002101010101010yyxxyyxxyyxxCS5600 8CS560015What about Rotation?Is it linear?CS560016Rotate by θxyθθ)0,1()1,0(CS5600 9CS560017θsin°°¿°°¾½Rotate by : 1stQuadrantθxyθ)0,1()sin,(cosθθ θcos CS560018Rotate by : 1stQuadrantθ)sin,(cos)0,1(θθCS5600 10CS560019Rotate by : 2ndQuadrant θxyθθ)1,0()0,1(CS560020Rotate by : 2ndQuadrant θxyθ°¯°®θcos θsin θ)1,0(CS5600 11CS560021Rotate by : 2ndQuadrantθ)cos,sin()1,0(θθ−CS560022Summary of Rotation by)sin,(cos)0,1(θθ)cos,sin()1,0(θθ−θCS5600 12CS560023Summary (Column Form)¸¸¹·¨¨©§−¸¸¹·¨¨©§θθcossin10¸¸¹·¨¨©§¸¸¹·¨¨©§θθsincos01CS560024Using Matrix Notation»¼º«¬ª=»¼º«¬ª»¼º«¬ªθθθθθθsincos01cossinsin-cos»¼º«¬ª=»¼º«¬ª»¼º«¬ªθθθθθθcossin-10cossinsin-cos(Note that unit vectors simply copy columns)CS5600 13CS560025General Rotation by Matrix»¼º«¬ª+=»¼º«¬ª»¼º«¬ªθθθθθθθcossinysin-coscossinsin-cosyxxyxθCS560026Who had linear algebra?Who understand matrices?CS5600 14CS560027What do the off diagonal elements do?CS560028Off Diagonal Elements»¼º«¬ª+=»¼º«¬ª»¼º«¬ªybxxyxb 101»¼º«¬ª+=»¼º«¬ª»¼º«¬ªyayxyxa101CS5600 15CS560029Example 1y»¼º«¬ª+=»¼º«¬ª»¼º«¬ª=yxxyxyxT4.014.001),()1,0()0,1()1,1()0,0(SxCS560030Example 1 xy»¼º«¬ª+=yxxyxT4.0 ),(S)1,0()0,1()1,1()0,0(CS5600 16CS560031Example 1y)1,0()4.0,1()0,0(T(S)»¼º«¬ª+=yxxyxT4.0 ),()4.1,1(xCS560032Example 2y»¼º«¬ª+=»¼º«¬ª»¼º«¬ª=yyxyxyxT6.0106.01),(Sx)1,0()0,1()1,1()0,0(CS5600 17CS560033Example 2xy»¼º«¬ª+=yyxyxT6.0 ),(S)1,0()0,1()1,1()0,0(CS560034Example 2xy)1,0()0,1()0,0(T(S))1,6.0(»¼º«¬ª+=yyxyxT6.0 ),()1,6.1(CS5600 18CS560035SummaryShear in x:Shear in y:»¼º«¬ª+=»¼º«¬ª»¼º«¬ª=yayxyxaShx101»¼º«¬ª+=»¼º«¬ª»¼º«¬ª=ybxxyxbShy101CS560036Double Shear»¼º«¬ª+=»¼º«¬ª»¼º«¬ªab)(10110111baab»¼º«¬ª+=»¼º«¬ª»¼º«¬ª11ab)(101101babaCS5600 19CS560037Sample Points: unit inverses»¼º«¬ª=»¼º«¬ª−»¼º«¬ª011101bb»¼º«¬ª=»¼º«¬ª−»¼º«¬ª101011aaCS560038Geometric View of Shear in x)0,1()1,( a−)1,0()0,1()1,1(CS5600 20Another Geometric View of Shear in x39xxyyAnother Geometric View of Shear in x40xyCS5600 21CS560041Geometric View of Shear in y)1,0()0,0(),1( b−)1,0()0,1()0,0()1,1(Another Geometric View of Shear in yhh42xyxyCS5600 22Another Geometric View of Shear in y43xyCS560044“Lazy 1”»»»»»¼º«««««¬ª10001001 0»»»»»¼º«««««¬ª»»»»»¼º«««««¬ª=11yxyxCS5600 23CS560045Translation in x»»»»»¼º«««««¬ª1yx»»»»»¼º«««««¬ª»»»»»¼º«««««¬ª+=101001001yxdxxdCS560046Translation in x»»»»»¼º«««««¬ª1yx»»»»»¼º«««««¬ª»»»»»¼º«««««¬ª+=100101001ydyxdyCS5600 24CS560047Homogeneous Coordinates»»»»»¼º«««««¬ª100010010»»»»»¼º«««««¬ª»»»»»¼º«««««¬ª=11yxyxCS560048Homogeneous Coordinates0for , ≠↔»»¼º««¬ª»»»»»¼º«««««¬ª=λλλλyxyx»»»»»¼º«««««¬ª1yxCS5600 25CS560049Homogeneous Coordinates0,For ≠λ»»¼º««¬ª»»»»»¼º«««««¬ª»»»»»¼º«««««¬ª»»»»»¼º«««««¬ª»»»»»¼º«««««¬ª↔==yxyxyxyxλλλλλλ110001001110Homogeneous CoordinatesAn infinite number of points correspond to (x,y,1). They constitute the whole line (tx,ty,t).xwyw = 1(tx,ty,t)(x,y,1)CS5600 26CS560051We’ve got AffineTransformationsLinear + TranslationCS560052Compound Transformations• Build up compound transformations by concatenating elementary ones• Use for complicated motion• Use for complicated modelingCS5600 27CS560053Elementary Transformations• Scale• Rotate • Translate • Shear • (Reflect) )(θR)(),( dTydTxRfyRfx,)(),( dShydShx)(),(λλSySxCS560054Refection about y-axis»¼º«¬ª−=»¼º«¬ª»¼º«¬ª−01011001CS5600 28CS560055Reflection about y-axisxy),( yx),( yx−)0,1()0,1(−CS560056Reflection about x-axis»¼º«¬ª−=»¼º«¬ª»¼º«¬ª10101-001CS5600 29CS560057Reflection about x-axisxy)1,0(),( yx),( yx −)1,0( −Is Reflection “Elementary?”• Can we effect reflection in an elementary way?• (More elementary means scale, shear, rotation, translation.)58CS5600 30CS560059Reflection is Scale (-1)CS560060Example:Move clock handsx),( bayCS5600 31CS560061Example:Move clock hands),( baxyCS560062Example:Move clock hands),( baxyCS5600 32CS560063Example:Move clock handsy),( baxCS560064Clock Transformations• Translate to Origin • Move hand with rotation• Move hand back to clock• Do other handCS5600 33CS560065Clock Transformations15),(12),(),()(),()(−=−−∗=−−=twherebaTtRbaTTbaTtRbaTTbsCS560066Clock Transformations»»»»»¼º«««««¬ª1yx»»»»»¼º«««««¬ª»»»»»¼º«««««¬ª»»»»»¼º«««««¬ª−−−1100111100100000)cos()sin(0)sin()cos(00battttbaCS5600 34CS560067Map [a,b] [0,1]0[]x′abx1CS560068Map [a,b] [0,1]• Translate to Origin•Map x to
View Full Document