Download Presentation
## Computer Graphics CS630

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -

**Computer GraphicsCS630**Lecture 3 – Transformation And Coordinate Systems**What is a Transformation?**• Maps points (x, y) in one coordinate system to points (x', y') in another coordinate system x' = ax + by + c y' = dx + ey + f**Transformations**• Simple transformation • Translation • Rotation • Scaling**Transformations**• Deformable transformations • Shearing • Tapering • Twisting • Etc.. • Issues • Can be combined • Are these operations invertible?**Transformations**• Why use transformations? • Position objects in a scene (modeling) • Change the shape of objects • Create multiple copies of objects • Projection for virtual cameras • Animations**Classes of Transformation**• Rigid-Body/ Euclidean transformation • Similarity Transforms • Linear Transforms • Affine Transforms • Projective Transforms**Rigid-Body / Euclidean Transforms**• Preserves distances • Preserves angles Rigid / Euclidean Identity Translation Rotation**How are Transforms Represented?**x' = ax + by + c y' = dx + ey + f x y c f x' y' a b d e + = p' = M p + t**Translation**= + = +**Properties of Translation**= = = =**Scaling**Uniform scaling iff**Rotations 2D**• So in matrix notation**Properties of Rotations**order matters!**Homogeneous Coordinates**• Add an extra dimension • in 2D, we use 3 x 3 matrices • In 3D, we use 4 x 4 matrices • Each point has an extra value, w a e i m b f j n c g k o d h l p x y z w x' y' z' w' = p' = M p**Homogeneous Coordinates**• Most of the time w = 1, and we can ignore it a e i 0 b f j 0 c g k 0 d h l 1 x y z 1 x' y' z' 1 =**Homogeneous Coordinates**can be represented as where**Surface Normal**• Surface Normal: unit vector that is locally perpendicular to the surface**Why is the Normal important?**• It's used for shading — makes things look 3D! Diffuse Shading object color only**± x = Red± y = Green± z = Blue**Visualization of Surface Normal**How do we transform normals?**nWS nOS World Space Object Space**Transform the Normal like the Ray?**• translation? • rotation? • isotropic scale? • scale? • reflection? • shear? • perspective?**More Normal Visualizations**Incorrect Normal Transformation Correct Normal Transformation**Rotations about an arbitrary axis**Rotate by around a unit axis**An Alternative View**• We can view the rotation around an arbitrary axis as a set of simpler steps • We know how to rotate and translate around the world coordinate system • Can we use this knowledge to perform the rotation?**Rotation about an arbitrary axis**• Translate the space so that the origin of the unit vector is on the world origin • Rotate such that the extremity of the vector now lies in the xz plane (x-axis rotation) • Rotate such that the point lies in the z-axis (y-axis rotation) • Perform the rotation around the z-axis • Undo the previous transformations**Rotation about an arbitrary axis**• Step 1 Rotate x-axis y (a,b,c) x x (a’,b’,c’) z**Closer Look at Y-Z Plane**• Need to rotate degrees around the x-axis y z**Rotation about the Y-axis**• Using the same analysis as before, we need to rotate degrees around the Y-axis y x (a’,b’,c’)=Rx () (a,b,c)T z**Rotation about the Z-axis**• Now, it is aligned with the Z-axis, thus we can simply rotate degrees around the Z-axis. • Then undo all the transformations we just did**Deformations**Transformations that do not preserve shape • Non-uniform scaling • Shearing • Tapering • Twisting • Bending**Quick Recap**• Computer Graphics is using a computer to generate an image from a representation. computer Model Image**Modeling**• What we have been studying so far is the mathematics behind the creation and manipulation of the 3D representation of the object. computer Model Image**What have we seen so far?**• Basic representations (point, vector) • Basic operations on points and vectors (dot product, cross products, etc.) • Transformation – manipulative operators on the basic representation (translate, rotate, deformations) – 4x4 matrices to “encode” all these.