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

Similar documents
Modeling Transformations Revisited

Computer Graphics. P04 Transformations. Aleksandra Pizurica Ghent University

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

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

CSE528 Computer Graphics: Theory, Algorithms, and Applications

CS Computer Graphics: Transformations & The Synthetic Camera

What and Why Transformations?

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

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

Image Warping. Some slides from Steve Seitz

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

Transformations II. Week 2, Wed Jan 17

Image Warping. Some slides from Steve Seitz

6. Modelview Transformations

Homogeneous Coordinates

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

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

Computer Graphics Geometric Transformations

Notes. University of British Columbia

Modeling Transformations

Computer Graphics. Geometric Transformations

Computer Graphics. Geometric Transformations

Modeling Transformations

CS770/870 Spring 2017 Transformations

4. Two Dimensional Transformations

Transformations. Examples of transformations: shear. scaling

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

Image Warping (Szeliski Sec 2.1.2)

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

CS F-07 Objects in 2D 1

Two Dimensional Viewing

3D Geometry and Camera Calibration

Supplementary Material: The Rotation Matrix

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

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

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

3-Dimensional Viewing

CS 4204 Computer Graphics

Image Warping CSE399b, Spring 07 Computer Vision

Transformations III. Week 2, Fri Jan 19

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

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

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

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

2D and 3D Transformations AUI Course Denbigh Starkey

Lecture 6 Sections 4.3, 4.6, 4.7. Wed, Sep 9, 2009

Graphics and Interaction Transformation geometry and homogeneous coordinates

COMP30019 Graphics and Interaction Transformation geometry and homogeneous coordinates

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

CS4670: Computer Vision

Editing and Transformation

CPSC 314, Midterm Exam 1. 9 Feb 2007

3D Coordinates & Transformations

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

CS 428: Fall Introduction to. Viewing and projective transformations. Andrew Nealen, Rutgers, /23/2009 1

Transformations Week 9, Lecture 18

CS559: Computer Graphics

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

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

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

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

2D Object Definition (1/3)

Reading. Hierarchical Modeling. Symbols and instances. Required: Angel, sections , 9.8. Optional:

CS770/870 Spring 2017 Transformations

T y. x Ax By Cz D. z Ix Jy Kz L. Geometry: Topology: Transformations

MEM380 Applied Autonomous Robots Winter Robot Kinematics

INF3320 Computer Graphics and Discrete Geometry

Modeling Transformations

Announcements. The equation of projection. Image Formation and Cameras

How is project #1 going?

Modeling Objects by Polygonal Approximations. Linear and Affine Transformations (Maps)

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

Scene Graphs & Modeling Transformations COS 426

CPSC 314, Midterm Exam. 8 March 2010

Modeling Transformations

Double Integrals in Polar Coordinates

CS 335 Graphics and Multimedia. Geometric Warping

GEOMETRIC TRANSFORMATIONS AND VIEWING

Computer Graphics. Chapter 5 Geometric Transformations. Somsak Walairacht, Computer Engineering, KMITL

Viewing and Projection

CS612 - Algorithms in Bioinformatics

High Dimensional Rendering in OpenGL

CSCI-4530/6530 Advanced Computer Graphics

Geometric Transformations

Warping, Morphing and Mosaics

Transformations: 2D Transforms

Announcements. Equation of Perspective Projection. Image Formation and Cameras

Viewing in 3D (Chapt. 6 in FVD, Chapt. 12 in Hearn & Baker)

Overview. Affine Transformations (2D and 3D) Coordinate System Transformations Vectors Rays and Intersections

CSCI-4530/6530 Advanced Computer Graphics

turn counterclockwise from the positive x-axis. However, we could equally well get to this point by a 3 4 turn clockwise, giving (r, θ) = (1, 3π 2

3D Transformations World Window to Viewport Transformation Week 2, Lecture 4

Quaternion Rotations AUI Course Denbigh Starkey

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

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

Lecture 9: Transformations. CITS3003 Graphics & Animation

521493S Computer Graphics Exercise 2 Solution (Chapters 4-5)

Modeling Transformations

Image warping , , Computational Photography Fall 2017, Lecture 10

CSC 470 Computer Graphics

Transcription:

Coordinate Sstems Point Representation in two dimensions Cartesian Coordinates: (; ) Polar Coordinates: (; ) (, ) ρ θ (ρ, θ) Cartesian Coordinates Polar Coordinates p = CPS1, 9: Computer Graphics D Geometric Transforms Page 1

Transformations (a) d (b) CPS1, 9: Computer Graphics D Geometric Transforms Page

Translation in D Moving the object along a line from one location to another. p = (; );t=(t ;t ); p 0 =( 0 ; 0 ) 0 =+t ; 0 =+t, p 0 =p+t. 0 0 = t t { } + T (t) (,) p t (, ) p t CPS1, 9: Computer Graphics D Geometric Transforms Page

Translation in D Translating a rigid bod: Translate ever point of b t. 0 = fp + t j p g: Enough to translate the vertices. CPS1, 9: Computer Graphics D Geometric Transforms Page

Rotation in D Rotation b with respect to origin. (, ) θ φ (,) = r cos ; = r sin : 0 = r cos( + ) = r cos cos, r sin sin = cos, sin : 0 = r sin( + ) = sin + cos : CPS1, 9: Computer Graphics D Geometric Transforms Page

Rotation in D 0 0 = cos, sin sin cos { } R() p 0 = R p Suppose R() = [R 1 () R ()]. R() 1 0 = cos sin = R 1 () R() 0 1 =, sin cos = R () CPS1, 9: Computer Graphics D Geometric Transforms Page

Rotation in D Rotation w.r.t. (; ): (, ) r (α,β) θ r φ (,) = + r cos ) r cos =, = + r sin ) r sin =, 0 = + r cos( + ) = + r cos cos, r sin sin = + (, ) cos, (, ) sin 0 = + (, ) sin + (, ) cos : CPS1, 9: Computer Graphics D Geometric Transforms Page

Scaling in D Scale b factor (s ;s ) 0 =s 0 =s 0 0 = s 0 0 s { } S(;) Uniform scaling s = s CPS1, 9: Computer Graphics D Geometric Transforms Page 8

Matri Representation of Transforms P 0 = AP + B Translation b (t ;t ): A = 1 0 0 1 B = t t Rotation b : A = cos, sin sin cos B = 0 0 Scaling b (s ;s ): A = s 0 0 s B = 0 0 CPS1, 9: Computer Graphics D Geometric Transforms Page 9

Composite Transformation T 1 = (A 1 ;B 1 ) T = (A ;B ) T T 1 (P) = A (A 1 P +B 1 )+B T T 1 CPS1, 9: Computer Graphics D Geometric Transforms Page 10

Noncommutativit of Transforms T : Translate (; 0); R: Rotate b = R T T R T R T CPS1, 9: Computer Graphics D Geometric Transforms Page 11

Homogeneous Coordinates Homogeneous coordinates unif translation, rotation, and scaling in one transformation matri. Transformation matri is matri. Translation p = (; ; w)! t = (t ;t ) w ; w p 0 = p+t= w +t ; w +t p 0 = (+t w; + t w; w) 0 0 w 0 = 1 0 t 0 1 t 0 0 1 { } w T(t ;t ) T (t ;t ),1 =T(,t ;,t ) CPS1, 9: Computer Graphics D Geometric Transforms Page 1

Homogeneous Coordinates Rotation 0 0 w 0 = cos, sin 0 sin cos 0 0 0 1 { } w R() R(),1 = R(,) Scaling 0 0 w 0 = s 0 0 0 s 0 0 0 1 { } w S(s ;s ) S(s ;s ),1 =S(1=s ; 1=s ) CPS1, 9: Computer Graphics D Geometric Transforms Page 1

D Rotation revisited Rotation w.r.t a point q (; ) b angle Regard as a composite transform. (α,β) (α,β) T (,;,) (α,β) (α,β) R()T (,;,) T (;)R()T (,;,) CPS1, 9: Computer Graphics D Geometric Transforms Page 1

D Rotation Translate b T (,;,) so that q becomes the origin. Rotate b with respect to the origin; R(). Translate b T (; ) to bring q back to its original position. R(; ; ) = T(; ) R() T (,;,): CPS1, 9: Computer Graphics D Geometric Transforms Page 1

D Rotation: Few Remarks Rotation involves either trigonometric functions or p Use Power series to approimate rotation for small values of Consider the upper-left matri of R() and regard the rows as vectors in the plane v 1 = (cos ;, sin ); v = (sin ; cos ): p (sinθ,cosθ) p R(θ) p (cos θ,-sin θ) CPS1, 9: Computer Graphics D Geometric Transforms Page 1

Euclidean Transform Euclidean transformation Rigid Bod transformations Translation and Rotation Angles and distances are unchanged T (; t ;t )= cos, sin t sin cos t 0 0 1 CPS1, 9: Computer Graphics D Geometric Transforms Page 1

Reection w.r.t -ais S(1;,1) w.r.t -ais S(,1; 1) What about w.r.t the line =,? CPS1, 9: Computer Graphics D Geometric Transforms Page 18

Shear Transform SH (a) = 1 a 0 0 1 0 0 0 1 0 = + a; 0 = : SH(a) Horiontal segment at height is shifted in the -direction b a. Not a Euclidean transform. 0 1 0 1 0 1 CPS1, 9: Computer Graphics D Geometric Transforms Page 19

D Transforms Homogeneous coordinates (; ; ; w) =) w ; w ; : w Right Hand Sstem: Positive rotation dened as: Look toward origin from a positive ais, = counter-clockwise 00 0000 11 1111 00 11 01 rotation transforms one ais to another. :!, :!, :!. 00 11 00 0000 11 1111 Some graphics sstems use the left hand sstem. CPS1, 9: Computer Graphics D Geometric Transforms Page 0

Translation Translation b (t ;t ;t ) p = (; ; ; w); t = (t ;t ;t ) p 0 = ( 0 ; 0 ; 0 ;w 0 ) = (+wt ;+wt ;+wt ;w): 0 0 0 w 0 = 1 0 0 t 0 1 0 t 0 0 1 t 0 0 0 1 { } w T(t ;t ;t ) T (t ;t ;t ),1 =T(,t ;,t ;,t ) CPS1, 9: Computer Graphics D Geometric Transforms Page 1

Scaling Scaling b (s ;s ;s ) p = (; ; ; w) s = (s ;s ;s ) p 0 = ( 0 ; 0 ; 0 ;w 0 )=(s ;s ;s ;w): 0 0 0 w 0 = s 0 0 0 0 s 0 0 0 0 s 0 0 0 0 1 { } w S(s ;s ;s ) S(s ;s ;s ),1 =S(1=s ; 1=s ; 1=s ) CPS1, 9: Computer Graphics D Geometric Transforms Page

Rotation in D Rotation w.r.t. a line: Ais of rotation Ais of rotation: -ais 0 = cos, sin 0 = sin + cos 0 = 00 0000 11 1111 00 0000 11 1111 00 11 01 00 11 0 0 0 w 0 = cos, sin 0 0 sin cos 0 0 0 0 1 0 0 0 0 1 { } w R () a (a) (b) CPS1, 9: Computer Graphics D Geometric Transforms Page

Rotation w.r.t. -ais Substitute! ;! ;!. 0 = cos, sin 0 = sin + cos 0 0 = 00 11 1 00 11 00 0000 11 1111 00 0000 11 1111 0 0 0 w 0 = 1 0 0 0 0 cos, sin 0 0 sin cos 0 0 0 0 1 { } w R () g (a) (b) CPS1, 9: Computer Graphics D Geometric Transforms Page

Rotation w.r.t. -ais Substitute! ;! ;! in the previous equations. 0 = cos, sin 0 = sin + cos 0 = 01 01 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 0 0 0 w 0 = cos 0 sin 0 0 1 0 0, sin 0 cos 0 0 0 0 1 { } w R () b (a) (b) CPS1, 9: Computer Graphics D Geometric Transforms Page

Rotation wrt a Point p f u p f (a) (b) p f p f R(; p) = T(p) R () T(,p) CPS1, 9: Computer Graphics D Geometric Transforms Page

Transformations in OpenGL Vertices CTM Vertices glmatrimode (mode) Species the matri that will be modied. GL MODELVIEW, GL PROJECTION, GL TEXTURE. glloadidentit () Sets the current matri to the identit matri. glloadmatriffdg (tpe *M) Sets the current matri to M. glmultmatriffdg (tpe *M) Multiplies the current matri b M; C: current matri. C = C M: CPS1, 9: Computer Graphics D Geometric Transforms Page

Transformations in OpenGL gltranslateffdg (,, ) Translates an object b (; ; ). C = C T (; ; ) glscaleffdg (,, ) Scales an object b (; ; ). C = C S(; ; ) glrotateffdg (,,, ) Rotates an object b angle w.r.t. the ra emanating from the origin to the point (; ; ). C = C R(; ; ; ) CPS1, 9: Computer Graphics D Geometric Transforms Page 8

Order of multiplication Last transformation is applied rst! glloadidentit(); glmultmatrif (L); glmultmatrif (M); glmultmatrif (N); glbegin(gl POINT) glvertef(v); glend(); C = I C = L C = L M C = L M N v 0 = C v = L M N v CPS1, 9: Computer Graphics D Geometric Transforms Page 9

Order of multiplication T R gltranslatef (T ); glrotatef (R); Assume the object comes with its own coordinate sstem. Keep the object coordinates the same as world coordinates and transform the object. Transform the object coordinate sstem. CPS1, 9: Computer Graphics D Geometric Transforms Page 0

Multiple Coordinate sstems C i : i-th coordinate sstem. P (i) : Coordinates of P in C i M ij : Transformation C j! C i. C P (i) = M ij P (j) : C C1 M ik = M ij M jk M ij = M,1 ji : Q (j) : A geometric transform in C j. Q (i) = M ij Q (j) M ji = M ij Q (j) M,1 ij : CPS1, 9: Computer Graphics D Geometric Transforms Page 1

Multiple Coordinate Sstems wo World-coordinate sstem tr Triccle-coordinate sstem wo wh tr tr wo wh wh Wheel-coordinate sstem Coordinate sstems: World, triccle, wheels As the front wheel rotates around its -ais: Both wheels rotate about the -aes of wheels coordinate sstem. Triccle moves as a whole. Both triccle and wheels move w.r.t world coordinates. Wheel and triccle coordinates are related b translation in and directions and rotation in -direction. CPS1, 9: Computer Graphics D Geometric Transforms Page