1mjb – October 2, 2007Oregon State UniversityComputer GraphicsTransformationsMike BaileyOregon State Universitymjb – October 2, 2007Oregon State UniversityComputer GraphicsGeometry vs. TopologyWhere things are (e.g., coordinates)Geometry:How things are connectedTopology:1234123412342mjb – October 2, 2007Oregon State UniversityComputer Graphics3D Coordinate SystemsRight-HandedXYZXYZLeft-Handedmjb – October 2, 2007Oregon State UniversityComputer GraphicsTransformationsXYSuppose you have a point P and you want to move it over by 2 units in X – how would you change P’s coordinates?P P’(,)( 2.,)xyx yPPP P P′′′==+This is known as a coordinate transformation3mjb – October 2, 2007Oregon State UniversityComputer GraphicsTransform the geometry – leave the topology as isGeneral Form of 3D Linear TransformationsxAxByCzD′=+++yExFyGzH′=+++z IxJyKzL′=++ +mjb – October 2, 2007Oregon State UniversityComputer GraphicsTranslationxxxT′=+yyyT′=+zzzT′=+xTyT4mjb – October 2, 2007Oregon State UniversityComputer GraphicsScalingxxxS′= iyyyS′= izzzS′= imjb – October 2, 2007Oregon State UniversityComputer Graphics2D Rotationcos sinxx yθθ′=−sin cosyx yθθ′=+5mjb – October 2, 2007Oregon State UniversityComputer GraphicsLinear Equations in Matrix FormxAx By Cz D′=+++yExFyGzH′=+++zIxJyKzL′=++ +100011xABCD xyEFGHyzIJKLz′⎧⎫⎡ ⎤⎧⎫⎪⎪⎢ ⎥⎪⎪′⎪⎪⎪⎪⎢⎥=⋅⎨⎬⎨⎬′⎢⎥⎪⎪⎪⎪⎢⎥⎪⎪⎪⎪⎩⎭ ⎣ ⎦⎩⎭x consuming columnx’ producing rowmjb – October 2, 2007Oregon State UniversityComputer GraphicsIdentity Matrix[ I ] signifies that “Nothing has changed”100001000010100011xxyyzz′⎧⎫ ⎡ ⎤⎧⎫⎪⎪ ⎢ ⎥⎪⎪′⎪⎪ ⎪⎪⎢⎥=⋅⎨⎬ ⎨⎬′⎢⎥⎪⎪ ⎪⎪⎢⎥⎪⎪ ⎪⎪⎩⎭ ⎣ ⎦⎩⎭6mjb – October 2, 2007Oregon State UniversityComputer GraphicsMatrix Inverse[M]•[M]-1= [I][M]•[M]-1= “Nothing has changed”“Whatever [M] does, [M]-1undoes”mjb – October 2, 2007Oregon State UniversityComputer GraphicsTranslation100010001100011xyzxTxyTyzTz′⎧⎫⎡ ⎤⎧⎫⎪⎪⎢ ⎥⎪⎪′⎪⎪ ⎪⎪⎢⎥=⋅⎨⎬ ⎨⎬′⎢⎥⎪⎪ ⎪⎪⎢⎥⎪⎪ ⎪⎪⎩⎭⎣ ⎦⎩⎭7mjb – October 2, 2007Oregon State UniversityComputer GraphicsScaling00000000 0100011xyzxSxyS yzSz′⎧⎫⎡ ⎤⎧⎫⎪⎪⎢ ⎥⎪⎪′⎪⎪ ⎪⎪⎢⎥=⋅⎨⎬ ⎨⎬′⎢⎥⎪⎪ ⎪⎪⎢⎥⎪⎪ ⎪⎪⎩⎭⎣ ⎦⎩⎭mjb – October 2, 2007Oregon State UniversityComputer Graphics3D Rotation About ZXYZcos sin 0 0sin cos 0 00010100011xxyyzzθθθθ′−⎧⎫⎡ ⎤⎧⎫⎪⎪⎢ ⎥⎪⎪′⎪⎪⎪⎪⎢⎥=⋅⎨⎬⎨⎬′⎢⎥⎪⎪⎪⎪⎢⎥⎪⎪⎪⎪⎩⎭ ⎣ ⎦⎩⎭θRight-handed positive rotation rule8mjb – October 2, 2007Oregon State UniversityComputer Graphics3D Rotation About YXYZcos 0 sin 00100sin 0 cos 0100011xxyyzzθθθθ′⎧⎫⎡ ⎤⎧⎫⎪⎪⎢ ⎥⎪⎪′⎪⎪⎪⎪⎢⎥=⋅⎨⎬⎨⎬′⎢⎥−⎪⎪⎪⎪⎢⎥⎪⎪⎪⎪⎩⎭ ⎣ ⎦⎩⎭θmjb – October 2, 2007Oregon State UniversityComputer Graphics3D Rotation About XXYZ10 0 00cos sin 00sin cos 0100 011xxyyzzθθθθ′⎧⎫⎡ ⎤⎧⎫⎪⎪⎢ ⎥⎪⎪′−⎪⎪⎪⎪⎢⎥=⋅⎨⎬⎨⎬′⎢⎥⎪⎪⎪⎪⎢⎥⎪⎪⎪⎪⎩⎭ ⎣ ⎦⎩⎭θ9mjb – October 2, 2007Oregon State UniversityComputer GraphicsCompound TransformationsAABBWrite itSay itXYθ[],,11AB ABxxyyTRTzzθ++ −−⎛⎞⎛⎞′⎛⎞⎛⎞ ⎛⎞⎜⎟⎜⎟⎜⎟⎜⎟ ⎜⎟′⎜⎟⎜⎟⎜⎟⎜⎟ ⎜⎟⎡⎤ ⎡⎤=⋅⋅⎣⎦ ⎣⎦⎜⎟⎜⎟⎜⎟⎜⎟ ⎜⎟′⎜⎟⎜⎟⎜⎟⎜⎟ ⎜⎟⎜⎟⎜⎟⎜⎟⎝⎠ ⎝⎠⎝⎠⎝⎠⎝⎠mjb – October 2, 2007Oregon State UniversityComputer GraphicsMatrix Multiplication is Not CommutativeXYRotate, then translateTranslate, then rotateXYXY10mjb – October 2, 2007Oregon State UniversityComputer GraphicsMatrix Multiplication is Associative[],,11AB ABxxyyTRTzzθ++ −−⎛⎞⎛⎞′⎛⎞⎛⎞ ⎛⎞⎜⎟⎜⎟⎜⎟⎜⎟ ⎜⎟′⎜⎟⎜⎟⎜⎟⎜⎟ ⎜⎟⎡⎤ ⎡⎤=⋅⋅⎣⎦ ⎣⎦⎜⎟⎜⎟⎜⎟⎜⎟ ⎜⎟′⎜⎟⎜⎟⎜⎟⎜⎟ ⎜⎟⎜⎟⎜⎟⎜⎟⎝⎠ ⎝⎠⎝⎠⎝⎠⎝⎠[](),,11AB ABxxyyTRTzzθ++ −−′⎛⎞ ⎛⎞⎜⎟ ⎜⎟′⎜⎟ ⎜⎟⎡⎤ ⎡⎤=⋅⋅⋅⎣⎦ ⎣⎦⎜⎟ ⎜⎟′⎜⎟ ⎜⎟⎝⎠ ⎝⎠mjb – October 2, 2007Oregon State UniversityComputer GraphicsCan Multiply All Geometry by One Matrix !Graphics hardware can do this very quickly!AABBXYθ11[]xxyyzzM′⎛⎞ ⎛⎞⎜⎟ ⎜⎟′⎜⎟ ⎜⎟=⋅⎜⎟ ⎜⎟′⎜⎟ ⎜⎟⎝⎠ ⎝⎠11mjb – October 2, 2007Oregon State UniversityComputer GraphicsThe Rotation Matrix for an Arbitrary Axis and AngleθˆAPP’ˆˆ()PAA P=•ˆˆ()PPP PAAP⊥=−=− •()ˆˆ ˆˆˆ ˆ0QAP AP AP APAP P AP⊥⊥ ⊥ ⊥=× =× +=× +× =× + =×QPP⊥mjb – October 2, 2007Oregon State UniversityComputer Graphics'''PPP⊥=+'PP='cos sinPP Qθθ⊥⊥=+ˆˆ ˆˆ ˆ'()cos ()sinPAA P P AA P A Pθθ⎡⎤⎡ ⎤⎡⎤=•+ −•+ ×⎣⎦⎣ ⎦⎣⎦The Rotation Matrix for an Arbitrary Axis and Angle12mjb – October 2, 2007Oregon State UniversityComputer Graphics{}ˆˆ()xx xy xzyx yy yzzx zy zzAA AA AAAA P AA AA AA PAA AA AA⎡⎤⎢⎥•=⎢⎥⎢⎥⎣⎦The Rotation Matrix for an Arbitrary Axis and Angle{}0ˆ00zyzxyxAAAPA APAA⎡⎤−⎢⎥×= −⎢⎥⎢⎥−⎣⎦mjb – October 2, 2007Oregon State UniversityComputer GraphicsThe Rotation Matrix for an Arbitrary Axis and Angleˆˆ ˆˆ ˆ'()cos ()sinPAA P P AA P A Pθθ⎡⎤⎡ ⎤⎡⎤=•+ −•+ ×⎣⎦⎣ ⎦⎣⎦[]{}0'cos sin00xx xy xz xx xy xz z yyx yy yz yx yy yz z xzx zy zz zx zy zz y xAA AA AA AA AA AA A AP AA AA AA I AA AA AA A A PAA AA AA AA AA AA A Aθθ⎛ ⎞⎡⎤⎡⎤⎡⎤⎡⎤−⎜ ⎟⎢⎥⎢⎥⎢⎥⎢⎥=+−+−⎜ ⎟⎢⎥⎢⎥⎢⎥⎢⎥⎜ ⎟⎢⎥⎢⎥⎢⎥⎢⎥−⎣⎦⎣⎦⎣⎦⎣⎦⎝ ⎠[]10cos 1 sin 010xx xy xz xx xy xz z yyx yy yz yx yy yz z xzx zy zz zx zy zz y xAA AA AA AA AA AA A AMAAAAAA AA AAAA A AAA AA AA AA AA AA A Aθθ⎛ ⎞⎡⎤⎡ ⎤⎡⎤−− − −⎜ ⎟⎢⎥⎢ ⎥⎢⎥=+−−−+−⎜ ⎟⎢⎥⎢ ⎥⎢⎥⎜ ⎟⎢⎥⎢ ⎥⎢⎥−− − −⎣⎦⎣ ⎦⎣⎦⎝ ⎠13mjb – October 2, 2007Oregon State UniversityComputer GraphicsThe Rotation Matrix for an Arbitrary Axis and Angle[]()()()() ( ) ()()()()cos 1 cos sin cos sincos sin
View Full Document