Transformations Review 4/18/2018 ©Babu 2009.

Slides:



Advertisements
Similar presentations
3D Transformations Assist. Prof. Dr. Ahmet Sayar
Advertisements

Computer Graphics: 3D Transformations
Transformations Ed Angel Professor Emeritus of Computer Science
John C. Hart CS 318 Interactive Computer Graphics
Elementary 3D Transformations - a "Graphics Engine" Transformation procedures Transformations of coordinate systems Translation Scaling Rotation.
Ch. 2: Rigid Body Motions and Homogeneous Transforms
3D Coordinate Systems and Transformations Revision 1
3-D Geometry.
3D orientation.
CSCE 689: Computer Animation Rotation Representation and Interpolation
CSCE 641: Computer Graphics Rotation Representation and Interpolation Jinxiang Chai.
Transformations CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Screw Rotation and Other Rotational Forms
CS 450: COMPUTER GRAPHICS 3D TRANSFORMATIONS SPRING 2015 DR. MICHAEL J. REALE.
1 Kinematics ( 運動學 ) Primer Jyun-Ming Chen Fall 2009.
COS 397 Computer Graphics Svetla Boytcheva AUBG, Spring 2013.
5.2 Three-Dimensional Geometric and Modeling Transformations 2D3D Consideration for the z coordinate.
CS 480/680 Computer Graphics Transformations Dr. Frederick C Harris, Jr.
Computer Graphics Bing-Yu Chen National Taiwan University.
Rotations and Translations
CS 325 Introduction to Computer Graphics 02 / 17 / 2010 Instructor: Michael Eckmann.
CS 376 Introduction to Computer Graphics 02 / 16 / 2007 Instructor: Michael Eckmann.
Advanced Computer Graphics Spring 2014
©Larry F. Hodges (modified by Amos Johnson) 1 3-D Mathematical Preliminaries & Transformations.
Jinxiang Chai Composite Transformations and Forward Kinematics 0.
Animating Rotations and Using Quaternions. What We’ll Talk About Animating Translation Animating 2D Rotation Euler Angle representation 3D Angle problems.
16/5/ :47 UML Computer Graphics Conceptual Model Application Model Application Program Graphics System Output Devices Input Devices API Function.
Geometrical Transformations 2 Adapted from Fundamentals of Interactive Computer Graphics, Foley and van Dam, pp , by Geb Thomas.
CS 551/645 Fall 2000 Parameterized Rotations, Curves, and Surfaces.
What is Kinematics. Kinematics studies the motion of bodies.
Geometric Transformations
COMPUTER GRAPHICS CS 482 – FALL 2015 SEPTEMBER 17, 2015 TRANSFORMATIONS AFFINE TRANSFORMATIONS QUATERNIONS.
3D Geometric Transformation
Euler Angles This means, that we can represent an orientation with 3 numbers Assuming we limit ourselves to 3 rotations without successive rotations about.
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 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Transformations Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
Fundamentals of Computer Animation Orientation and Rotation.
3D Geometry and Transformations
Objectives Introduce standard transformations Introduce standard transformations Derive homogeneous coordinate transformation matrices Derive homogeneous.
Forward Projection Pipeline and Transformations CENG 477 Introduction to Computer Graphics.
Kinematics 제어시스템 이론 및 실습 조현우
CA 302 Computer Graphics and Visual Programming
Computer Animation Algorithms and Techniques
Review: 3D Transforms Continued
CPSC 641: Computer Graphics Rotation Representation and Interpolation
Geometric Transformations
CS 445 / 645 Introduction to Computer Graphics
Spatcial Description & Transformation
Transformations Objectives
3D Kinematics Consists of two parts
3D Geometric Transformation
Computer Graphics CC416 Week 15 3D Graphics.
3D Transformation.
Computer Graphics Lecture 18 3-D Transformations-II Taqdees A
COMPUTER GRAPHICS CHAPTERS CS 482 – Fall 2017 TRANSFORMATIONS
Three-Dimensional Graphics
Lecture 2 Transformations
Arcball Interface Flavia R. Cavalcanti.
UMBC Graphics for Games
Transformations 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr.
Transformations Ed Angel
Geometric Objects and Transformations (II)
Transformations Ed Angel Professor Emeritus of Computer Science
CSCE441: Computer Graphics 2D/3D Transformations
VIRTUAL ENVIRONMENT.
Isaac Gang University of Mary Hardin-Baylor
Screw Rotation and Other Rotational Forms
Presentation transcript:

Transformations Review 4/18/2018 ©Babu 2009

Rotations & Transformations Output from Position Trackers Creation of Coordinate System Graphs Animation of Objects Forward and Inverse Kinematics 4/18/2018 ©Babu 2009

Review of 2D Rotation about the Origin From basic trigonometry we know that: sin(+) = y2/r; cos (+) = x2/r sin() = y1/r; cos() =x1/r From the double angle formulas in trigonometry we also know that: sin(+) = sincos + cossin  cos(+) = coscos - sinsin Substituting: y2/r = (y1/r)cos + (x1/r)sin y2 = x1sin + y1cos By a similar calculation: x2 = x1cos - y1sin X Y (0,0) P2 = (x2,y2) P1 = (x1,y1)  r  y2 y1 x2 x1 4/18/2018 ©Babu 2009

2D Rotation about the Origin y2 = x1sin + y1cos; x2 = x1cos - y1sin 2D Rotations are usually expressed as a matrix multiplication. Negative Rotation (remember that cos(-) = cos() and sin(-) = -sin): 4/18/2018 ©Babu 2009

3D rotations about an x,y, or z axis are trivial extensions of 2D rotations about the origin For example, consider a rotation of 90 degrees about the x-axis. The y and z coordinates change but the x coordinate is not affected. A 3D rotation about one of the major axes occurs in a 2D plane defined by the point’s coordinate relative to that axis (x = 0 plane in this case). (0,d,0) Z (0,0,d) X 4/18/2018 ©Babu 2009

3D Rotation about the x axis By looking at the 2D rotation matrix we can write down what the 3D rotation matrix about the x axis must look like: 4/18/2018 ©Babu 2009

In interactive computer graphics (including VR) we need to be able to make sense of: Notation – How we write down an operation. Implementation – How we code the operation. Meaning – What the operation does to an object. 4/18/2018 ©Babu 2009

Cartesian Coordinate System +Z -Z -Y +Y -X +X Left Handed -Z +Z -Y +Y -X +X Right Handed 4/18/2018 ©Babu 2009

Euclidean Space Scalars Points: P = (x,y,z) Vectors: V = [x,y,z] Magnitude or distance ||V|| = (x2+y2+z2) Direction No position Position vector Think of as magnitude and distance relative to a point, usually the origin of the coordinate system 4/18/2018 ©Babu 2009

Review of Common Vector Operations in 3D Addition of vectors V1+V2 = [x1,y1,z1] + [x2,y2,z2] = [x1+x2, y1+y2, z1+z2] Multiply a scalar times a vector sV = s[x,y,z] = [sx,sy,sz] Dot Product V1V2 = [x1,y1,z1][x2,y2,z2] = [x1x2+y1y2+z1z2] V1V2 = ||V1|| ||v2|| cos where  is the angle between V1 and V2 Cross Product of two Vectors V1V2 = [x1,y1,z1][x2,y2,z2] = [y1z2-y2z1, x2z1-x1z2, x1y2-x2y1] = - V2V1 Results in a vector that is orthogonal to the plane defined by V1 and V2 4/18/2018 ©Babu 2009

Transformations Rotations Translations Scale About the major axes of a coordinate system About an arbitrary vector Translations Relative to a coordinate system Scale Relative to a coordinate system and about a fixed point 4/18/2018 ©Babu 2009

Translations are defined relative to the x,y, and z axes Notation: P’ = Tx(5)P Implementation Meaning: Move the position of point P five units in a positive direction with respect to the x axis New point is (x+5, y, z) 4/18/2018 ©Babu 2009

Scales Notation: P’ = Sx(1/2)P Implementation Meaning: Scale the point P by ½ in the x coordinate. New point is (1/2x, y, z) 4/18/2018 ©Babu 2009

Scales can move things! Consider a line between x = 2 and x = 6 Scale by ½ on each endpoint. New line is ½ as long but also starts at a new place. Usually want to guarantee that you scale relative to a fixed point that makes sense. One end Middle Do this by combining translations with scales Tx(-2)Sx(1/2)Tx(2) x 1 2 3 4 5 6 4/18/2018 ©Babu 2009

Shears XY sheared on Z y x z Of course other combinations occur too, e.g. ZX sheared on Y, X sheared on Y, etc. 4/18/2018 ©Babu 2009

Rotations are usually defined relative to the x,y and z axes (Euler angles) Axis of rotation is Direction of positive rotation is x y to z y z to x z x to y x y z How to remember 4/18/2018 ©Babu 2009

Rotation about the x axis Notation P’ = Rx(30)P Implementation (Homogenous Coordinates) Meaning Rotate a point P a positive 30 degrees about the x-axis y z x 4/18/2018 ©Babu 2009

Rotation about the y axis Notation P’ = Ry(30)P Implementation (Homogenous Coordinates) Meaning Rotate a point P a positive 30 degrees about the y-axis z x y 4/18/2018 ©Babu 2009

Rotation about the z axis Notation P’ = Rz(30)P Implementation (Homogenous Coordinates) Meaning Rotate a point P a positive 30 degrees about the z-axis x y z 4/18/2018 ©Babu 2009

Describing Orientation with Euler Angles Orientation of an object in computer graphics is often described using Euler Angles. Rx Ry Rz Any axis order will work and could be used. Yaw, Pitch & Roll BUT, order makes a difference in the result. A related method is to use a rotation matrix 4/18/2018 ©Babu 2009

Rotation About An Arbitrary Axis p2 u Z θ p1 Y 4/18/2018 ©Babu 2009 X

Rotation About An Arbitrary Axis Translate p1 to origin p2 T(-p1) u Z p1 u' Y 4/18/2018 ©Babu 2009 X

Rotation About An Arbitrary Axis Rotate u' to u'' in YZ plane (rotation about Y axis, Ry(-β)) Ry(-β)) ∙ T(-p1) Z u' uz c Y a ß uy b ux 4/18/2018 ©Babu 2009 X

Rotation About An Arbitrary Axis Rotate u' to u'' in YZ plane (rotation about Y axis, Ry(-β)) Ry(-β)) ∙ T(-p1) Z u'' u' uz c Y a ß uy b ux 4/18/2018 ©Babu 2009 X , Larry F. Hodges

Rotation About An Arbitrary Axis After Ry(-ß), angle α and u'' lies in the y-z plane. Next, Rotate u'' to Z axis (u''') (rotation about X axis, Rx(α)) Rx(α) ∙ Ry(-β) ∙ T(-p1) u'' Z a c uz Y α uy ux 4/18/2018 ©Babu 2009 X , Larry F. Hodges

Rotation About An Arbitrary Axis After Rx(α), u'' lies in the Z axis as u'''. Next, rotate about Z by θ (Rz(θ)) Rz(θ) ∙ Rx(α) ∙ Ry(-β) ∙ T(-p1) u''' Z u'' Y θ 4/18/2018 ©Babu 2009 X

Rotation About An Arbitrary Axis Now we’ve rotated about U. Next, apply the inverse transformations to place u''' back on u p2 R((p1,p2),θ) = T(p1) ∙ Ry(β) ∙ Rx(-α) ∙ Rz(θ) ∙ Rx(α) ∙ Ry(-β) ∙ T(-p1) u Z θ p1 Y 4/18/2018 ©Babu 2009 X

Rotation About An Arbitrary Axis 4/18/2018 ©Babu 2009

Problem with Euler Angles What if we want to produce a smooth animation of a rotation from point P1 to Point P2 around some axis. The entire rotation is defined as RxRyRz but how do we get an intermediate point? Rotations are defined as rotations about the x, y and z axes. Rotations about any other vector in space have to be broken down into equivalent rotations about the major axes. 4/18/2018 ©Babu 2009

Smooth Rotation y With Euler Angles, knowing the transformations for the entire rotation does not help us with the intermediate rotations. Each is a unique set of three rotations about the x,y and z axes z x 4/18/2018 ©Babu 2009

Problems with Euler Angles Rotations not uniquely defined ex: (z, x, y) = (90, 45, 45) = (45, 0, -45) takes positive x-axis to (1, 1, 1) Cartesian coordinates are independent of one another, but Euler angles are not Remember, the axes stay in the same place during rotations Gimbal Lock Term derived from mechanical problem that arises in gimbal mechanism that supports a compass or a gyro Second and third rotations have effect of transforming earlier rotations, we lose a degree of freedom ex: Rot z, Rot y, Rot x If Rot z = 90 degrees, Rot y is equivalent to Rot x 4/18/2018 ©Babu 2009

Quaternions – next topic! Invented by Sir William Hamilton (1843) Do not suffer from Gimbal Lock Provide a natural way to interpolate intermediate steps in a rotation about an arbitrary axis Are used in many position tracking systems and VR software support systems 4/18/2018 ©Babu 2009