2IV60 Computer graphics set 4:3D transformations and hierarchical modeling Jack van Wijk TU/e.

Slides:



Advertisements
Similar presentations
CS 691 Computational Photography Instructor: Gianfranco Doretto Image Warping.
Advertisements

Computer Graphics Lecture 4 Geometry & Transformations.
Arbitrary Rotations in 3D Lecture 18 Wed, Oct 8, 2003.
Three Dimensional Modeling Transformations
1 ME 302 DYNAMICS OF MACHINERY Dynamic Force Analysis IV Dr. Sadettin KAPUCU © 2007 Sadettin Kapucu.
1 Computer Graphics Chapter 6 2D Transformations.
Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)
1 Geometrical Transformation 2 Outline General Transform 3D Objects Quaternion & 3D Track Ball.
CMPE 466 COMPUTER GRAPHICS
2D/3D Geometric Transformations CS485/685 Computer Vision Dr. George Bebis.
Image Warping : Computational Photography Alexei Efros, CMU, Fall 2008 Some slides from Steve Seitz
Ch. 2: Rigid Body Motions and Homogeneous Transforms
3D orientation.
Introduction to ROBOTICS
Computer Graphics (Fall 2008) COMS 4160, Lecture 3: Transformations 1
Math for CSLecture 11 Mathematical Methods for Computer Science Lecture 1.
Transformations I CS5600Computer Graphics by Rich Riesenfeld 27 February 2002 Lecture Set 5.
Math for CSTutorial 11 Matrix Multiplication Rule Matrices make linear transformations of vectors.
Transformations CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Introduction to ROBOTICS
2IV60 Computer Graphics 2D transformations
3D Graphics Goal: To produce 2D images of a mathematically described 3D environment Issues: –Describing the environment: Modeling (mostly later) –Computing.
2IV60 Computer Graphics Basic Math for CG
Rotations and Translations
COS 397 Computer Graphics Svetla Boytcheva AUBG, Spring 2013.
5.2 Three-Dimensional Geometric and Modeling Transformations 2D3D Consideration for the z coordinate.
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
CS 480/680 Computer Graphics Transformations Dr. Frederick C Harris, Jr.
Kinematics of Robot Manipulator
Computer Graphics Bing-Yu Chen National Taiwan University.
Geometric Transformations Jehee Lee Seoul National University.
Rotations and Translations
CSE 681 Review: Transformations. CSE 681 Transformations Modeling transformations build complex models by positioning (transforming) simple components.
Transformations Jehee Lee Seoul National University.
CS 376 Introduction to Computer Graphics 02 / 16 / 2007 Instructor: Michael Eckmann.
Transformations Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Jinxiang Chai Composite Transformations and Forward Kinematics 0.
Geometric Objects and Transformation
Geometrical Transformations 2 Adapted from Fundamentals of Interactive Computer Graphics, Foley and van Dam, pp , by Geb Thomas.
Transformation.
Computer Graphics 3D Transformations. Translation.
Geometric Transformations Hearn & Baker Chapter 5 Some slides are taken from Robert Thomsons notes.
Geometric Transformations Sang Il Park Sejong University Many slides come from Jehee Lee’s.
3D Transformation A 3D point (x,y,z) – x,y, and z coordinates
Geometric Transformations UBI 516 Advanced Computer Graphics Aydın Öztürk
COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS D Geometric Transformations Graphics Systems.
January 19, y X Z Translations Objects are usually defined relative to their own coordinate system. We can translate points in space to new positions.
3-D Geometric Transformations
3D Geometric Transformation
3D Geometric Transformation
3-D Transformational Geometry CS418 Computer Graphics John C. Hart.
CSCI 425/ D Mathematical Preliminaries. CSCI 425/525 2 Coordinate Systems Z X Y Y X Z Right-handed coordinate system Left-handed coordinate system.
Fall 2004CS-321 Dr. Mark L. Hornick 1 2-D Transformations World Coordinates Local/Modelling Coordinates x y Object descriptions Often defined in model.
Digital Image Processing Additional Material : Imaging Geometry 11 September 2006 Digital Image Processing Additional Material : Imaging Geometry 11 September.
Euler Angles This means, that we can represent an orientation with 3 numbers Assuming we limit ourselves to 3 rotations without successive rotations about.
Homogeneous Coordinates and Matrix Representations Cartesian coordinate (x, y, z) Homogeneous coordinate (x h, y h, z h, h) Usually h = 1. But there are.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Computer Graphics I, Fall 2010 Transformations.
Forward Kinematics Where is my hand ?. Examples Denavit-Hartenberg Specialized description of articulated figures (joints) Each joint has only one degree.
Week 5 - Monday.  What did we talk about last time?  Lines and planes  Trigonometry  Transforms  Affine transforms  Rotation  Scaling  Shearing.
CS 325 Introduction to Computer Graphics 02 / 19 / 2010 Instructor: Michael Eckmann.
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,
Transformations University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016 Tamara Munzner.
Objectives Introduce standard transformations Introduce standard transformations Derive homogeneous coordinate transformation matrices Derive homogeneous.
Geometric Transformations Hearn & Baker Chapter 5
Computer Graphics CC416 Week 15 3D Graphics.
2D Geometric Transformations
CSCE441: Computer Graphics 2D/3D Transformations
Presentation transcript:

2IV60 Computer graphics set 4:3D transformations and hierarchical modeling Jack van Wijk TU/e

From 2D to 3D Much +/- the same: Rotation more complex Translation, scaling Homogeneous vectors: one extra coordinate Matrices: 4x4 Rotation more complex

3D Translation 1 Translate over vector (tx, ty, tz ): x’=x+ tx, y’=y+ ty , z’=z+ tz or y P+T T P x z H&B 9-1:304-305

3D Translation 2 In 4D homogeneous coordinates: y P+T T P x z H&B 9-1:304-305

3D Rotation 1 z y P’ a P x H&B 9-2:305-313

3D Rotation 2 Rotation around axis: z y z z y y x x x Rotation around axis: Counterclockwise, viewed from rotation axis H&B 9-2:305-313

3D Rotation 3 Rotation around axes: Cyclic permutation coordinate axes z z y z y y x x x Rotation around axes: Cyclic permutation coordinate axes H&B 9-2:305-313

3D Rotatie 4 H&B 9-2:305-313

3D Rotation around arbitrary axis 1 2 3 z P’ y a P Q 1 x H&B 9-2:305-313

3D Rotation around arbitrary axis 2 Rotation around axis through two points P1 and P1 . More complex: Translate such that axis goes through origin; Rotate… Translate back again. y x z H&B 9-2:305-313

3D Rotation around arbitrary axis 3 z x y z x y 1. translate axis z x y 2. rotate axis Initial z x y 3. rotate around z-axis 4. rotate back z x y z x y 5. translate back

3D Rotation around arbitrary axis 3 z x y z x y 1. translate axis z x y 2. rotate axis R T(P1) Initial z x y 3. rotate around z-axis 4. rotate back z x y z x y 5. translate back Rz() R1 T(P1)

3D Rotation around arbitrary axis 3 M = T(P1) R1Rz() RT(P1) z x y z x y 1. translate axis z x y 2. rotate axis R T(P1) Initial z x y 3. rotate around z-axis 4. rotate back z x y z x y 5. translate back Rz() R1 T(P1)

3D Rotation around arbitrary axis 4 Difficult step: R y y 2. rotate axis z x x z Find rotation such that rotation axis aligns with z-axis. Two options: Step by step by step (see H&B, 309-312) Direct derivation of matrix H&B 9-2:305-313

3D Rotation around arbitrary axis 5 Construct orthonormal axis frame u, v, w; Invent rotation matrix R, such that: u is mapped to z-axis; v is mapped to y-axis; w is mapped to x-axis. y x z H&B 9-2:305-313

3D Rotation around arbitrary axis 6 Construct orthonormal axis frame u, v, w: u = (P2P1) / |P2P1| v = u  (1,0,0) / | u  (1,0,0) | w = v  u (If u = (a, 0, 0), then use (0, 1, 0)) This frame is orthonormal: Unit length axes: u.u = v.v = w.w = 1 All axes perpendicular: u.v = v.w = w.u = 0 y x z H&B 9-2:305-313

3D Rotation around arbitrary axis 7 z H&B 9-2:305-313

3D Rotation around arbitrary axis 8 ind y x z Done! But how to find R1 ? H&B 9-2:305-313

Inverse of rotation matrix 1 Each rotation matrix is an orthonormal matrix M: The frame u, v, w is orthonormal: Unit length axes: u.u = v.v = w.w = 1 All axes perpendicular: u.v = v.w = w.u = 0. Requested: M-1 such that M-1M = I y x z H&B 9-2:305-313

Inverse of rotation matrix 2 Requested: M-1 such that M-1M = I Solution: In words: The inverse of a rotation matrix is the transpose. (For a rotation around the origin). H&B 9-2:305-313

Inverse of rotation matrix 3 Requested: M-1 such that M-1M = I Solution: M-1 = M-T Check: H&B 9-2:305-313

3D Rotation with quaternions Extension of complex numbers Four components Scalar value + 3D vector: q=(s,v) Special calculation rules Compact description of rotations To be used if many complex rotations have to be done (esp. animation) H&B 9-2:313-317

3D scaling Scale with factors sx, sy,sz : x’= sx x, y’= sy y, z’= sz z H&B 9-3:317-319

More 3D transformations +/- same as in 2D: Matrix concatenation by multiplication Reflection Shearing Transformations between coordinate systems H&B 9-4, 9-5, 9-6:319-324

Affine transformations 1 Generic name for these transformations: affine transformations H&B 9-7:324

Affine transformations 2 Properties: Transformed coordinates x’,y’ and z’ are linearly dependent on original coordinates x, y en z. Parameters aij en bk are constant and determine type of transformation; Examples: translation, rotation, scaling, reflection Parallel lines remain parallel Only translation, rotation reflection: angles and lengths are maintained H&B 9-7:324

Hierarchical modeling 1 ComplexObject::= Composition of Objects Object::= SimpleObject or ComplexObject puppet head torso arms legs left arm right arm lower arm upper arm hand H&B 11:383-391

Hierarchical modeling 2 Hierarchical model: tree structure … puppet head torso arms legs left arm right arm lower arm upper arm hand H&B 11:383-391

Hierarchical modeling 3 Hierarchical model: tree structure or directed, acyclic graph puppet head torso arms legs left arm right arm lower arm upper arm hand H&B 11:383-391

Hierarchical modeling 4 Leaf: primitive object geometric object, possibly parametrised Composite node: instruction for composition (usually union) Leafs, nodes and/or edges: transformations + other data H&B 11:383-391

Hierarchical modeling 5 Local coordinates: coordinates of node world coordinates train coordinates wheel coordinates world train wheel H&B 11:383-391

Hierarchical modeling 6 Implementation: Many variations possible. DrawWorld DrawTrain(P1, S1); DrawTrain(P2, S2); DrawTrain(P, S); Translate(P); Scale(S); DrawChimney(); … DrawWheel(W1); DrawWheel(W2); DrawWheel(W3); Scale(1/S); Translate(-P); DrawWheel(W); Translate(W); DrawCircle(radius); Translate(-W); wereld trein wiel H&B 11:383-391

Hierarchical modeling 7 Use structure of model to structure implementation: Hierarchy (use classes, procedures and functions); Regularity (use loops); Variation (use conditions). How many lines of code you need for this picture? H&B 11:383-391

Hierarchical modeling 7 DrawTwoGrids DrawGrid; Translate(7,0); DrawGrid for i := 1 to 5 do for j := 1 to 5 do DrawCell(i, j, (i+j) mod 2 = 0); DrawCell(x, y, use_red) SetColor(dark_grey); DrawRect(x+0.2,y, 0.7, 0.7); if use_red then SetColor(red) else SetColor(light_grey); DrawRect(x, y+0.2, 0.7, 0.7); How many lines of code you need for this picture? Mwah, 10-20 should do H&B 11:383-391

Next… We know how to transform objects Next step: Viewing objects