CPT450 – Computer Graphics

Slides:



Advertisements
Similar presentations
COMPUTER GRAPHICS 2D TRANSFORMATIONS.
Advertisements

2-D Geometry. The Image Formation Pipeline Outline Vector, matrix basics 2-D point transformations Translation, scaling, rotation, shear Homogeneous.
Shivkumar Kalyanaraman Rensselaer Polytechnic Institute 1 : “shiv rpi” Linear Algebra A gentle introduction Linear Algebra has become as basic and as applicable.
Linear Algebra and SVD (Some slides adapted from Octavia Camps)
CS 376 Introduction to Computer Graphics 02 / 09 / 2007 Instructor: Michael Eckmann.
1 CSCE 441 Computer Graphics: 2D Transformations Jinxiang Chai.
2.1 si SI31 Advanced Computer Graphics AGR Lecture 2 Basic Modelling.
Computer Graphics CSC 630 Lecture 2- Linear Algebra.
Course Website: Computer Graphics 3: 2D Transformations.
Math for CSLecture 11 Mathematical Methods for Computer Science Lecture 1.
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.
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
Mathematical Fundamentals
6.837 Linear Algebra Review Patrick Nichols Thursday, September 18, 2003.
Patrick Nichols Thursday, September 18, Linear Algebra Review.
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
Lecture Notes: Computer Graphics.
Dx = 2 dy = 3 Y X D Translation A translation is applied to an object by repositioning it along a straight-line path.
6.837 Linear Algebra Review Patrick Nichols Thursday, September 18, 2003.
Shivkumar Kalyanaraman Rensselaer Polytechnic Institute 1 : “shiv rpi” Linear Algebra A gentle introduction Linear Algebra has become as basic and as applicable.
6.837 Linear Algebra Review Rob Jagnow Monday, September 20, 2004.
Computer Graphics 2D Transformations. 2 of 74 Contents In today’s lecture we’ll cover the following: –Why transformations –Transformations Translation.
CS559: Computer Graphics Lecture 8: Warping, Morphing, 3D Transformation Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
1 Graphics CSCI 343, Fall 2015 Lecture 10 Coordinate Transformations.
Transformations CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
2D Geometric Transformation Translation A translation is applied to an object by repositioning it along a straight-line path from one coordinate location.
Honors Geometry.  We learned how to set up a polygon / vertex matrix  We learned how to add matrices  We learned how to multiply matrices.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Computer Graphics I, Fall 2010 Transformations.
Computer Graphics Lecture 11 2D Transformations I Taqdees A. Siddiqi
Computer Graphic 2 D Transformation.
CSCE 441 Computer Graphics: 2D Transformations
Objectives Introduce standard transformations Introduce standard transformations Derive homogeneous coordinate transformation matrices Derive homogeneous.
2D Geometry - points and polygons
Computer Graphics 2D Transformations
CSE 167 [Win 17], Lecture 2: Review of Basic Math Ravi Ramamoorthi
Modeling Transformations
Lecture 10 Geometric Transformations In 3D(Three- Dimensional)
Transforms.
Computer Graphics 3: 2D Transformations
Transformations Objectives
Geometric Transformations Hearn & Baker Chapter 5
2D TRANSFORMATIONS.
2D Transformations By: KanwarjeetSingh
Computer Graphics Transformations.
2D Transformations with Matrices
Computer Graphics 3: 2D Transformations
Review: Transformations
3D Transformation.
3D Geometric Transformations
Chapter 5 2-D Transformations.
Computer Graphics Transformations.
Introduction to Computer Graphics CS 445 / 645
Review: Transformations
Lecture 7 Geometric Transformations (Continued)
2D Transformations y y x x y x.
Computer Graphics Transformations
2-D Geometry.
Geometric Camera Models
Transformations Ed Angel
Transformations Ed Angel Professor Emeritus of Computer Science
Isaac Gang University of Mary Hardin-Baylor
Rendering – Matrix Transformations and the Graphics Pipeline
Linear Algebra A gentle introduction
Math review - scalars, vectors, and matrices
TWO DIMENSIONAL TRANSFORMATION
Matrices - Operations MULTIPLICATION OF MATRICES
: Chapter 7: Two Dimensional Image Transformation
Presentation transcript:

CPT450 – Computer Graphics Lecture 11 – Homogenous Coordinates

Basic Transformations Translation by (Tx, Ty) X’ = X + Tx Y’ = Y + Ty Scaling by Sx in X and Sy in Y about origin Note: Reflection is a special case where Sx = +/-1, Sy = +/-1 X’ = X * Sx Y’ = Y * Sy Rotation (about origin by angle A) X’ = X*cos(A) – Y*sin(A) Y’ = X*sin(A) + Y*cos(A) It would be nice if we could do all of these operations using the same equations…

Geometric versus Coordinate Transformations Schaum’s Outlines on Computer Graphics (p.74) differentiates between the Geometric Transformations and the Coordinate Transformations. They are inverse functions. Geometric transformations assume that the object is transformed and the coordinate system is fixed. Coordinate transformations assume that the coordinate system changes and the object is fixed. For example Translation: Geometric transformations use (Tx, Ty) where as coordinate transformations use (-Tx, -Ty) Scaling: Geometric transformations use Sx and Sy where as coordinate transformations use 1/Sx and 1/Sy. Rotation: geometric use A where as coordinate transformations use (-A). Remember cos(-a) = cos(a) and sin(-a) = -sin(a) Reflections are unchanged, due to symmetry. Note: Sign conventions are important. If you’re not sure, use a trivial example, i.e. let the angle =90 or the scale = 2.

Homogeneous Coordinates Idea: We introduce an extra coordinate, which we will set to 1. Therefore, the 2D point [x, y] T is represented as [x,y,1] T in homogeneous coordinates. This is equivalent to [c*x, c*y, c] T, where c is a non-zero constant. Usually it is written in normalized form, so that the last coordinate is 1. Homogeneous coordinates allow us to express each of these transformations as a matrix multiplication. Computers can perform these matrix calculations very quickly in software and even faster in hardware.

Homogenous Coordinates Beware! Some books (such as Schaum’s Outlines, Foley) represent points as column vectors [x,y,1] T , where T = transposed and other books (and computer graphics literature) represent points as row vectors [x,y,1]. Matrix multiplication. Note: order is different and the matrix gets transposed. Column vector representation. [x2,y2,1] T= [x1,y1,1] T * M T Row vector representation [x2,y2,1] = M * [x1,y1,1] I will represent points as column vectors.

Matrix Multiplication, Vectors & Matrices Some books do it one way, others do it the other way. New Column Vector = Matrix * Column Vector V’ = M x V, V = [x, y, z] T V’(i) = M(i,1)*V(1) + M(i,2)*V(2) + M(i,3)*V(3) New Row Vector * Matrix = new Row Vector V’ = V x M’, V = [x, y, z] V’(i) = V(1)*M’(1,i) + V(2)*M’(2,i) + V(3)*M’(3,i) Note: The matrices are transposed, i.e. M’ = M T

Multiplying Matrices, in general C[m,n]=A[m,l] * B[l,n], where the size of the matrices are in brackets [#rows, #cols]. Note: #cols in A = #rows in B For i = 0 to m - 1 For j = 0 to n - 1 C(i, j) = 0 For k = 0 to l - 1 C(i, j) += A(i, k) * B(k, j) Next k Next j Next i

Translation Matrix 1 Tx Ty

Matrix Multiplication Associative A*(B*C) = (A*B)*C Not Commutative A*B <> B*A Order matters M2 = M*X (Append) M2 = X*M (Prepend)

Rotation Matrix Cos(A) -Sin(A) Sin(A) 1

Scaling Matrix Sx Sy 1

Matrix Multiplication Example Cos(90) -Sin(90) Sin(90) 1 10 20 1 -20 10 1 = X