Computer Graphics. Geometric Transformations

Similar documents
Computer Graphics. Geometric Transformations

CSE328 Fundamentals of Computer Graphics: Theory, Algorithms, and Applications

What and Why Transformations?

CS F-07 Objects in 2D 1

CS559: Computer Graphics

4. Two Dimensional Transformations

3D Geometry and Camera Calibration

Modeling Transformations

MEM380 Applied Autonomous Robots Winter Robot Kinematics

To Do. Outline. Translation. Homogeneous Coordinates. Foundations of Computer Graphics. Representation of Points (4-Vectors) Start doing HW 1

Editing and Transformation

CS770/870 Spring 2017 Transformations

Image Warping (Szeliski Sec 2.1.2)

Modeling Transformations

Transformations. Examples of transformations: shear. scaling

Modeling Transformations Revisited

Vector Algebra Transformations. Lecture 4

Determining the 2d transformation that brings one image into alignment (registers it) with another. And

Today s class. Geometric objects and transformations. Informationsteknologi. Wednesday, November 7, 2007 Computer Graphics - Class 5 1

Transformations. which the book introduces in this chapter. If you shift the graph of y 1 x to the left 2 units and up 3 units, the

To Do. Computer Graphics (Fall 2004) Course Outline. Course Outline. Motivation. Motivation

CMSC 425: Lecture 10 Basics of Skeletal Animation and Kinematics

More on Transformations. COS 426, Spring 2019 Princeton University

1. We ll look at: Types of geometrical transformation. Vector and matrix representations

CSE528 Computer Graphics: Theory, Algorithms, and Applications

3-Dimensional Viewing

CS770/870 Spring 2017 Transformations

Homogeneous Coordinates

Motivation. What we ve seen so far. Demo (Projection Tutorial) Outline. Projections. Foundations of Computer Graphics

To Do. Demo (Projection Tutorial) Motivation. What we ve seen so far. Outline. Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 5: Viewing

Humanoid Robotics. Projective Geometry, Homogeneous Coordinates. (brief introduction) Maren Bennewitz

Transformations of Functions. 1. Shifting, reflecting, and stretching graphs Symmetry of functions and equations

Geometric Model of Camera

Two Dimensional Viewing

CS Computer Graphics: Transformations & The Synthetic Camera

Modeling Transformations

Image Warping. Some slides from Steve Seitz

Image warping. image filtering: change range of image. image warping: change domain of image g(x) = f(h(x)) h(y)=0.5y+0.5. h([x,y])=[x,y/2] f h

Scene Graphs & Modeling Transformations COS 426

Modeling Transformations

Lecture 4: Transforms. Computer Graphics CMU /15-662, Fall 2016

Perspective Projection Transformation

High Dimensional Rendering in OpenGL

Geometric Transformations

Modeling Transformations

Math background. 2D Geometric Transformations. Implicit representations. Explicit representations. Read: CS 4620 Lecture 6

Computer Graphics. P04 Transformations. Aleksandra Pizurica Ghent University

Image Warping. Some slides from Steve Seitz

What does OpenGL do?

GLOBAL EDITION. Interactive Computer Graphics. A Top-Down Approach with WebGL SEVENTH EDITION. Edward Angel Dave Shreiner

CT5510: Computer Graphics. Transformation BOCHANG MOON

2D Geometric Transformations and Matrices

To Do. Course Outline. Course Outline. Goals. Motivation. Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 3: Transformations 1

2D transformations and homogeneous coordinates

Grid and Mesh Generation. Introduction to its Concepts and Methods

Graphics and Interaction Transformation geometry and homogeneous coordinates

COMP30019 Graphics and Interaction Transformation geometry and homogeneous coordinates

Think About. Unit 5 Lesson 3. Investigation. This Situation. Name: a Where do you think the origin of a coordinate system was placed in creating this

Image Warping : Computational Photography Alexei Efros, CMU, Fall Some slides from Steve Seitz

STRAND J: TRANSFORMATIONS, VECTORS and MATRICES

To Do. Motivation. Demo (Projection Tutorial) What we ve seen so far. Computer Graphics. Summary: The Whole Viewing Pipeline

(x, y) (ρ, θ) ρ θ. Polar Coordinates. Cartesian Coordinates

Basic Elements. Geometry is the study of the relationships among objects in an n-dimensional space

Image Warping CSE399b, Spring 07 Computer Vision

Transformations II. Week 2, Wed Jan 17

CS 2770: Intro to Computer Vision. Multiple Views. Prof. Adriana Kovashka University of Pittsburgh March 14, 2017

MATRIX REVIEW PROBLEMS: Our matrix test will be on Friday May 23rd. Here are some problems to help you review.

CS4670: Computer Vision

Introduction to Homogeneous Transformations & Robot Kinematics

Transformations. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

[ ] [ ] Orthogonal Transformation of Cartesian Coordinates in 2D & 3D. φ = cos 1 1/ φ = tan 1 [ 2 /1]

6. Modelview Transformations

Last Lecture. Edge Detection. Filtering Pyramid

STRAND I: Geometry and Trigonometry. UNIT 37 Further Transformations: Student Text Contents. Section Reflections. 37.

Computer Graphics Hands-on

Transformations III. Week 2, Fri Jan 19

2D transformations: An introduction to the maths behind computer graphics

General Purpose Computation (CAD/CAM/CAE) on the GPU (a.k.a. Topics in Manufacturing)

Lines and Their Slopes

2D Transformations. 7 February 2017 Week 5-2D Transformations 1

Matrix Representations

Linear and Affine Transformations Coordinate Systems

IMGD The Game Development Process: 3D Modeling and Transformations

Interactive Computer Graphics. Warping and morphing. Warping and Morphing. Warping and Morphing. Lecture 14+15: Warping and Morphing. What is.

UNIT 2 2D TRANSFORMATIONS

Transformations II. Arbitrary 3D Rotation. What is its inverse? What is its transpose? Can we constructively elucidate this relationship?

Geometric transformations assign a point to a point, so it is a point valued function of points. Geometric transformation may destroy the equation

Must first specify the type of projection desired. When use parallel projections? For technical drawings, etc. Specify the viewing parameters

Name Class Date. subtract 3 from each side. w 5z z 5 2 w p - 9 = = 15 + k = 10m. 10. n =

9 3 Rotations 9 4 Symmetry

Transforms. COMP 575/770 Spring 2013

Computer Graphics Hands-on

THE INVERSE GRAPH. Finding the equation of the inverse. What is a function? LESSON

CS 450: COMPUTER GRAPHICS 2D TRANSFORMATIONS SPRING 2016 DR. MICHAEL J. REALE

LESSON 3.1 INTRODUCTION TO GRAPHING

3D graphics rendering pipeline (1) 3D graphics rendering pipeline (3) 3D graphics rendering pipeline (2) 8/29/11

Geometric Transformations

Affine and Projective Transformations

CS4620/5620. Professor: Kavita Bala. Cornell CS4620/5620 Fall 2012 Lecture Kavita Bala 1 (with previous instructors James/Marschner)

1.1 Horizontal & Vertical Translations

Transcription:

Computer Graphics Geometric Transformations

Contents coordinate sstems scalar values, points, vectors, matrices right-handed and left-handed coordinate sstems mathematical foundations transformations mathematical descriptions of geometric changes, 2D and 3D matrices: efficient representation matrices for common transformations z Computer Graphics Fall 26/27

The Basics Introduction and Motivation Mathematical Tools Coordinate Sstems Computer Graphics Fall 26/27

Introduction and Motivation 3D models represented as points, edges, polgons in 3D coordinate sstems object coordinate sstems world coordinate sstem camera coordinate sstem screen coordinate sstem transformations necessar foundation: geometr and linear algebra Computer Graphics Fall 26/27

Scalars, Points, Vectors, Matrices scalar values: real (rational) numbers: 7.39 points: position in nd space: (2.53, -.78) T vectors: directions in nd space have no position in space is linear combination of basis vectors of the vector space, e.g., (a, b, c) T = a(,, ) T + b(,, ) T + c(,, ) T matrices (n m): transformations between vector spaces Computer Graphics Fall 26/27

Coordinate Sstem and Coordinates coordinate sstem: set (o, e, e 2,..., e n ) consisting of point oa n and basis (e, e 2,...,e n ) of vector space A n position vector v = (op) for each pa n coordinates: scalar components of v with respect to (e, e 2,...,e n ) v = e + 2 e 2 +...+ n e n o: point of origin o z c(,,) b(,,) a(,,) (a,b,c) Computer Graphics Fall 26/27

Coordinate Sstems in CG: 2D & 3D two-dimensional three-dimensional 2 mirrored sstems cannot be matched b rotation we use right-handed z left-handed coordinate sstem z right-handed coordinate sstem Computer Graphics Fall 26/27

Transformations in 2D: Translation, Scaling, Rotation Computer Graphics Fall 26/27

Transformations in 2D goal: represent changes and movements of objects in the vector space common transformations: translation rotation scaling mirroring shearing combinations of these Computer Graphics Fall 26/27

2D Translation move point (, ) T on a straight line to (, ) T represent translation b a translation vector that is added d d vector: movement from one point to another d (,) d (, ) Computer Graphics Fall 26/27

2D Uniform Scaling center of scaling is o scaling uniforml in all directions stretching of (, ) T s position vector b scalar factor to get (, ) T mathematicall: multiplication with (,) (, ) Computer Graphics Fall 26/27

2D Non-Uniform Scaling center of scaling is o scaling in -direction b and in -direction b b (scaling vector (, b) T ) mathematicall: multiplication with and b according to ais ß application: mirroring (,) (, ) Computer Graphics Fall 26/27

2D Rotation center of rotation is o point (, ) T is rotated b an angle around o to obtain (, ) T positive angles mean counter-clockwise rotation (, ) (,) Computer Graphics Fall 26/27

2D Rotation Derivation of Formula distances (,) T o & (, ) T o are both r = r cosf and = r sinf = r cos(+f) and = r sin(+f) addition theorems (, ) = r cos cosf r sin sinf = cos sin r = r sin cosf + (,) r cos sinf r f r cosf = sin + cos r cos( + f) Computer Graphics Fall 26/27

2D Rotation = cos sin = sin + cos can be epressed as matri multiplication cos sin sin cos rotations around negative angles result in clockwise motion use smmetr of triginometric functions: cos(-)=cos() and sin(-)=-sin() Computer Graphics Fall 26/27

Transformations in 2D: Results translation: scaling: rotation: problems: addition of translation vector multiplication of factor(s) matri multiplication non-uniform treatment of transformations no wa to combine N transformation into one idea: all transformations as matri multiplications! onl scaling and translation to do Computer Graphics Fall 26/27

Transformations in 2D: Matri Formulation Homogeneous Coordinates Computer Graphics Fall 26/27

Computer Graphics Fall 26/27 Scaling using 2D Matri general 2D matri multiplication format scaling formula scaling as matri multiplication d c b a ) with (possibl b ß b

Computer Graphics Fall 26/27 Translation using 2D Matri general matri multiplication format tanslation formula translation as matri multiplication d c b a???? d d not possible in 2 2 matri!

Transformations in 2D: What now? translation: scaling: rotation: addition of translation vector matri multiplication matri multiplication onl scaling and rotation possible as matri multiplication possible solutions don t use translations? use both matrices and vector adding? mathematical magic: homogeneous coordinates! Computer Graphics Fall 26/27

Homogeneous Coordinates in 2D add an additional dimension to our vector space A n : n n+ (, ) T represented as (w, w, w) T, w normalized using w = (,, ) T homogeneous coordinates are not to be confused with regular 3D coordinates! Computer Graphics Fall 26/27

Homogeneous Coordinates in 2D each point in A n is equivalent to a line in homogeneous space A n+ that originates in the origin o but without including o w 3 2 Computer Graphics Fall 26/27

Computer Graphics Fall 26/27 Homogeneous Coordinates in 2D advantages of homogeneous coordinates uniform treatment of transformations all transformations can be represented combined transformations as one matri procedure: matri-vector multiplication goal: derive transformation matrices w i h g f e d c b a w

Computer Graphics Fall 26/27 Translation in Homogeneous Coords general matri multiplication format translation formula translation as matri multiplication d d w i h g f e d c b a w d d d d

Computer Graphics Fall 26/27 Scaling in Homogeneous Coords scaling as matri multiplication scaling as homogeneous matri multiplication b b b

Computer Graphics Fall 26/27 Rotation in Homogeneous Coords rotation as matri multiplication rotation as homogeneous matri multiplication cos sin sin cos cos sin sin cos cos sin sin cos

Computer Graphics Fall 26/27 Homogeneous Coordinates in 2D general transformation matri what about normalizing w when done? in all basic transformations we get w = no normalization necessar f e d c b a scaling rotation translation f e d c b a

Transformations in 2D: Inverse Transformations Concatenating Transformations Computer Graphics Fall 26/27

Inverse Transformations how to reverse basic transformations? translation: scaling: rotation: using negative vector T - (d, d) = T(-d, -d) using inverted factor / S - () = S( / ) using negative angle R - () = R(-) also: rotation matrices are orthonormal R - = R T Computer Graphics Fall 26/27

Computer Graphics Fall 26/27 Concatenating Transformations two translations translations are additive result is a translation b the sum of both vectors 2 2 d d d d = d + d 2 d + d 2

Computer Graphics Fall 26/27 Concatenating Transformations two scalings scaling is multiplicative result is a scaling b the product of both factors 2 2 b b 2 2 b b

Computer Graphics Fall 26/27 Concatenating Transformations two rotations rotation is additive (addition theorems) result is a rotation around the sum of both angles ) cos( ) sin( ) sin( ) cos( 2 2 2 2 cos sin sin cos cos sin sin cos 2 2 2 2

Concatenating Transformations in general, concatenating transformations b multipling their homogenous matrices given n transformations T, T 2,..., T n all are to be concatenated so that T is processed first, T 2 second,..., and T n last P = T n... T 2 T P onl for column vectors (points)! row vectors (points): P = P T T 2... T n we use column vectors (points) Computer Graphics Fall 26/27

Using Concatenated Transformations eample: rotation around arbitrar point P three steps: translation into origin rotation inverse translation to bring back to P P = T + R T - P P P Computer Graphics Fall 26/27

Using Concatenated Transformations all matrices for one concatenated transformation can be multiplied into one (as preprocessing) but: matri multiplication is not commutative! the order matters! (as with normal transformations, too) T n...t 2 T P T T 2...T n P T 2 T n...t P in most cases (depending on T i ) some transformations are commutative (just translating; just scaling; just rotating) Computer Graphics Fall 26/27

Concatenating Transformations 2 2 Rotation and Translation P = T R P P = R T P 2 2 Scaling and Translation P = T S P P = S T P Computer Graphics Fall 26/27

Concatenating Transformations 3 3 2 2 Rotation, Scaling, Translation P = T S R P P = R T S P 4 4 3 2 3 2 Rot., Scal., neg. Rot., Trans. P = T R - S R + P? P = R + T R - S P Computer Graphics Fall 26/27

Concatenating Transformations efficienc eample model with,, vertices operations: scaling, rotation, translation individual matri multiplications: 3 (9M + 6A),, = 27,,M 8,,A one concatenated matri : (9M + 6A),, = 9,,M 6,,A Computer Graphics Fall 26/27

Computer Graphics Fall 26/27 Other Transformations in 2D mirroring non-uniform scaling using - & as factors M Y M X

Computer Graphics Fall 26/27 Other Transformations in 2D shearing in -direction in -direction a T b T a b (,) (, ) a=, =4 a=, =

Computer Graphics 3D Geometric Transformations Computer Graphics Fall 26/27

Contents transformations continued transitioning from 2D to 3D z Computer Graphics Fall 26/27

Geometric Transformations in 3D same approach as in 2D also use homogeneous coordinates (for the same reasons) vectors/points from 3D to 4D z z transformation matrices are now 4 4 (instead of 3 3) Computer Graphics Fall 26/27

Transformation Matrices in 3D translation translation vector (d, d, dz) T scaling for uniform scaling s = s = s z otherwise individual factors ma differ mirroring using factors of - and depending on the mirror plane T s S s s d d dz z Computer Graphics Fall 26/27

Transformation Matrices in 3D rotation rotation around 3 aes possible now each has individual rotation matri rotation around positive angles in right-handed coordinate sstem rotation ais stas unit vector in matri R R R z cos sin cos sin cos sin sin cos sin cos sin cos Computer Graphics Fall 26/27

Transformation Matrices in 3D rotation wh are signs different from 2D case for R? R cos sin sin cos z right-handed coordinate sstem z contrast to 2D case: mirroring on -ais (, -) Computer Graphics Fall 26/27

Concatenating Transformations in 3D matri multiplication just as in 2D general transformation matri in 3D T a e i m b f j n c g k o d h l p scaling rotation translation Computer Graphics Fall 26/27

Transformations: Summar geometric transformations: linear mapping from n to n we are interested in 2 2 and 3 3 transformations most relevant for CG: translation rotation scaling mirroring shearing Computer Graphics Fall 26/27

Transformations: Summar unified representation of geometric transformations as matrices in homogeneous coordinates concatenation of transformation b multipling the respective matrices order matters: for column vectors the first transformation comes last in the sequence concatenated transformations can be pre-computed (saving run-time) Computer Graphics Fall 26/27