Computer Graphics (Fall 2005)To DoCourse OutlineSlide 4MotivationSlide 6General IdeaOutline(Nonuniform) ScaleShearRotationsSlide 12Composing TransformsE.g. Composing rotations, scalesInverting Composite TransformsSlide 16Slide 17Rotations in 3DGeometric Interpretation 3D RotationsSlide 20Non-CommutativityArbitrary rotation formulaAxis-Angle formulaAxis-Angle: Putting it togetherSlide 25Computer Graphics (Fall 2005)Computer Graphics (Fall 2005)COMS 4160, Lecture 3: Transformations 1http://www.cs.columbia.edu/~cs4160To DoTo DoStart (thinking about) assignment 1Much of information you need is in this lecture (slides)Ask TA NOW if compilation problems, visual C++ etc. Not that much coding [solution is approx. 20 lines, but you may need more to implement basic matrix/vector math], but some thinking and debugging likely involvedSpecifics of HW 1Axis-angle rotation and gluLookAt most useful (essential?). These are not covered in text (look at slides).You probably only need final results, but try understanding derivations. Problems in text help understanding material. Usually, we have review sessions per unit, but this one before midtermCourse OutlineCourse Outline3D Graphics Pipeline Rendering(Creating, shading images from geometry, lighting, materials) Modeling(Creating 3D Geometry)Course OutlineCourse Outline3D Graphics Pipeline Rendering(Creating, shading images from geometry, lighting, materials) Modeling(Creating 3D Geometry)Unit 1: TransformationsResizing and placing objects in theworld. Creating perspective images.Weeks 1 and 2 simplestGlut.exeAss 1 due Sep 22 (Demo)MotivationMotivationMany different coordinate systems in graphicsWorld, model, body, arms, …To relate them, we must transform between themAlso, for modeling objects. I have a teapot, butWant to place it at correct location in the worldWant to view it from different angles (HW 1)Want to scale it to make it bigger or smallerMotivationMotivationMany different coordinate systems in graphicsWorld, model, body, arms, …To relate them, we must transform between themAlso, for modeling objects. I have a teapot, butWant to place it at correct location in the worldWant to view it from different angles (HW 1)Want to scale it to make it bigger or smallerThis unit is about the math for doing all these thingsRepresent transformations using matrices and matrix-vector multiplications. Demo: HW 1, applettransformation_game.jarGeneral IdeaGeneral IdeaObject in model coordinatesTransform into world coordinatesRepresent points on object as vectorsMultiply by matricesDemos with appletChapter 6 in text. We cover most of it essentially as in the book. Worthwhile (but not essential) to read whole chapterOutlineOutline2D transformations: rotation, scale, shearComposing transforms3D rotationsTranslation: Homogeneous Coordinates (next time)Transforming Normals (next time)(Nonuniform) Scale(Nonuniform) Scale11100( , )00xxx yyyssScale s s Sss---� �� �= =� �� �� �� �� �0 00 00 0x xy yz zs x s xs y s ys z s z� �� � � �� �� � � �=� �� � � �� �� � � �� �� � � �transformation_game.jarShearShear11 10 1 0 1a aShear S--� � � �= =� � � �� � � �RotationsRotations2D simple, 3D complicated. [Derivation? Examples?]2D?LinearCommutative' cos sin' sin cosx xy yq qq q-� � � ���=� � � ���� � � ���R(X+Y)=R(X)+R(Y)transformation_game.jarOutlineOutline2D transformations: rotation, scale, shearComposing transforms3D rotationsTranslation: Homogeneous CoordinatesTransforming NormalsComposing TransformsComposing TransformsOften want to combine transformsE.g. first scale by 2, then rotate by 45 degreesAdvantage of matrix formulation: All still a matrixNot commutative!! Order mattersE.g. Composing rotations, scalesE.g. Composing rotations, scales3 2 2 13 1 13 1( ) ( )x Rx x Sxx R Sx RS xx SRx= == =�transformation_game.jarInverting Composite TransformsInverting Composite TransformsSay I want to invert a combination of 3 transformsOption 1: Find composite matrix, invertOption 2: Invert each transform and swap orderObvious from properties of matrices1 2 31 1 1 13 2 11 1 1 13 2 1 1 2 3( ( ) )M M M MM M M MM M M M M M M M- - - -- - - -===transformation_game.jarOutlineOutline2D transformations: rotation, scale, shearComposing transforms3D rotationsTranslation: Homogeneous CoordinatesTransforming NormalsRotationsRotationsReview of 2D caseOrthogonal?, ' cos sin' sin cosx xy yq qq q-� � � ���=� � � ���� � � ���TR R I=Rotations in 3D Rotations in 3D Rotations about coordinate axes simpleAlways linear, orthogonalRows/cols orthonormal TR R I=R(X+Y)=R(X)+R(Y)cos sin 0 1 0 0sin cos 0 0 cos sin0 0 1 0 sin coscos 0 sin0 1 0sin 0 cosz xyR RRq qq q q qq qq qq q-� � � �� � � �= = -� � � �� � � �� � � �� �� �=� �� �-� �Geometric Interpretation 3D RotationsGeometric Interpretation 3D RotationsRows of matrix are 3 unit vectors of new coord frameCan construct rotation matrix from 3 orthonormal vectorsu u uuvw v v v u u uw w wx y zR x y z u x X y Y z Zx y z� �� �= = + +� �� �� �?u u u pv v v pw w w px y z xRp x y z yx y z z� �� �� �� �= =� �� �� �� �� �� �u pv pw p�� �� ��� �� ��� �Geometric Interpretation 3D RotationsGeometric Interpretation 3D RotationsRows of matrix are 3 unit vectors of new coord frameCan construct rotation matrix from 3 orthonormal vectorsEffectively, projections of point into new coord frameNew coord frame uvw taken to cartesian components xyzInverse or transpose takes xyz cartesian to uvwu u u pv v v pw w w px y z x u pRp x y z y v px y z z w p� ��� � � �� �� � � �= = �� �� � � �� � � �� ��� � � �� �Non-CommutativityNon-CommutativityNot Commutative (unlike in 2D)!!Rotate by x, then y is not same as y then xOrder of applying rotations does matterFollows from matrix multiplication not commutativeR1 * R2 is not the same as R2 * R1Demo: HW1, order of right or up will mattersimplestGlut.exeArbitrary rotation formulaArbitrary rotation
View Full Document