Unformatted text preview:

11Modeling TransformationsAdam FinkelsteinPrinceton UniversityC0S 426, Fall 20012Modeling Transformations• Specify transformations for objectsο Allows definitions of objects in own coordinate systemsο Allows use of object definition multiple times in a sceneH&B Figure 1093Overview• 2D Transformationsο Basic 2D transformationsο Matrix representationο Matrix composition• 3D Transformationsο Basic 3D transformationsο Same as 2D• Transformation Hierarchiesο Scene graphsο Ray casting42D Modeling TransformationsScaleRotateTranslateScaleTranslatexyWorld CoordinatesModelingCoordinates52D Modeling TransformationsxyWorld CoordinatesModelingCoordinatesLet’s lookat this indetail…62D Modeling TransformationsxyModelingCoordinates272D Modeling TransformationsxyModelingCoordinatesScale .3, .3Rotate -90Translate 5, 382D Modeling TransformationsxyModelingCoordinatesScale .3, .3Rotate -90Translate 5, 392D Modeling TransformationsxyModelingCoordinatesScale .3, .3Rotate -90Translate 5, 3World Coordinates10Basic 2D Transformations•Translation:ο x’=x+txο y’=y+ty• Scale:ο x’ = x * sxο y’ = y * sy• Shear:ο x’=x+hx*yο y’ = y + hy*x• Rotation:ο x’ = x*cosΘ -y*sinΘο y’ = x*sinΘ +y*cosΘTransformationscan be combined(with simple algebra)11Basic 2D Transformations•Translation:ο x’=x+txο y’=y+ty• Scale:ο x’ = x * sxο y’ = y * sy• Shear:ο x’=x+hx*yο y’ = y + hy*x• Rotation:ο x’ = x*cosΘ -y*sinΘο y’ = x*sinΘ +y*cosΘ12Basic 2D Transformations•Translation:ο x’=x+txο y’=y+ty• Scale:ο x’ = x *sxο y’ = y *sy• Shear:ο x’=x+hx*yο y’ = y + hy*x• Rotation:ο x’ = x*cosΘ -y*sinΘο y’ = x*sinΘ +y*cosΘx’ = x*sxy’ = y*syx’ = x*sxy’ = y*sy(x,y)(x’,y’)313Basic 2D Transformations•Translation:ο x’=x+txο y’=y+ty• Scale:ο x’ = x * sxο y’ = y * sy• Shear:ο x’=x+hx*yο y’ = y + hy*x• Rotation:ο x’ = x*cosΘ - y*sinΘο y’ = x*sinΘ + y*cosΘx’ = (x*sx)*cosΘ−(y*sy)*sinΘy’ = (x*sx)*sinΘ + (y*sy)*cosΘx’ = (x*sx)*cosΘ−(y*sy)*sinΘy’ = (x*sx)*sinΘ + (y*sy)*cosΘ(x’,y’)14Basic 2D Transformations•Translation:ο x’ = x +txο y’ = y +ty• Scale:ο x’ = x * sxο y’ = y * sy• Shear:ο x’=x+hx*yο y’ = y + hy*x• Rotation:ο x’ = x*cosΘ -y*sinΘο y’ = x*sinΘ +y*cosΘx’ = ((x*sx)*cosΘ−(y*sy)*sinΘ)+txy’ = ((x*sx)*sinΘ + (y*sy)*cosΘ)+tyx’ = ((x*sx)*cosΘ−(y*sy)*sinΘ) +txy’ = ((x*sx)*sinΘ + (y*sy)*cosΘ) +ty(x’,y’)15Basic 2D Transformations•Translation:ο x’=x+txο y’=y+ty• Scale:ο x’ = x * sxο y’ = y * sy• Shear:ο x’=x+hx*yο y’ = y + hy*x• Rotation:ο x’ = x*cosΘ -y*sinΘο y’ = x*sinΘ +y*cosΘx’ = ((x*sx)*cosΘ−(y*sy)*sinΘ)+txy’ = ((x*sx)*sinΘ + (y*sy)*cosΘ)+tyx’ = ((x*sx)*cosΘ−(y*sy)*sinΘ)+txy’ = ((x*sx)*sinΘ + (y*sy)*cosΘ)+ty16Overview• 2D Transformationsο Basic 2D transformationsο Matrix representationο Matrix composition• 3D Transformationsο Basic 3D transformationsο Same as 2D• Transformation Hierarchiesο Scene graphsο Ray casting17Matrix Representation• Represent 2D transformation by a matrix• Multiplymatrixbycolumnvector⇔ apply transformation to point=yxdcbayx''dcbadycxybyaxx+=+=''18Matrix Representation• Transformations combined by multiplication=yxlkjihgfedcbayx''Matrices are a convenient and efficient wayto represent a sequence of transformations!419=yxdcbayx''2x2 Matrices• What types of transformations can berepresented with a 2x2 matrix?2D Identity?yyxx==''=yxyx1001''2D Scale around (0,0)?ysyyxsxx*'*'===yxdcbayx''=yxsysxyx00''202x2 Matrices• What types of transformations can berepresented with a 2x2 matrix?2D Rotate around (0,0)?yxyyxx*cos*sin'*sin*cos'Θ+Θ=Θ−Θ==yxdcbayx''ΘΘΘ−Θ=yxyxcossinsincos''2D Shear?yxshyyyshxxx+=+=*'*'=yxdcbayx''=yxshyshxyx11''212x2 Matrices• What types of transformations can berepresented with a 2x2 matrix?2D Mirror over Y axis?yyxx=−=''=yxdcbayx''−=yxyx1001''2DMirrorover(0,0)?yyxx−=−=''=yxdcbayx''−−=yxyx1001''22=yxdcbayx''2x2 Matrices• What types of transformations can berepresented with a 2x2 matrix?2D Translation?tyyytxxx+=+=''Only linear 2D transformationscan be represented with a 2x2 matrixNO!23Linear Transformations• Linear transformations are combinations of …ο Scale,ο Rotation,ο Shear, andο Mirror• Properties of linear transformations:ο Satisfies:ο Origin maps to originο Lines map to linesο Parallel lines remain parallelο Ratios are preservedο Closed under composition)()()(22112211pppp TsTsssT +=+=yxdcbayx''242D Translation• 2D translation represented by a 3x3 matrixο Point represented with homogeneous coordinatestyyytxxx+=+=''=110010011''yxtytxyx525Homogeneous Coordinates• Add a 3rd coordinate to every 2D pointο (x, y, w) represents a point at location (x/w, y/w)ο (x,y,0)representsapointatinfinityο (0,0,0)isnotallowed1212(2,1,1)or (4,2,2) or (6,3,3)Convenient coordinate system torepresent many useful transformationsxy26Basic 2D Transformations• Basic 2D transformations as 3x3 matricesΘΘΘ−Θ=11000cossin0sincos1''yxyx=110010011''yxtytxyx=110001011''yxshyshxyxTranslateRotate


View Full Document

Princeton COS 426 - Modeling Transformations

Documents in this Course
Lecture

Lecture

35 pages

Lecture

Lecture

80 pages

Boids

Boids

25 pages

Exam 1

Exam 1

9 pages

Curves

Curves

4 pages

Lecture

Lecture

83 pages

Load more
Download Modeling Transformations
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Modeling Transformations and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Modeling Transformations 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?