University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Affine Transformations.

Slides:



Advertisements
Similar presentations
Affine Transformations Jim Van Verth NVIDIA Corporation
Advertisements

Lecture 3: Transformations and Viewing. General Idea Object in model coordinates Transform into world coordinates Represent points on object as vectors.
Affine Transformations
Invariants (continued).
Computer Graphics Lecture 4 Geometry & Transformations.
Informationsteknologi Wednesday, November 7, 2007Computer Graphics - Class 51 Today’s class Geometric objects and transformations.
Transformations II Week 2, Wed Jan 17
Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)
HCI 530 : Seminar (HCI) Damian Schofield. HCI 530: Seminar (HCI) Transforms –Two Dimensional –Three Dimensional The Graphics Pipeline.
2D Geometric Transformations
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry Trigonometric functions Defined using right triangle  x y h.
2D/3D Geometric Transformations CS485/685 Computer Vision Dr. George Bebis.
CSCE 590E Spring 2007 Basic Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Math for CSLecture 11 Mathematical Methods for Computer Science Lecture 1.
Computer Graphics (Fall 2008) COMS 4160, Lecture 3: Transformations 1
Math for CSLecture 11 Mathematical Methods for Computer Science Lecture 1.
MOHAMMAD IMRAN DEPARTMENT OF APPLIED SCIENCES JAHANGIRABAD EDUCATIONAL GROUP OF INSTITUTES.
Computer Graphics (Fall 2004) COMS 4160, Lecture 3: Transformations 1
Vectors.
Computer Graphics (Fall 2005) COMS 4160, Lecture 2: Review of Basic Math
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology 3D Engines and Scene Graphs Spring 2012.
CS 450: Computer Graphics 2D TRANSFORMATIONS
Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)
Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 2: Review of Basic Math
COS 397 Computer Graphics Svetla Boytcheva AUBG, Spring 2013.
Graphics CSE 581 – Interactive Computer Graphics Mathematics for Computer Graphics CSE 581 – Roger Crawfis (slides developed from Korea University slides)
1 February 24 Matrices 3.2 Matrices; Row reduction Standard form of a set of linear equations: Chapter 3 Linear Algebra Matrix of coefficients: Augmented.
Transformations Aaron Bloomfield CS 445: Introduction to Graphics
Overview of 3D Computer Graphics
CS 480/680 Computer Graphics Representation Dr. Frederick C Harris, Jr. Fall 2012.
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.
Intro to 3D Models Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
6.837 Linear Algebra Review Patrick Nichols Thursday, September 18, 2003.
CSE 681 Review: Transformations. CSE 681 Transformations Modeling transformations build complex models by positioning (transforming) simple components.
Transformations Jehee Lee Seoul National University.
Computer Graphics, KKU. Lecture 51 Transformations Given two frames in an affine space of dimension n, we can find a ( n+1 ) x ( n +1) matrix that.
Geometric Objects and Transformation
16/5/ :47 UML Computer Graphics Conceptual Model Application Model Application Program Graphics System Output Devices Input Devices API Function.
CS559: Computer Graphics Lecture 8: Warping, Morphing, 3D Transformation Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
EECS 274 Computer Vision Affine Structure from Motion.
Computer Graphics 3D Transformations. Translation.
1 Graphics CSCI 343, Fall 2015 Lecture 10 Coordinate Transformations.
Geometric Transformations
Transformations CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
1 Graphics CSCI 343, Fall 2015 Lecture 9 Geometric Objects.
Affine Geometry.
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 3: Transformations 1
Honours Graphics 2008 Session 2. Today’s focus Vectors, matrices and associated math Transformations and concatenation 3D space.
CSCE 552 Fall 2012 Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Basic Theory (for curve 01). 1.1 Points and Vectors  Real life methods for constructing curves and surfaces often start with points and vectors, which.
Instructor: Mircea Nicolescu Lecture 9
1 Teaching Innovation - Entrepreneurial - Global The Centre for Technology enabled Teaching & Learning, N Y S S, India DTEL DTEL (Department for Technology.
4. Affine transformations. Reading Required:  Watt, Section 1.1. Further reading:  Foley, et al, Chapter  David F. Rogers and J. Alan Adams,
Graphics Graphics Korea University kucg.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실.
Transformations. Modeling Transformations  Specify transformations for objects  Allows definitions of objects in own coordinate systems  Allows use.
3D Ojbects: Transformations and Modeling. Matrix Operations Matrices have dimensions: Vectors can be thought of as matrices: v=[2,3,4,1] is a 1x4 matrix.
University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell Fourier Transforms.
Transformations University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016 Tamara Munzner.
CSE 167 [Win 17], Lecture 2: Review of Basic Math Ravi Ramamoorthi
Geometric Transformations
Geometric Transformations Hearn & Baker Chapter 5
Review: Transformations
Computer Graphics Transformations.
Introduction to Computer Graphics CS 445 / 645
Review: Transformations
COMP 175: Computer Graphics February 9, 2016
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Transformations.
3D Transformation CS380: Computer Graphics Sung-Eui Yoon (윤성의)
Transformations 2 University of British Columbia
Presentation transcript:

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Affine Transformations

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 2 Logistics Required reading: Watt, Section 1.1. Further reading: Foley, et al, Chapter David F. Rogers and J. Alan Adams, Mathematical Elements for Computer Graphics, 2 nd Ed., McGraw- Hill, New York, 1990, Chapter 2. Logistics: HW #1 handed out today Project #1 due on Tuesday, artifact on following Monday.

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 3 Geometric transformations Geometric transformations will map points in one space to points in another: (x',y',z') = f(x,y,z). These transformations can be very simple, such as scaling each coordinate, or complex, such as non- linear twists and bends. We'll focus on transformations that can be represented easily with matrix operations. We'll start in 2D...

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 4 Representation We can represent a point, p = (x,y), in the plane as a column vector as a row vector

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 5 Representation, cont. We can represent a 2-D transformation M by a matrix If p is a column vector, M goes on the left: If p is a row vector, M T goes on the right: We will use column vectors.

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 6 Two-dimensional transformations Here's all you get with a 2 x 2 transformation matrix M: So: We will develop some intimacy with the elements a, b, c, d…

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 7 Identity Suppose we choose a=d=1, b=c=0: Gives the identity matrix: Doesn't move the points at all

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 8 Scaling Suppose b=c=0, but let a and d take on any positive value: Gives a scaling matrix: Provides differential (non-uniform) scaling in x and y:

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 9 Reflection Suppose b=c=0, but let either a or d go negative. Examples:

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 10 Shear Now leave a=d=1 and experiment with b The matrix gives:

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 11 Effect on unit square Let's see how a general 2 x 2 transformation M affects the unit square:

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 12 Effect on unit square, cont. Observe: Origin invariant under M M can be determined just by knowing how the corners (1,0) and (0,1) are mapped a and d give x- and y-scaling b and c give x- and y-shearing

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 13 Rotation From our observations of the effect on the unit square, it should be easy to write down a matrix for “rotation about the origin”: Thus

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 14 Linear transformations The unit square observations also tell us the 2x2 matrix transformation implies that we are representing a point in a new coordinate system: where u=[a c] T and v=[b d] T are vectors that define a new basis for a linear space. The transformation to this new basis (a.k.a., change of basis) is a linear transformation.

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 15 Limitations of the 2 x 2 matrix A 2 x 2 linear transformation matrix allows Scaling Rotation Reflection Shearing Q: What important operation does that leave out?

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 16 Affine transformations In order to incorporate the idea that both the basis and the origin can change, we augment the linear space u, v with an origin t. Note that while u and v are basis vectors, the origin t is a point. We call u, v, and t (basis and origin) a frame for an affine space. Then, we can represent a change of frame as: This change of frame is also known as an affine transformation. How do we write an affine transformation with matrices?

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 17 Homogeneous Coordinates To represent transformations among affine frames, we can loft the problem up into 3-space, adding a third component to every point: Note that [a c 0] T and [b d 0] T represent vectors and [t x t y 1] T, [x y 1] T and [x' y' 1] T represent points.

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 18 Homogeneous coordinates This allows us to perform translation as well as the linear transformations as a matrix operation:

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 19 Rotation about arbitrary points 1.Translate q to origin 2.Rotate 3.Translate back Line up the matrices for these step in right to left order and multiply. Note: Transformation order is important!! Until now, we have only considered rotation about the origin. With homogeneous coordinates, you can specify a rotation, R q, about any point q = [q x q y 1] T with a matrix:

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 20 Points and vectors From now on, we can represent points as have an additional coordinate of w=1. Vectors have an additional coordinate of w=0. Thus, a change of origin has no effect on vectors. Q: What happens if we multiply a matrix by a vector? These representations reflect some of the rules of affine operations on points and vectors: One useful combination of affine operations is: Q: What does this describe?

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 21 Barycentric coordinates A set of points can be used to create an affine frame. Consider a triangle ABC and a point p : We can form a frame with an origin C and the vectors from C to the other vertices: We can then write P in this coordinate frame The coordinates (a, b, g) are called the barycentric coordinates of p relative to A, B, and C. A B C p

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 22 Computing barycentric coordinates For the triangle example we can compute the barycentric coordinates of P: Cramer’s rule gives the solution: Computing the determinant of the denominator gives:

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 23 Cross products Consider the cross-product of two vectors, u and v. What is the geometric interpretation of this cross-product? A cross-product can be computed as: What happens when u and v lie in the x-y plane? What is the area of the triangle they span?

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 24 Barycentric coords from area ratios Now, let’s rearrange the equation from two slides ago: The determinant is then just the z-component of (B-A)  (C-A), which is two times the area of triangle ABC! Thus, we find: Where SArea(RST) is the signed area of a triangle, which can be computed with cross-products.

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 25 Affine and convex combinations Note that we seem to have added points together, which we said was illegal, but as long as they have coefficients that sum to one, it’s ok. We call this an affine combination. More generally is a proper affine combination if: Note that if the  i ‘s are all positive, the result is more specifically called a convex combination. Q: Why is it called a convex combination?

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 26 Basic 3-D transformations: scaling Some of the 3-D transformations are just like the 2-D ones. For example, scaling:

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 27 Translation in 3D

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 28 Rotation in 3D Rotation now has more possibilities in 3D: Use right hand rule

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 29 Shearing in 3D Shearing is also more complicated. Here is one example: We call this a shear with respect to the x-z plane.

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 30 Preservation of affine combinations A transformation F is an affine transformation if it preserves affine combinations: where the p i are points, and: Clearly, the matrix form of F has this property. One special example is a matrix that drops a dimension. For example: This transformation, known as an orthographic projection, is an affine transformation. We’ll use this fact later…

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 31 Properties of affine transformations Here are some useful properties of affine transformations: Lines map to lines Parallel lines remain parallel Midpoints map to midpoints (in fact, ratios are always preserved) 

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 32 Summary What to take away from this lecture: All the names in boldface. How points and transformations are represented. What all the elements of a 2 x 2 transformation matrix do and how these generalize to 3 x 3 transformations. What homogeneous coordinates are and how they work for affine transformations. How to concatenate transformations. The rules for combining points and vectors The mathematical properties of affine transformations.

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 33 Next class: Shading Topics we’ll cover: - How does light interact with surfaces? - What approximations do we use to model this interaction in computer graphics? Read: Watt, sections 6.2 – 6.3 Optional Reading: Watt, chapter 7.