Now Playing: Gong Sigur Rós From Takk... Released September 13, 2005.

Slides:



Advertisements
Similar presentations
Transformations Ed Angel Professor Emeritus of Computer Science
Advertisements

CS 450: COMPUTER GRAPHICS LINEAR ALGEBRA REVIEW SPRING 2015 DR. MICHAEL J. REALE.
Computer Graphics Lecture 4 Geometry & Transformations.
25 May May May 2015Week 5-2D Transformations1 2D Transformations By: KanwarjeetSingh.
Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)
2-D Geometry. The Image Formation Pipeline Outline Vector, matrix basics 2-D point transformations Translation, scaling, rotation, shear Homogeneous.
Chapter 4.1 Mathematical Concepts
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry Trigonometric functions Defined using right triangle  x y h.
The Dot Product (MAT 170) Sections 6.7
Now Playing: My Mathematical Mind Spoon From Gimme Fiction Released May 10, 2005.
Outline for Today More math… Finish linear algebra: Matrix composition
CSCE 590E Spring 2007 Basic Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Computer Graphics (Fall 2008) COMS 4160, Lecture 3: Transformations 1
Transformations CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Computer Graphics (Fall 2004) COMS 4160, Lecture 3: Transformations 1
CAP4730: Computational Structures in Computer Graphics
3D Graphics Goal: To produce 2D images of a mathematically described 3D environment Issues: –Describing the environment: Modeling (mostly later) –Computing.
2D Transformations. World Coordinates Translate Rotate Scale Viewport Transforms Hierarchical Model Transforms Putting it all together.
CS 450: Computer Graphics 2D TRANSFORMATIONS
Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)
1 Computer Graphics Week7 -2D Rotation. 3-Rotation A shape can be rotated about any of the three axes. A rotation about the z-axis will actually rotate.
Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 3: Transformations 1
Mathematical Fundamentals
Transformations Aaron Bloomfield CS 445: Introduction to Graphics
COMP 175: Computer Graphics March 24, 2015
Chapter 2 – Linear Transformations
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.
CS 480/680 Computer Graphics Transformations Dr. Frederick C Harris, Jr.
Geometric Transforms Changing coordinate systems.
6.837 Linear Algebra Review Patrick Nichols Thursday, September 18, 2003.
Transformations Jehee Lee Seoul National University.
Week 5 - Wednesday.  What did we talk about last time?  Project 2  Normal transforms  Euler angles  Quaternions.
Geometric Transformations
Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.
Homogeneous Form, Introduction to 3-D Graphics Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 20,
16/5/ :47 UML Computer Graphics Conceptual Model Application Model Application Program Graphics System Output Devices Input Devices API Function.
CS 450: COMPUTER GRAPHICS PROJECTIONS SPRING 2015 DR. MICHAEL J. REALE.
What is Kinematics. Kinematics studies the motion of bodies.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Affine Transformations.
CO1301: Games Concepts Dr Nick Mitchell (Room CM 226) Material originally prepared by Gareth Bellaby.
Direct3D Workshop November 17, 2005 Workshop by Geoff Cagle Presented by Players 2 Professionals.
Lecture 3 Transformations. 2D Object Transformations The functions used for modifying the size, location, and orientation of objects or of the camera.
Transformations CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
Transformations: Projection CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
Affine Geometry.
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 3: Transformations 1
Computer Graphics Matrices
CSCE 552 Fall 2012 Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Revision on Matrices Finding the order of, Addition, Subtraction and the Inverse of Matices.
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.
Week 5 - Monday.  What did we talk about last time?  Lines and planes  Trigonometry  Transforms  Affine transforms  Rotation  Scaling  Shearing.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Transformations Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
4. Affine transformations. Reading Required:  Watt, Section 1.1. Further reading:  Foley, et al, Chapter  David F. Rogers and J. Alan Adams,
Computer Graphics Mathematical Fundamentals Lecture 10 Taqdees A. Siddiqi
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.
Objectives Introduce standard transformations Introduce standard transformations Derive homogeneous coordinate transformation matrices Derive homogeneous.
Transforms.
Geometric Transformations
2D Transformations By: KanwarjeetSingh
Computer Graphics Transformations.
Computer Graphics Transformations.
Lecture 03: Linear Algebra
COMP 175: Computer Graphics February 9, 2016
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Transformations.
2-D Geometry.
Geometric Objects and Transformations (II)
Image manipulation via matrices
Presentation transcript:

Now Playing: Gong Sigur Rós From Takk... Released September 13, 2005

Andre and Wally B (Lucasfilm CG Project [later Pixar], 1984)

2D Transforms Rick Skarbez, Instructor COMP 575 September 4, 2007

Reviewed the math we’re going to use in this course Points Vectors Matrices Linear interpolation Rays, planes, etc. Last Time

Today Vector spaces and coordinate frames Transforms in 2D Composing Transforms

Vector Spaces Let’s think for a minute about what x and y coordinates really mean y (x,y) x i j (u,v) x y j i

Vector Spaces For illustration, let’s flip things around i j (u,v) x y j i x y (x,y) = (-u,v)

Vector Spaces Any pair of non-parallel, non-anti- parallel vectors can define a vector space in 2D We’re used to thinking about spaces defined by orthogonal, normalized, axis-aligned vectors But there’s no reason this is the only way to do things

Vector Space Terms Linear Vector Space: Any space made up of vectors and scalars Euclidean Space: Vector space with a distance metric Affine Space: Vector space with an origin The Cartesian plane is both affine and Euclidean We call this type of space a frame

2D Transforms What am I talking about when I say “transforms”? Translation (x,y) (x’,y’) Scaling Rotation

General Form The transformations we consider are of the following form: Transformation Matrix Remember that the transformation matrix describes the change in vector space: x y x’x’ y’

Object vs. World Space Let’s stop and think about why we’re doing this... We can define the points that make up an object in “object space” Whatever is most convenient, often centered around the origin Then, at run time, we can put the objects where we want them in “world space”

Object vs. World Space Makes building large models easier Example: Object Space (x 0,y 0 ) (x 1,y 1 )(x 2,y 2 ) World Space (x’ 0,y’ 0 ) (x’ 1,y’ 1 ) (x’ 2,y’ 2 ) (x’’ 0,y’’ 0 ) (x’’ 1,y’’ 1 ) (x’’ 2,y’’ 2 )

Translation Basically, just moving points In 2D, up, down, left, or right All points move in the same way For example, we may want to move all points 4 pixels to the right and 3 down: Object Space (x,y) World Space (x+4,y-3)

So How Do We Do It? What transformation matrix will add 4 to x and subtract 3 from y? That is, what are the values of a, b, c, and d needed for this transformation? Transformation Matrix Actually, this is impossible to do with a 2x2 matrix and 2-vectors

How Do We Do It? Option 1: Implement translation as a 2-step process e is the x-offset f is the y-offset What are the values for our example?

So How Do We Do It? Option 2: Use bigger matrices If we set w = 1, then c is the x-offset f is the y-offset

How We Do It This is the way we’ll normally do it However, in computer science, we really like square matrices, so it’ll be written as: So what does this w stand for?

Homogeneous Coordinates We refer to this as a homogeneous coordinate: This mathematical construct allows us to Represent affine transforms with a single matrix Do calculations in projective space (vectors are unique only up to scaling)

Homogeneous Coordinates For points, w must be non-zero If w=1, the point is “normalized” If w!=1, can normalize by

Vectors in Homogeneous Coordinates Remember last time, I mentioned that it would be useful that we could represent points and vectors the same way? Here’s the payoff Can use homogeneous coordinates to represent vectors, too What is w? Remember, vectors don’t have a “position”

Vectors in Homogeneous Coordinates Since vectors don’t have a position, they should not be affected by translation What about rotation/scaling? Set w=0 for vectors: These have no effect

Summing up Translation We will represent translation with a matrix of the following form: u is the x-offset v is the y-offset

Scaling Want to stretch or shrink the entire space in one or more dimensions α = stretch in x, β = stretch in y x y Original α=1, β=1 x y α=2, β=1 x y α=1, β=2

Scaling Scaling is centered around the origin Points either get pulled toward the origin or pushed away from it x y x y x y

Scaling So, given what we know, how would we construct a scaling matrix? Assume we have an object centered around the origin, and want to scale it by α in x, and β in y x’ = αx y’ = βy

Summing up Scaling We will represent scaling with a matrix of the following form: α is the scale factor in the x-direction β is the scale factor in the y-direction

Rotation α α

Like scaling, rotations are centered about the origin x y x y x y

Rotation

Summing up Rotation We will represent rotation with a matrix of the following form: α is the angle of rotation (counter-clockwise)

Anything else? Translation, scaling, and rotation are the three most common transforms What do they have in common? They maintain the orthogonality of the coordinate frame What happens if we relax this constraint?

Shearing x y Horizontal Shear x y Original x y Vertical Shear

Shearing Vertical Shear x y Horizontal Shear y x s=0, No Shear s=1, 45 Degree Shear s=0, No Shear s=1, 45 Degree Shear s is -tan(θ), where θ is the desired shear angle

Transforms Summary Discussed how to do 4 common transforms in 2D Translation Scaling Rotation Shearing Also took a detour to discuss homogeneous coordinates

Composing Transforms These are the basics However, single transforms aren’t really very interesting The real power comes from using multiple transforms simultaneously That’s what we’re going to do now

Composing Transforms So why did we go through the trouble to use homogeneous coordinates for our points, and do our transforms using square transformation matrices? To make composing transforms easy! Composing 2 transforms is just multiplying the 2 transform matrices together WARNING: The order in which matrix multiplications are performed may (and usually does) change the result! (i.e. they are not commutative) WARNING: The order in which matrix multiplications are performed may (and usually does) change the result! (i.e. they are not commutative)

Let’s do an example Two transforms: Scale x and y by a factor of 2 Translate points (+3, +2) Let’s pick a single point in object space (1, 2)

Two Transform Paths x y (2,1) Translate Then Scale

Two Transform Paths x y (5,3) (+3, +2) Translate Then Scale

Two Transform Paths x y (10, 6) (*2, *2) Translate Then Scale

Two Transform Paths x y (2,1) Scale Then Translate

Two Transform Paths x y (4,2) (*2, *2) Scale Then Translate

Two Transform Paths x y (7,4) (+3, +2) Scale Then Translate

Composing Transforms Translate then scale (x’, y’) = (10, 6) Scale then translate (x’, y’) = (7, 4) Need a standard way to order transforms!

Transform Matrix Multiplications Always compose from right to left Here, transform M 1 is applied first Transform M 3 is applied last

Two Transform Paths Translate then Scale

Two Transform Paths Scale then Translate

Composing Transforms We can go one step further than just multiplying matrices Specifically, we can use a matrix stack This is what OpenGL and DirectX use You can build it in either order (world to object or object to world), then multiply out when needed Transform Scale Identity PushPop

Application: Rotation about a non-origin point x y x y x y x y x y

Robotic Arm Example Fingers first Then wrist Then elbow Finally, shoulder

Next Time Going to talk a bit more about transforms, and in particular, 3D transforms Might talk a little bit about animation