CS5600 1Transformations ICS5600Computer GraphicsbyRich Riesenfeld27 February 2002Lecture Set 5CS56002Transformations and Matrices• Transformations are functions• Matrices are functions representations• Matrices represent linear transf’s• 2 x 2 Matrices == 2D Linear Transf’sCS56003What is a 2D Linear Transf ?Recall from Linear Algebra:Definition: T(ax + y) = aT(x) + T(y)for scalar a and vectors x and yCS56004Example: Scale in xScale in x, by 2:(2 (xo + x1), y0 + y1) = (2xo, yo) + (2x1, y1)CS56005Example: Scale in x by 2What is the graphical view?CS56006Scale in x by 2y(x1, y1)(2 x1, y1)(x0, y0)(2 x0, y0)xCS5600 2CS56007 ( 2xo + 2x1, y0 + y1 )yx ( 2 xo + 2 x1, y0 + y1 )(2 x1, y1)(2 x0, y0)CS56008 ( 2 (xo + x1), y0 + y1 )(x1, y1)(x0, y0)yx (( xo + x1 ), y0 + y1 ) ( 2 (xo + x1), y0 + y1 )CS56009 ( 2 (xo + x1), y0 + y1 ) (( xo + x1 ), y0 + y1 ) ( 2 (xo + x1), y0 + y1 )yxCS560010Summary on Scale• “Scale then add,” is same as• “Add then scale”CS560011Matrix RepresentationScale in x by 2:2 00 1xy=2xyCS560012Matrix RepresentationScale in y by 2:1 00 2xy=x2yCS5600 3CS560013Matrix RepresentationOverall Scale by 2:2 00 2xy=2x2yCS560014Matrix RepresentationShowing Same2 00 1x0 + x1y0 + y1=2(x0 + x1)y0 + y1=2x0 + 2x1y0 + y1CS560015What about Rotation?Is it linear?CS560016Rotate by θ yx(0,1)θθ(1,0)CS560017Rotate by θ: 1st Quadrantyx(cos θ , sin θ )sin θcos θθ(1,0)CS560018Rotate by θ: 1st Quadrant(1, 0) (cos θ , sin θ )CS5600 4CS560019Rotate by θ: 2nd Quadrant(0,1)θθ(1,0)yxCS560020Rotate by θ: 2nd Quadrant y(0,1)xsin θcos θθθCS560021Rotate by θ: 2nd Quadrant(0, 1) (-sin θ , cos θ )CS560022Summary of Rotation by θ (0, 1) (-sin θ , cos θ )(1, 0) (cos θ , sin θ )CS560023Summary (Column Form)−⇒θθcossin10⇒θθsincos01CS560024Using Matrix Notation=θθθθθθsincos01cossinsin-cos=θθθθθθcossin-10cossinsin-cos(Note that unit vectors simply copy columns)CS5600 5CS560025General Rotation by Matrix+=θθθθθθθcossinysin-coscossinsin-cosyxxyxθCS560026Who had linear algebra? Who understand matrices?CS560027What do the off diagonalelements do?CS560028Off Diagonal Elements+=ybxxyxb 101+=yayxyxa101CS560029Example 1y+==yxxyxyxT4.014.001),()1,0()0,1()1,1()0,0(SxCS560030Example 1xy+=yxxyxT4.0 ),(S)1,0()0,1()1,1()0,0(CS5600 6CS560031Example 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(CS560033Example 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(CS560035SummaryShear in x:Shear in y:+==yayxyxaShx101+==ybxxyxbShy101CS560036Double Shear+=ab)(10110111baab+=11 ab)(101101babaCS5600 7CS560037Sample Points: unit inverses=−011101bb=−101011aaCS560038Geometric View of Shear in x)0,1()1,( a−)1,0()0,1()1,1(Another Geometric View ofShear in xx39xxyyAnother Geometric View ofShear in x40xyCS560041Geometric View of Shear in y)1,0()0,0(),1( b−)1,0()0,1()0,0()1,1(Another Geometric View ofShear in yhh42xyxyCS5600 8Another Geometric View ofShear in y43xyCS560044“Lazy 1”10001001 0=11yxyxCS560045Translation in x1yx+=10 1001001yxdxxdCS560046Translation in x1yx+=100101001ydyxdyCS560047Homogeneous Coordinates10001001 0=11yxyxCS560048Homogeneous Coordinates0for , ≠↔=λλλλyxyx1yxCS5600 9CS560049Homogeneous CoordinatesHomogeneous term effects overall scaling0,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)CS560051We’ve got AffineTransformationsLinear + TranslationCS560052Next Class:Compound Transformations• Build up compound transformationsby concatenating elementary ones• Use for complicated motion• Use for complicated
View Full Document