Transformations.

Slides:



Advertisements
Similar presentations
COMPUTER GRAPHICS 2D TRANSFORMATIONS.
Advertisements

Gursharan Singh Tatla TRANSFORMATIONS Gursharan Singh Tatla Gursharan Singh Tatla.
Computer Graphics Lecture 4 Geometry & Transformations.
Geometric Transformations
1 Computer Graphics Chapter 6 2D Transformations.
Two-Dimensional Geometric Transformations
CMPE 466 COMPUTER GRAPHICS
1 Geometrical Transformation 2 Outline General Transform 3D Objects Quaternion & 3D Track Ball.
Image Warping : Computational Photography Alexei Efros, CMU, Fall 2006 Some slides from Steve Seitz
Elementary 3D Transformations - a "Graphics Engine" Transformation procedures Transformations of coordinate systems Translation Scaling Rotation.
Image Warping : Computational Photography Alexei Efros, CMU, Fall 2008 Some slides from Steve Seitz
Ch. 2: Rigid Body Motions and Homogeneous Transforms
1 Geometrical Transformation Tong-Yee Lee. 2 Modeling Transform Specify transformation for objects Allow definitions of objects in own coordinate systems.
Math for CSTutorial 11 Matrix Multiplication Rule Matrices make linear transformations of vectors.
Transformations CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
2D Transformations x y x y x y. 2D Transformation Given a 2D object, transformation is to change the object’s Position (translation) Size (scaling) Orientation.
Introduction to Computer Graphics CS 445 / 645 Lecture 5 Transformations Transformations M.C. Escher – Smaller and Smaller (1956)
2D Transformations Unit - 3. Why Transformations? In graphics, once we have an object described, transformations are used to move that object, scale it.
The linear algebra of Canadarm
Mathematical Fundamentals
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
COS 397 Computer Graphics Svetla Boytcheva AUBG, Spring 2013.
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
CS 480/680 Computer Graphics Transformations Dr. Frederick C Harris, Jr.
Computer Graphics Bing-Yu Chen National Taiwan University.
Geometric Transforms Changing coordinate systems.
2D Geometric Transformations
Part7: Geometric Transformations
CGPage: 1 東吳資訊科學 江清水 3.1 2D Geometry - points and polygons X Y A point in 2D is represented by two real numbers (X,Y) A line segment is represented by.
CSE 681 Review: Transformations. CSE 681 Transformations Modeling transformations build complex models by positioning (transforming) simple components.
Transformations Jehee Lee Seoul National University.
CS 325 Introduction to Computer Graphics 02 / 17 / 2010 Instructor: Michael Eckmann.
CS 376 Introduction to Computer Graphics 02 / 16 / 2007 Instructor: Michael Eckmann.
Transformations Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Computer Graphics 2D Transformations. 2 of 74 Contents In today’s lecture we’ll cover the following: –Why transformations –Transformations Translation.
Geometric Objects and Transformation
Geometrical Transformations 2 Adapted from Fundamentals of Interactive Computer Graphics, Foley and van Dam, pp , by Geb Thomas.
Transformation.
Computer Graphics 3D Transformations. Translation.
Two-Dimensional Geometric Transformations ch5. 참조 Subjects : Basic Transformations Homogeneous Coordinates Composite Transformations Other Transformations.
Two-Dimensional Geometric Transformations A two dimensional transformation is any operation on a point in space (x, y) that maps that point's coordinates.
Geometric Transformations
GEOMETRIC TRANFORMATIONS Presented By -Lakshmi Sahithi.
3D Transformation A 3D point (x,y,z) – x,y, and z coordinates
Geometric Transformations UBI 516 Advanced Computer Graphics Aydın Öztürk
January 19, y X Z Translations Objects are usually defined relative to their own coordinate system. We can translate points in space to new positions.
3-D Geometric Transformations
3D Geometric Transformation
II-1 Transformations Transformations are needed to: –Position objects defined relative to the origin –Build scenes based on hierarchies –Project objects.
Learning Objectives Affine transformations Affine transformations Translation Translation Rotation Rotation Scaling Scaling Reflection Reflection Shear.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
CS 325 Introduction to Computer Graphics 02 / 19 / 2010 Instructor: Michael Eckmann.
Derivation of the 2D Rotation Matrix Changing View from Global to Local X Y X’ Y’  P Y Sin  X Cos  X’ = X Cos  + Y Sin  Y Cos  X Sin  Y’ = Y Cos.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Transformations Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Computer Graphics Lecture 11 2D Transformations I Taqdees A. Siddiqi
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
Computer Graphic 2 D Transformation.
Image Warping 2D Geometric Transformations
3D Geometry and Transformations
Transformations. Transformations Introduce standard transformations ◦ Rotation ◦ Translation ◦ Scaling ◦ Shear Derive homogeneous coordinate transformation.
Transformations. Modeling Transformations  Specify transformations for objects  Allows definitions of objects in own coordinate systems  Allows use.
Instructor: Dr. Shereen Aly Taie Basic Two-Dimensional Geometric Transformation 5.2 Matrix Representations and Homogeneous Coordinates 5.3 Inverse.
Transforms.
Geometric Transformations
Computer Graphics CC416 Week 15 3D Graphics.
Computer Graphics 3D Transformations
Computer Graphics Transformations.
TWO DIMENSIONAL TRANSFORMATION
Translation in Homogeneous Coordinates
Presentation transcript:

Transformations

Content Coordinate systems 2D Transformations 3D Transformations Transformation composition Rotating about a pivot Rotating about an axis Agradecimientos: A Alex García-Alonso por facilitar el material para la realization de estas transparencias (http://www.sc.ehu.es/ccwgamoa/clases)

Coordinate systems An object is represented by polygons A polygon is a collection of vertex and edges To transform an object we must transform their vertex From local system to the global system: transformations

2D Transformations Translation Scale Rotation Deformation

2 dimensions: translation x´ = x + tx y´ = y + ty x´ 1 0 tx x y´ 0 1 ty y 1 0 0 1 1

2 dimensions: scale x´ = sx ·x y´ = sy ·y x´ sx 0 0 x y´ 0 sy 0 y 1 0 0 1 1

2 dimensions: rotation x = r cos  y = r sen  x’ = r cos ( +  ) = = r (cos  cos  – sen  sin ) = = x cos  – y sen  y’ = r sen ( + ) = = r ( cos  sen  + sen  cos ) = = x sin  + y cos  P’ y’ r  y P  x’ x

2 dimensions: rotation Matricially representation with Homogenous coordinates: x´ cos β -sin β 0 x y´ sin β cos β 0 y 1 0 0 1 1

2 dimensions: deformation (shear) Deformation of x coordinate: x´ = x + hx ·y y´ = y x´ 1 hx 0 x y´ 0 1 0 y 1 0 0 1 1

3D Transformations The general expression of a 3D transformation in Homogenous coordinates: x´ a11 a12 a13 a14 x y´ a21 a22 a23 a24 y z´ a31 a32 a33 a34 z 1 0 0 0 1 1

Transformation Matrix M44 Describe all the transformations: translation, scale, rotation, deformation. The composition of transformations is made by the product of matrix You can get the values of the transformation from the matrix: displacement, scale y turn.

3D: Translation x´ = x + tx y´ = y + ty z´ = z + tz x´ 1 0 0 tx x y´ 0 1 0 ty y z´ 0 0 1 tz z 1 0 0 0 1 1

3D: Scale x´ = sx ·x y´ = sy ·y z´ = sz ·z x´ sx 0 0 0 x y´ 0 sy 0 0 y 1 0 0 0 1 1

3D: Non uniform scale sx  sy  sz

3D: Rotation

3D: Rotation matrix x´ 1 0 0 0 x y´ 0 cos θ -sin θ 0 y z´ 0 sin θ cos θ 0 z 1 0 0 0 1 1 X Rotation x´ cos θ 0 sin θ 0 x y´ 0 1 0 0 y z´ -sin θ 0 cos θ 0 z 1 0 0 0 1 1 Y Rotation x´ cos θ -sin θ 0 0 x y´ sin θ cos θ 0 0 y z´ 0 0 1 0 z 1 0 0 0 1 1 Z Rotation

Others transformations Shear in xy (z invariant) x´ 1 0 a 0 x y´ 0 1 b 0 y z´ 0 0 1 0 z 1 0 0 0 1 1 Reflexion on plane xy x´ 1 0 0 0 x y´ 0 1 0 0 y z´ 0 0 -1 0 z 1 0 0 0 1 1

Composite transformation The transformations can be applied sequentially to a point. The result of the first transformation: M1 · P The second transformation: M2 ·[ M1 · P] = [M2 · M1 ] · P The composite transformation is made by the product of the matrix M = Mn ·Mn-1 ·… ·M2 · M1

Transformation product may not be commutative

Hierarchic structure An object is positioned in its coordinate system. All the assembly can be positioned in another coordinate system and so successively. The coordinates in the final system are got by the composite transformation.

Pivot-point rotation When the axis doesn't cross the coordinate origin, the next operations are required: Translate the pivot-point Q, to the coordinate origin Rotate the object Make the inverse translation The composite transformation matrix is: MRQ (θ) = M3 · M2 · M1 MRQ (θ) = MT (qx, qy, qz) ·MR (θ) · MT (-qx, -qy, -qz) The fixed point scaling is done in the same way

Rotation around an axis The axis is defined by a point “Q” and a unit vector “r”. The rotation has a value defined by angle θ. It is solved with a composition of transformations Definition of transformations Calculation of each one Explanation of calculation of required angles x y z θ Q R O r

Rotation around an axis : composition of transformations Initial Position Traslation QO Rotation  around z Rotation β around x Rotation θ around y x y z Q R r x y z Q’ R’ x y z Q’ R´´ x y z Q’ R´´´ M1 M2 M3 M4 Rotation -β around x Rotation -  around z Traslation -QO Initial Position x y z Q’ R´´´ x y z Q’ R´´ x y z Q’ R’ x y z Q R r M7 M5 M6

Rotation around an axis: relation of transformations The transformation matrix is: M(Q,r) (θ) = M7 · M6 · M5 · M4 · M3 · M2 · M1 M1 : traslation QO M2 : rotation  around z M3 : rotation  around x M4 : rotation  around y M5 : rotation - around x M6 : rotation - around z M7 : traslation -QO

Rotation around an axis : M1 - traslation QO We define R so OR = OQ + r The translation that moves Q to the origin is: M1 = MT (-qx, -qy, -qz) x y z θ Q R O r x y z Q’ R’ M1

R´´ x y rxy z Q’ R’ α

Rotation around an axis: M2 - rotation  around z Calculation of the  angle between the planes YZ and the plane defined by the z axis and OR’ rxy is the orthogonal projection of r on XY R’’ is the result of rotating around z  is the angle between rxy and j (unit vector of y) The positive direction of k must be taken into account M2 is the rotation matrix around the z axis: M2 = MRz () R´´ x y rxy z Q’ R’ α

Rotation around an axis: M3 - rotation β around x y z Q’ R´´´ R´´ β Applying M2 to R’ we get R’’ R’’ is on the YZ plane r’’ is defined by OR’’ Calculation of the β angle between r’’ and j The positive direction of i must be taken into account M3 is the rotation matrix around the x axis: M3 = MRx (β)

Rotation around an axis: M4 - rotation θ around y Applying M3 to R’’ we get R’’’ R’’’ is on the y axis The rotation θ is done around the y axis M4 is the rotation matrix around the y axis: M4 = MRy (θ) x y z Q’ R´´´

Rotation around an axis: M5, M6, M7 - inverses After calculating the θ rotation around the transformed axis, it is necessary to invert the transformation process. To do it, the inverses matrices have to be calculated. M5 = MRx (-β) M6 = MRz (-) M7 = MT(qx, qy, qz) The composed transformation matrix is: M(Q,r) (θ) = M7 · M6 · M5 · M4 · M3 · M2 · M1

Rotation around an axis:  angle y rxy z Q’ R’ α Calculation of  angle rxy is the orthogonal projection of r on the XY plane: (rx, ry, 0) cos  = j · rxy / | rxy | = = ( (0, 1, 0) · (rx, ry, 0) ) / (rx2 + ry2 )1/2 cos  = ry / (rx2 + ry2 )1/2 As cos  = cos (–) , then if rx < 0 then the angle must be (2- )   = -  α y z x rxy j  = acos ( ry / (rx2 + ry2 )1/2 ) y si rx < 0   = - 

Rotation around an axis: β angle Calculation of β angle R’’ and r’’ are on the YZ plane cos β = j · r´´ / | r´´| = = ( (0, 1, 0) · (0, ry´´, rz´´) ) / (ry´´2 + rz´´2 )1/2 cos β = ry´´ / (ry´´2 + rz´´2 )1/2 As cos β = cos (–β) , then if rz ´´ > 0 then the angle must be (2- β)  β = - β x y z Q’ R´´´ R´´ β β r´´ j z x y β = acos ( ry´´ / (ry´´2 + rz´´2 )1/2 ) y si rz´´ > 0  β = - β