Transforms.

Slides:



Advertisements
Similar presentations
Points, Vectors, Lines, Spheres and Matrices
Advertisements

Computer Graphics Lecture 4 Geometry & Transformations.
Geometric Transformations
1 Computer Graphics Chapter 6 2D Transformations.
Maths for Computer Graphics
HCI 530 : Seminar (HCI) Damian Schofield. HCI 530: Seminar (HCI) Transforms –Two Dimensional –Three Dimensional The Graphics Pipeline.
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry Trigonometric functions Defined using right triangle  x y h.
1 CSCE 441 Computer Graphics: 2D Transformations Jinxiang Chai.
CSCE 590E Spring 2007 Basic Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
2D Transformations Unit - 3. Why Transformations? In graphics, once we have an object described, transformations are used to move that object, scale it.
CS 450: Computer Graphics 2D TRANSFORMATIONS
By: Suhas Navada and Antony Jacob
Matrices The Basics Vocabulary and basic concepts.
1 Matrix Math ©Anthony Steed Overview n To revise Vectors Matrices n New stuff Homogenous co-ordinates 3D transformations as matrices.
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
Transformations Dr. Amy Zhang.
Mathematics for Computer Graphics. Lecture Summary Matrices  Some fundamental operations Vectors  Some fundamental operations Geometric Primitives:
Dx = 2 dy = 3 Y X D Translation A translation is applied to an object by repositioning it along a straight-line path.
Part7: Geometric Transformations
CSE 681 Review: Transformations. CSE 681 Transformations Modeling transformations build complex models by positioning (transforming) simple components.
CO1301: Games Concepts Dr Nick Mitchell (Room CM 226) Material originally prepared by Gareth Bellaby.
Transformations Jehee Lee Seoul National University.
CS 376 Introduction to Computer Graphics 02 / 16 / 2007 Instructor: Michael Eckmann.
Matrices. A matrix, A, is a rectangular collection of numbers. A matrix with “m” rows and “n” columns is said to have order m x n. Each entry, or element,
Matrices, Transformations and the 3D Pipeline Matthew Rusch Paul Keet.
13.1 Matrices and Their Sums
Two-Dimensional Geometric Transformations ch5. 참조 Subjects : Basic Transformations Homogeneous Coordinates Composite Transformations Other Transformations.
Matrix Algebra Section 7.2. Review of order of matrices 2 rows, 3 columns Order is determined by: (# of rows) x (# of columns)
Matrices: Simplifying Algebraic Expressions Combining Like Terms & Distributive Property.
Matrix Operations.
Affine Geometry.
Computer Graphics Matrices
MATRIX A set of numbers arranged in rows and columns enclosed in round or square brackets is called a matrix. The order of a matrix gives the number of.
II-1 Transformations Transformations are needed to: –Position objects defined relative to the origin –Build scenes based on hierarchies –Project objects.
Honors Geometry.  We learned how to set up a polygon / vertex matrix  We learned how to add matrices  We learned how to multiply matrices.
 An image is the new figure, and the preimage is the original figure  Transformations-move or change a figure in some way to produce an image.
CS 450: COMPUTER GRAPHICS TRANSFORMATIONS SPRING 2015 DR. MICHAEL J. REALE.
III- 1 III 3D Transformation Homogeneous Coordinates The three dimensional point (x, y, z) is represented by the homogeneous coordinate (x, y, z, 1) In.
Computer Graphics I, Fall 2010 Transformations.
3.5 Perform Basic Matrix Operations Add Matrices Subtract Matrices Solve Matric equations for x and y.
CS 325 Introduction to Computer Graphics 02 / 19 / 2010 Instructor: Michael Eckmann.
Precalculus Section 14.1 Add and subtract matrices Often a set of data is arranged in a table form A matrix is a rectangular.
Computer Graphic 2 D Transformation.
CSCE 441 Computer Graphics: 2D Transformations
Transformations. Modeling Transformations  Specify transformations for objects  Allows definitions of objects in own coordinate systems  Allows use.
Transformations University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016 Tamara Munzner.
Objectives Introduce standard transformations Introduce standard transformations Derive homogeneous coordinate transformation matrices Derive homogeneous.
Computer Graphics 2D Transformations
12-1 Organizing Data Using Matrices
Multiplying Matrices.
Matrix Operations Free powerpoints at
Matrix Operations.
Computer Graphics Transformations.
Matrix Operations.
Matrix Operations Free powerpoints at
Computer Graphics Transformations.
Matrix Operations Monday, August 06, 2018.
Matrix Operations.
Computer Graphics Transformations
Matrix Operations Free powerpoints at
7.3 Matrices.
MATRICES MATRIX OPERATIONS.
Chapter IV Spaces and Transforms
MATRICES MATRIX OPERATIONS.
2.2 Introduction to Matrices
3.5 Perform Basic Matrix Operations
MATRICES MATRIX OPERATIONS.
MATRICES MATRIX OPERATIONS.
TWO DIMENSIONAL TRANSFORMATION
What is the dimension of the matrix below?
Presentation transcript:

Transforms

Types of Transforms Translate Rotate Scale Shear

Affine Transform Math Transforms are cumulative Transforms change the whole world view Order matters!

Rotate 90 Reflect X Rotate 90 Reflect X

Making Shapes work together Create an object that has state variables corresponding to its parts Draw from the center of the overall object Perform transforms: 1. translate to center of overall object 2. rotate if wanted 3. scale/shear if wanted

Matrices Rectangular arrangement of numbers [1 2 3] 2 -3 0 3 7 -1 [1 2 3] 2 -3 0 3 7 -1 Dimensions Diagonal Transpose: interchange rows and cols Identity: Square matrix, diagonal is ones, rest is zeros

Matrix Operations Adding and subtracting: matrices must have same dimensions Add or subtract element-wise [1 2 3] + [4 5 6] = [5 7 9] Scalar multiplication: multiply all elements by the scalar 2 * [1 2 3] = [2 4 6]

Multiplying Matrices 3 [4 5 6] x 2 = 4*3 + 5*2 + 6*1 = [28] 1 (m x n) x (n x p) yields (mxp) Even if the matrices are square, multiplication is not commutative

Matrices and Graphics A point can be described using a vector: p = (x,y) p = xi+yj Or a matrix: [x y] Transposes are matrices that get post-multiplied to the point to produce a new point. (3,2)

Scaling Multiply by the matrix a 0 where a is the scale 0 b factor in the x direction, and b is the scale factor in the y direction If a and b are the same, it’s like multiplying by a scalar. (Balanced or Uniform scaling)

Scaling [3 2] 4 0 = [12 8] 0 4 (12,8) (3,2)

Reflecting Reflection in the x–axis: 1 0 0 -1 Reflection in the y–axis: -1 0 0 1 In general, multiplying by negative numbers combines a reflection and a scale.

Reflection [ 3 2] -1 0 = [-3 -2] 0 -1 (3,2) (-3,-2)

Rotations: Searching for a Pattern -1 0 rotates through 180 degrees 0 -1 (pi radians) 1 0 rotates through 360 degrees 0 1 (2 pi radians) 0 1 causes a rotation of 90 degrees -1 0 (pi/2 radians) 0 -1 causes a rotation of 270 degrees 1 0 (3pi/2 radians)

In general… The pattern emerges: To rotate through an angle Ө, multiply by cos Ө sin Ө -sin Ө cos Ө

Transforming Polygons To transform a line, transform its end points and connect the new points. Polygons are collections of lines. Multiplying several points is the same as making a matrix where each point is a row. True for Affine Transformations preserves points on line and parallelism preserves proportions (i.e., the midpoint remains the midpoint)

Transforming Polygons 1 3 3 0 3 6 3 0 0 2 = 9 0 6 4 18 8 R(6,4) P(1,3) Q*(9,0) Q(3,0)

Multiple transformations Order in transformations matters. Matrix multiplication is not commutative!

Translations To translate, we add rather than multiply matrices. To shift a point over by a in the x direction and b in the y direction, add the matrix [ a b]

Transformations [ 3 2 ] + [ 2 4] = [5 6] (5,6) (2,4) (3,2)

Homogeneous Coordinates You can’t use a 2x2 multiplication matrix to model translation. Bummer! But, we can add a third dimension of homogeneous coordinates, and now all 2D transformations can be expressed in a 3x3 matrix.

Homogeneous Translation Add a 1 to the point vector [3 2 1] = (3,2) To translate over 2 and up 4, multiply by 1 0 0 0 1 0 2 4 1 [3 2 1] 1 0 0 0 1 0 = [5 6 1] 2 4 1

Homogeneous Scale Scale by a in x direction and b in y a 0 0 0 b 0 0 0 1 Reflect in x-axis: 1 0 0 0 -1 0 0 0 1

Homogeneous Rotation Rotate about the origin: cos Ө sin Ө 0 -sin Ө cos Ө 0 0 0 1

Rotation about a point How would we rotate about a point other than the origin? I want to rotate this shape about its center, which is (5,2).

Rotation about a point Step 1 – translate coordinates so that your point of rotation becomes the origin. 1. Multiply by: 0 0 0 1 0 -5 -2 1

Rotation about a point Step 2 – Do your rotation 2. (For 90 degrees) Multiply by: 0 1 0 -1 0 0 0 0 1

Rotation about a point Step 3 – go back to original position 3. Undoing step 1: 0 0 0 1 0 5 2 1

3D How do you think it is done in 3D?