Transformations II. Week 2, Wed Jan 17

Similar documents
Transformations III. Week 2, Fri Jan 19

Transformations III. Week 3, Mon Jan 18

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

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

Image Warping. Some slides from Steve Seitz

Image Warping. Some slides from Steve Seitz

Viewing/Projections III. Week 4, Wed Jan 31

Viewing/Projection IV. Week 4, Fri Jan 29

Image Warping (Szeliski Sec 2.1.2)

Notes. University of British Columbia

Image Warping CSE399b, Spring 07 Computer Vision

Modeling Transformations

Modeling Transformations Revisited

Modeling Transformations

Modeling Transformations

Scene Graphs & Modeling Transformations COS 426

CS559: Computer Graphics

Modeling Transformations

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

1/29/13. Computer Graphics. Transformations. Simple Transformations

Homogeneous Coordinates

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Viewing/Projections IV. Week 4, Fri Feb 1

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

Modeling Transformations

Image Warping. Many slides from Alyosha Efros + Steve Seitz. Photo by Sean Carroll

News. Projections and Picking. Transforming View Volumes. Projections recap. Basic Perspective Projection. Basic Perspective Projection

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

Computer Graphics. P04 Transformations. Aleksandra Pizurica Ghent University

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

CS Computer Graphics: Transformations & The Synthetic Camera

CS770/870 Spring 2017 Transformations

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

4. Two Dimensional Transformations

What and Why Transformations?

More on Transformations. COS 426, Spring 2019 Princeton University

Two Dimensional Viewing

The 3-D Graphics Rendering Pipeline

Computer Graphics. Geometric Transformations

Computer Graphics. Geometric Transformations

Viewing and Projection

CS4670: Computer Vision

CS 428: Fall Introduction to. Transformations in OpenGL + hierarchical modeling. Andrew Nealen, Rutgers, /21/2009 1

Warping, Morphing and Mosaics

IMGD The Game Development Process: 3D Modeling and Transformations

Name: [20 points] Consider the following OpenGL commands:

Lecture 4: Viewing. Topics:

Image Warping. Computational Photography Derek Hoiem, University of Illinois 09/28/17. Photo by Sean Carroll

What does OpenGL do?

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

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

Transformations. Examples of transformations: shear. scaling

CS F-07 Objects in 2D 1

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

2D and 3D Coordinate Systems and Transformations

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

3D Geometry and Camera Calibration

Last Lecture. Edge Detection. Filtering Pyramid

Transformations Computer Graphics I Lecture 4

Uses of Transformations. 2D transformations Homogeneous coordinates. Transformations. Transformations. Transformations. Transformations and matrices

CS770/870 Spring 2017 Transformations

How is project #1 going?

2D Image Transforms Computer Vision (Kris Kitani) Carnegie Mellon University

Computer Graphics. 2D transformations. Transforma3ons in computer graphics. Overview. Basic classes of geometric transforma3ons

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

3-Dimensional Viewing

Today. Today. Introduction. Matrices. Matrices. Computergrafik. Transformations & matrices Introduction Matrices

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

Chap 7, 2009 Spring Yeong Gil Shin

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

Specifying Complex Scenes

CT5510: Computer Graphics. Transformation BOCHANG MOON

Vector Algebra Transformations. Lecture 4

OpenGL/GLUT Intro. Week 1, Fri Jan 12

Linear and Affine Transformations Coordinate Systems

2D and 3D Transformations AUI Course Denbigh Starkey

6. Modelview Transformations

Last week. Machiraju/Zhang/Möller/Fuhrmann

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

1 Transformations. Chapter 1. Transformations. Department of Computer Science and Engineering 1-1

Transformations Computer Graphics I Lecture 4

Transformations IV. Week 3, Wed Jan 20

Affine and Projective Transformations

3D Coordinates & Transformations

Image Warping, mesh, and triangulation CSE399b, Spring 07 Computer Vision

Geometric Model of Camera

Geometric Transformations

MEM380 Applied Autonomous Robots Winter Robot Kinematics

CMSC 425: Lecture 10 Basics of Skeletal Animation and Kinematics

Last Time. Correct Transparent Shadow. Does Ray Tracing Simulate Physics? Does Ray Tracing Simulate Physics? Refraction and the Lifeguard Problem

CPSC 314, Midterm Exam. 8 March 2010

Computer Science 336 Fall 2017 Homework 2

2D/3D Geometric Transformations and Scene Graphs

Computer Graphics Geometric Transformations

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

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

GEOMETRIC TRANSFORMATIONS AND VIEWING

CSCI-4530/6530 Advanced Computer Graphics

Computer Graphics. Geometric. Transformations. by Brian Wyvill University of Calgary. Lecture 2 Geometric. Transformations. Lecture 2 Geometric

2D transformations and homogeneous coordinates

Transcription:

Universit of British Columbia CPSC 34 Computer Graphics Jan-Apr 27 Tamara Munzner Transformations II Week 2, Wed Jan 7 http://www.ugrad.cs.ubc.ca/~cs34/vjan27

Readings for Jan 5-22 FCG Chap 6 Transformation Matrices ecept 6..6, 6.3. FCG Sect 3.3 Scene Graphs RB Chap Viewing Viewing and Modeling Transforms until Viewing Transformations Eamples of Composing Several Transformations through Building an Articulated Robot Arm RB Appendi Homogeneous Coordinates and Transformation Matrices until Perspective Projection RB Chap Displa Lists 2

Review: Event-Driven Programming main loop not under our control vs. procedural control flow through event callbacks redraw the window now ke was pressed mouse moved callback functions called from main loop when events occur mouse/keboard state setting vs. redrawing 3

Review: 2D Rotation (_, _) (, ) _ cos() - sin() _ sin() + cos() cos sin ( ) sin( ) ( ) cos( ) ν counterclockwise, RHS 4

Review: 2D Rotation From Trig Identities φ (_, _) (, ) r cos (φ) r sin (φ) _ r cos (φ + ) _ r sin (φ + ) Trig Identit _ r cos(φ) cos() r sin(φ) sin() _ r sin(φ) cos() + r cos(φ) sin() Substitute _ cos() - sin() _ sin() + cos() 5

Review: 2D Rotation: Another Derivation (_, _) B cos sin + sin cos (,) A B A cos A 6

7 Shear shear along ais push points to right in proportion to height +??????

8 Shear shear along ais push points to right in proportion to height + sh

Reflection reflect across ais mirror???? +?? 9

Reflection reflect across ais mirror +

2D Translation + + + b a b a ), ( b a (,) (, )

2 2D Translation + + + b a b a ), ( b a (,) (, ) ( ) ( ) ( ) ( ) cos sin sin cos b a scaling matri rotation matri

3 2D Translation + + + b a b a ), ( b a (,) (, ) ( ) ( ) ( ) ( ) cos sin sin cos b a scaling matri rotation matri vector addition matri multiplication matri multiplication

4 2D Translation + + + b a b a ), ( b a (,) (, ) ( ) ( ) ( ) ( ) cos sin sin cos b a scaling matri rotation matri d c b a translation multiplication matri?? vector addition matri multiplication matri multiplication

Linear Transformations linear transformations are combinations of shear scale rotate reflect a c b d properties of linear transformations satisifes T(s+t) s T() + t T() origin maps to origin lines map to lines parallel lines remain parallel ratios are preserved closed under composition a c + + b d 5

matri multiplication Challenge for everthing ecept translation how to do everthing with multiplication? then just do composition, no special cases homogeneous coordinates trick represent 2D coordinates (,) with 3-vector (,,) 6

7 Homogeneous Coordinates our 2D transformation matrices are now 33: ) cos( ) sin( ) sin( ) cos( Rotation b a Scale T T Translation + + + + b a b a b a use rightmost column

Homogeneous Coordinates Geometricall point in 2D cartesian 8

Homogeneous Coordinates Geometricall w w w w homogeneous (,, w) w / w cartesian point in 2D cartesian + weight w point P in 3D homog. coords multiples of (,,w) ( w form a line L in 3D, w all homogeneous points on L represent same 2D cartesian point eample: (2,2,) (4,4,2) (,,.5) ) 9

Homogeneous Coordinates Geometricall w w w w homogeneous (,, w) w / w cartesian homogenize to convert homog. 3D point to cartesian 2D point: divide b w to get (/w, /w, ) projects line to point onto w plane like normalizing, one dimension up when w, consider it as direction points at infinit these points cannot be homogenized lies on - plane (,,) is undefined ( w, w ) 2

2 Affine Transformations affine transforms are combinations of linear transformations translations properties of affine transformations origin does not necessaril map to origin lines map to lines parallel lines remain parallel ratios are preserved closed under composition w f e d c b a w

Homogeneous Coordinates Summar ma seem unintuitive, but the make graphics operations much easier allow all affine transformations to be epressed through matri multiplication we ll see even more later... use 33 matrices for 2D transformations use 44 matrices for 3D transformations 22

23 3D Rotation About Z Ais cos sin sin cos z z glrotatef(angle,,,z); glrotatef(angle,,,z); P z z + cos sin sin cos P glrotatef(angle,,,); glrotatef(angle,,,); ν general OpenGL command ν rotate in z

24 3D Rotation in X, Y cos sin sin cos z z glrotatef(angle,,,); glrotatef(angle,,,); around ais: cos sin sin cos z z glrotatef(angle,,,); glrotatef(angle,,,); around ais:

25 3D Scaling z c b a z glscalef(a,b,c); glscalef(a,b,c);

26 3D Translation z c b a z > < c b a,, gltranslatef(a,b,c); gltranslatef(a,b,c);

3D Shear shear in shear in shear in z s sz shear(s,sz) s sz shear(s,sz) zshear(s,s) s s 27

28 Summar: Transformations z c b a z translate(a,b,c) translate(a,b,c) cos sin sin cos z z ), ( Rotate z c b a z scale(a,b,c) scale(a,b,c) cos sin sin cos ), ( Rotate cos sin sin cos ), ( Rotate z

Undoing Transformations: Inverses T(,,z) T(,, z) T(,,z) T(,, z) I R(z,) R(z, ) R T (z,) R(z,) R(z, ) I (R is orthogonal) S(s,s,sz) S( s, s, sz ) S(s,s,sz)S( s, s, sz ) I 29

Composing Transformations 3

translation Composing Transformations d d T T(d,d) d 2 d 2 T2 T(d 2,d 2) P T2 P T2 [T P] [T2 T] P,where d + d 2 d + d 2 T2 T so translations add 3

scaling Composing Transformations S2 S rotation s d 2 s s 2 so scales multipl R2 R cos( + 2) sin( + 2) sin( + 2) cos( + 2) so rotations add 32

Composing Transformations Ta Tb Tb Ta, but Ra Rb! Rb Ra and Ta Rb! Rb Ta 33

Composing Transformations suppose we want F h j i j F W i 34

Composing Transformations suppose we want Rotate(z,-9) F h j i j F W i F W F h p R(z, 9)p 35

Composing Transformations suppose we want Rotate(z,-9) Translate(2,3,) F h j i F h j F W i F W F h F W p R(z, 9)p p T(2,3,)p 36

Composing Transformations suppose we want Rotate(z,-9) Translate(2,3,) F h j i F h j F W i F W F h F W p R(z, 9)p p T(2,3,)p p T(2,3,)R(z, 9)p TRp 37

Composing Transformations p TRp which direction to read? right to left interpret operations wrt fied coordinates moving object left to right interpret operations wrt local coordinates changing coordinate sstem 38

Composing Transformations p TRp which direction to read? right to left interpret operations wrt fied coordinates moving object left to right OpenGL pipeline ordering! interpret operations wrt local coordinates changing coordinate sstem 39

Composing Transformations p TRp which direction to read? right to left interpret operations wrt fied coordinates moving object left to right OpenGL pipeline ordering! interpret operations wrt local coordinates changing coordinate sstem OpenGL updates current matri with postmultipl gltranslatef(2,3,); glrotatef(-9,,,); glvertef(,,); specif vector last, in final coordinate sstem first matri to affect it is specified second-to-last 4

Interpreting Transformations translate b (-,) moving object (2,) (,) intuitive? changing coordinate sstem (,) OpenGL same relative position between object and basis vectors 4

Matri Composition matrices are convenient, efficient wa to represent series of transformations general purpose representation hardware matri multipl matri multiplication is associative p_ (T*(R*(S*p))) p_ (T*R*S)*p procedure correctl order our matrices! multipl matrices together result is one matri, multipl vertices b this matri all vertices easil transformed with one matri multipl 42

Rotation About a Point: Moving Object rotate about p b : translate p to origin rotate about origin translate p back p (, ) F W T(,,z)R(z,)T(,, z) 43

Rotation: Changing Coordinate Sstems same eample: rotation around arbitrar center 44

Rotation: Changing Coordinate Sstems rotation around arbitrar center step : translate coordinate sstem to rotation center 45

Rotation: Changing Coordinate Sstems rotation around arbitrar center step 2: perform rotation 46

Rotation: Changing Coordinate Sstems rotation around arbitrar center step 3: back to original coordinate sstem 47

General Transform Composition transformation of geometr into coordinate sstem where operation becomes simpler tpicall translate to origin perform operation transform geometr back to original coordinate sstem 48

Rotation About an Arbitrar Ais ais defined b two points translate point to the origin rotate to align ais with z-ais (or or ) perform rotation undo aligning rotations undo translation 49

Arbitrar Rotation Y Z W V problem: given two orthonormal coordinate sstems XYZ and UVW find transformation from one to the other answer: X transformation matri R whose columns are U,V,W: u v w R u v w u z v z w z U

Arbitrar Rotation wh? u v w R(X) u v w u z v z w z (u,u,u z ) U similarl R(Y) V & R(Z) W 5