Affine transformations. Brian Curless CSE 557 Fall 2014

Similar documents
Affine transformations

Affine transformations

Reading. 4. Affine transformations. Required: Watt, Section 1.1. Further reading:

Reading. Affine transformations. Vector representation. Geometric transformations. x y z. x y. Required: Angel 4.1, Further reading:

Affine transformations

Vector and Affine Math

CS 378: Computer Game Technology

CS 354R: Computer Game Technology

Linear and affine transformations

Two conventions for coordinate systems. Left-Hand vs Right-Hand. x z. Which is which?

Graphics Example: Type Setting

2D Geometric Transformations. (Chapter 5 in FVD)

MATRIX TRANSFORMATIONS

CS 4300 Computer Graphics. Prof. Harriet Fell Fall 2011 Lecture 11 September 29, 2011

Computer Graphics: 2D Transformations. Course Website:

( ) ( ) ( ) ( ) TNM046: Datorgrafik. Transformations. Linear Algebra. Linear Algebra. Sasan Gooran VT Transposition. Scalar (dot) product:

Some linear transformations on R 2 Math 130 Linear Algebra D Joyce, Fall 2013

Mathematics 309 Conic sections and their applicationsn. Chapter 2. Quadric figures. ai,j x i x j + b i x i + c =0. 1. Coordinate changes

LESSON 35: EIGENVALUES AND EIGENVECTORS APRIL 21, (1) We might also write v as v. Both notations refer to a vector.

we must pay attention to the role of the coordinate system w.r.t. which we perform a tform

Lecture 8: Coordinate Frames. CITS3003 Graphics & Animation

1 HOMOGENEOUS TRANSFORMATIONS

9.2. Cartesian Components of Vectors. Introduction. Prerequisites. Learning Outcomes

Physically Based Rendering ( ) Geometry and Transformations

we must pay attention to the role of the coordinate system w.r.t. which we perform a tform

CS-184: Computer Graphics. Today

Identifying second degree equations

15. Eigenvalues, Eigenvectors

Rigid Body Transforms-3D. J.C. Dill transforms3d 27Jan99

VECTORS IN THREE DIMENSIONS

Math 369 Exam #1 Practice Problems

6. Linear transformations. Consider the function. f : R 2 R 2 which sends (x, y) (x, y)

Eigenvectors and Eigenvalues 1

12.1 Systems of Linear equations: Substitution and Elimination

Demonstrate solution methods for systems of linear equations. Show that a system of equations can be represented in matrix-vector form.

CSE4030 Introduction to Computer Graphics

Strain Transformation and Rosette Gage Theory

Ch 3 Alg 2 Note Sheet.doc 3.1 Graphing Systems of Equations

MAT 1275: Introduction to Mathematical Analysis. Graphs and Simplest Equations for Basic Trigonometric Functions. y=sin( x) Function

CS 335 Graphics and Multimedia. 2D Graphics Primitives and Transformation

The first change comes in how we associate operators with classical observables. In one dimension, we had. p p ˆ

x y plane is the plane in which the stresses act, yy xy xy Figure 3.5.1: non-zero stress components acting in the x y plane

Unit 12 Study Notes 1 Systems of Equations

4 Inverse function theorem

Introduction to 3D Game Programming with DirectX 9.0c: A Shader Approach

The Force Table Introduction: Theory:

UNCORRECTED SAMPLE PAGES. 3Quadratics. Chapter 3. Objectives

3.7 InveRSe FUnCTIOnS

ES.1803 Topic 16 Notes Jeremy Orloff

Vector Fields. Field (II) Field (V)

Section 1.2: A Catalog of Functions

5. Nonholonomic constraint Mechanics of Manipulation

Trusses - Method of Sections

14.1 Systems of Linear Equations in Two Variables

Lecture 27: More on Rotational Kinematics

8.4 Inverse Functions

Gauss and Gauss Jordan Elimination

Introduction...iv. Glossary of Statistical Terms Calculator Instructions...231

Math Notes on sections 7.8,9.1, and 9.3. Derivation of a solution in the repeated roots case: 3 4 A = 1 1. x =e t : + e t w 2.

ZETA MATHS. Higher Mathematics Revision Checklist

Analytic Geometry in Three Dimensions

Worksheet #1. A little review.

Lecture 5. Equations of Lines and Planes. Dan Nichols MATH 233, Spring 2018 University of Massachusetts.

Chapter 18 Quadratic Function 2

All parabolas through three non-collinear points

Coordinate geometry. + bx + c. Vertical asymptote. Sketch graphs of hyperbolas (including asymptotic behaviour) from the general

Vectors in Two Dimensions

Intermediate Math Circles Wednesday November Inequalities and Linear Optimization

APPENDIX D Rotation and the General Second-Degree Equation

3 Polynomial and Rational Functions

CS 112 Transformations II. Aditi Majumder, CS 112 Slide 1

4 The Cartesian Coordinate System- Pictures of Equations

Homework Notes Week 6

Vector Calculus Review

Linear programming: Theory

ANALYTICAL GEOMETRY Revision of Grade 10 Analytical Geometry

Glossary. Also available at BigIdeasMath.com: multi-language glossary vocabulary flash cards

11.4 Polar Coordinates

Linear Independence. , v 2. is linearly independent if. =0 iff 1

Math Review Packet #5 Algebra II (Part 2) Notes

Chapter 8. Rigid transformations

APPLIED MECHANICS I Resultant of Concurrent Forces Consider a body acted upon by co-planar forces as shown in Fig 1.1(a).

QUADRATIC GRAPHS ALGEBRA 2. Dr Adrian Jannetta MIMA CMath FRAS INU0114/514 (MATHS 1) Quadratic Graphs 1/ 16 Adrian Jannetta

Today. CS-184: Computer Graphics. Introduction. Some Examples. 2D Transformations

Section 8.5 Parametric Equations

Functions. Introduction

Sample Problems For Grade 9 Mathematics. Grade. 1. If x 3

Lecture 1a. Complex numbers, phasors and vectors. Introduction. Complex numbers. 1a.1

CSC 470 Introduction to Computer Graphics. Mathematical Foundations Part 2

And similarly in the other directions, so the overall result is expressed compactly as,

Space Coordinates and Vectors in Space. Coordinates in Space

Math 323 Exam 2 - Practice Problem Solutions. 2. Given the vectors a = 1,2,0, b = 1,0,2, and c = 0,1,1, compute the following:

Engineering Mathematics I

Consider a slender rod, fixed at one end and stretched, as illustrated in Fig ; the original position of the rod is shown dotted.

REVISION SHEET FP2 (MEI) CALCULUS. x x 0.5. x x 1.5. π π. Standard Calculus of Inverse Trig and Hyperbolic Trig Functions = + = + arcsin x = +

Are You Ready? Find Area in the Coordinate Plane

MATH 1324 (Finite Mathematics or Business Math I) Lecture Notes Author / Copyright: Kevin Pinegar

Ground Rules. PC1221 Fundamentals of Physics I. Coordinate Systems. Cartesian Coordinate System. Lectures 5 and 6 Vectors.

Linear Equation Theory - 2

6. COORDINATE GEOMETRY

Transcription:

Affine transformations Brian Curless CSE 557 Fall 2014 1

Reading Required: Shirle, Sec. 2.4, 2.7 Shirle, Ch. 5.1-5.3 Shirle, Ch. 6 Further reading: Fole, et al, Chapter 5.1-5.5. David F. Rogers and J. Alan Adams, Mathematical Elements for Computer Graphics, 2 nd Ed., McGraw- Hill, New York, 1990, Chapter 2. 2

Geometric transformations Geometric transformations will map points in one space to points in another: (',, z ) = f (,, z). These transformations can be ver simple, such as scaling each coordinate, or comple, such as nonlinear twists and bends. We'll focus on transformations that can be represented easil with matri operations. 3

Vector representation We can represent a point, p = (,), in the plane or p=(,,z) in 3D space as column vectors z as row vectors z 4

Canonical aes 5

Vector length and dot products 6

Vector cross products 7

Representation, cont. We can represent a 2-D transformation M b a matri a c b d If p is a column vector, M goes on the left: p' Mp ' a b ' c d If p is a row vector, M T goes on the right: p' pm ' ' We will use column vectors. T a c b d 8

Two-dimensional transformations Here's all ou get with a 2 2 transformation matri M: So: ' a b ' c d ' a b ' c d We will develop some intimac with the elements a, b, c, d 9

Identit Suppose we choose a=d=1, b=c=0: Gives the identit matri: 1 0 0 1 Doesn't move the points at all 10

Scaling Suppose we set b=c=0, but let a and d take on an positive value: Gives a scaling matri: a 0 0 d Provides differential (non-uniform) scaling in and : ' a ' d 2 2 2 0 0 2 1 1 1 2 1 2 2 12 0 0 2 1 1 2 11

Suppose we keep b=c=0, but let either a or d go negative. Eamples: 1 0 0 1 1 0 0 1 12

Now let's leave a=d=1 and eperiment with b.... The matri gives: 1 b 0 1 ' b ' 1 1 1 1 0 1 1 1 13

Effect on unit square Let's see how a general 2 2 transformation M affects the unit square: a c b d p q r s p' q' r' s' a b0 1 1 0 0 a a b b c d 0 0 1 1 0 c c d d 1 s r p 1 q 14

Effect on unit square, cont. Observe: Origin invariant under M M can be determined just b knowing how the corners (1,0) and (0,1) are mapped a and d give -and -scaling b and c give -and -shearing 15

Rotation From our observations of the effect on the unit square, it should be eas to write down a matri for rotation about the origin : 1 1 1 0 0 1 Thus, MR( ) 16

Degrees of freedom For an transformation, we can count its degrees of freedom the number of independent (though not necessaril unique) parameters needed to specif the transformation. One wa to count them is to add up all the apparentl free variables and subtract the number of equations that constrain them. How man degrees of freedom does an arbitrar 2X2 transformation have? How man degrees of freedom does a 2D rotation have? 17

Linear transformations The unit square observations also tell us the 22 matri transformation implies that we are representing a point in a new coordinate sstem: p' Mp a b c d u v u v 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. 18

Limitations of the 2 2 matri A 2 2 linear transformation matri allows Scaling Rotation Reflection Shearing Q: What important operation does that leave out? 19

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. We call u, v, and t (basis and origin) a frame for an affine space. Then, we can represent a change of frame as: p' u v t This change of frame is also known as an affine transformation. How do we write an affine transformation with matrices? 20

Homogeneous coordinates Idea is to loft the problem up into 3-space, adding a third component to ever point: 1 Adding the third w component puts us in homogenous coordinates. And then transform with a 3 3 matri: ' 1 0 t ' T( t) 0 1 t w ' 1 0 0 11 1 1 1 0 1 0 1 1 2 0 0 1 1 1... gives translation! 21

Anatom of an affine matri In matri form, 2D affine transformations alwas look like this: a b t A t M c d t 0 0 1 0 0 1 2D affine transformations alwas have a bottom row of [0 0 1]. An affine point is a linear point with an added w-coordinate which is alwas 1: p aff plin 1 1 Appling an affine transformation gives another affine point: Mp Ap lin aff 1 t 22

Rotation about arbitrar points Until now, we have onl considered rotation about the origin. With homogeneous coordinates, ou can specif a rotation, q, about an point q = [q q ] T with a matri: q θ 1. Translate q to origin 2. Rotate 3. Translate back Note: Transformation order is important!! 23

Points and vectors Vectors have an additional coordinate of w=0. Thus, a change of origin has no effect on vectors. Q: What happens if we multipl a vector b an affine matri? These representations reflect some of the rules of affine operations on points and vectors: vector + vector scalar vector point - point point + vector point + point One useful combination of affine operations is: p() t po tu Q: What does this describe? 24

Barcentric 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: u A C vbc tc We can then write P in this coordinate frame: P u vt The coordinates (a, b, g) are called the barcentric coordinates of P relative to A, B, and C. 25

Computing barcentric coordinates Starting from a triangle in the - plane we can compute the barcentric coordinates of P: A B C P A BC A B C P 1 1 1 1 Simple matri analsis gives the solution: P B C A P C A B P P B C A P C A B P 1 1 1 1 1 1 1 1 1 A B C A B C A B C A B C A B C A B C 1 1 1 1 1 1 1 1 1 Computing the determinant of the denominator gives: BC BC AC AC AB AB 26

Cross products in 2D Recall the 3D cross product: ˆ ˆ zˆ uv u u u ( uv uv ) ˆ ( uv uv ) ˆ ( uv uv ) zˆ uv uv uv z v v v z z z z z uv z z uv z z uv What happens when u and v lie in the - plane? 27

Barcentric coords from area ratios Now, let s rearrange the equation from two slides ago: BC BC AC AC AB AB 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: ( B A )( C A ) ( B A )( C A ) SArea( PBC) SArea( APC) SArea( ABP) SArea( ABC) SArea( ABC) SArea( ABC) Where SArea(D) is the signed area of a triangle, which can be computed with cross-products. What does it mean for a barcentric coordinate to be negative? 28

Affine, vector, and conve combinations Note that we seem to have constructed a point b adding points together, which we said was illegal, but as long as the have coefficients that sum to one, it s ok. More generall: P A A 1 1 n n is an affine combination if: It is a vector combination if: i1 0 And it is a conve combination if: n i1 Q: Wh is it called a conve combination? n 1 i n i1 1 i i and 0 i 29

Basic 3-D transformations: scaling Some of the 3-D transformations are just like the 2-D ones. For eample, scaling: ' s 0 0 0 ' 0 s 0 0 z ' 0 0 sz 0z 1 0 0 0 11 z z 30

Translation in 3D ' 1 0 0 t ' 0 1 0 t z ' 0 0 1 tz z 1 0 0 0 11 z z 31

Rotation in 3D How man degrees of freedom are there in an arbitrar 3D rotation? 32

Rotation in 3D (cont d) These are the rotations about the canonical aes: 1 0 0 0 0 cos sin 0 R ( ) 0 sin cos 0 0 0 0 1 cos 0 sin 0 0 1 0 0 R ( ) sin 0 cos 0 0 0 0 1 cos sin 0 0 sin cos 0 0 R z ( ) 0 0 1 0 0 0 0 1 R R R z Use right hand rule A general rotation can be specified in terms of a product of these three matrices. How else might ou specif a rotation? 33

Shearing in 3D Shearing is also more complicated. Here is one eample: ' 1 b 0 0 ' 0 1 0 0 z ' 0 0 1 0z 1 0 0 0 11 z z We call this a shear with respect to the -z plane. 34

Preservation of affine combinations A transformation F is an affine transformation if it preserves affine combinations: F( A A ) F( A ) F( A ) 1 1 n n 1 1 n n where the A i are points, and: Clearl, the matri form of F has this propert. One special eample is a matri that drops a dimension. For eample: This transformation, known as an orthographic projection is an affine transformation. We ll use this fact later n i1 1 1 0 0 0 0 1 0 0 z 0 0 0 1 1 1 i 35

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 alwas preserved) s p : t q r s p' q' : t r' pq s ratio qr t p'q' q'r' 36

Affine transformations in OpenGL OpenGL maintains a modelview matri that holds the current transformation M. The modelview matri is applied to points (usuall vertices of polgons) before drawing. It is modified b commands including: glloadidentit() set M to identit gltranslatef(t, t, t z ) translate b (t, t, t z ) M I M MT glrotatef(θ,,, z) rotate b angle θ about ais (,, z) M MR glscalef(s, s, s z ) scale b (s, s, s z ) M MS Note that OpenGL adds transformations b postmultiplication of the modelview matri. 37