Moving Objects. We need to move our objects in 3D space.

Like dokumenter
Slope-Intercept Formula

Trigonometric Substitution

UNIVERSITETET I OSLO

Solutions #12 ( M. y 3 + cos(x) ) dx + ( sin(y) + z 2) dy + xdz = 3π 4. The surface M is parametrized by σ : [0, 1] [0, 2π] R 3 with.

Neural Network. Sensors Sorter

Dynamic Programming Longest Common Subsequence. Class 27

Ringvorlesung Biophysik 2016

Unit Relational Algebra 1 1. Relational Algebra 1. Unit 3.3

Physical origin of the Gouy phase shift by Simin Feng, Herbert G. Winful Opt. Lett. 26, (2001)

SVM and Complementary Slackness

Graphs similar to strongly regular graphs

Ressurser. OpenCV documentation: Eigen documentation : C++: Image Watch: An image debugger plug-in for Visual Studio

Endelig ikke-røyker for Kvinner! (Norwegian Edition)

KROPPEN LEDER STRØM. Sett en finger på hvert av kontaktpunktene på modellen. Da får du et lydsignal.

Universitetet i Bergen Det matematisk-naturvitenskapelige fakultet Eksamen i emnet Mat131 - Differensiallikningar I Onsdag 25. mai 2016, kl.

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

Administrasjon av postnummersystemet i Norge Post code administration in Norway. Frode Wold, Norway Post Nordic Address Forum, Iceland 5-6.

FYSMEK1110 Eksamensverksted 23. Mai :15-18:00 Oppgave 1 (maks. 45 minutt)

Hvordan føre reiseregninger i Unit4 Business World Forfatter:

Medisinsk statistikk, KLH3004 Dmf, NTNU Styrke- og utvalgsberegning

Gradient. Masahiro Yamamoto. last update on February 29, 2012 (1) (2) (3) (4) (5)

Trådløsnett med. Wireless network. MacOSX 10.5 Leopard. with MacOSX 10.5 Leopard

UNIVERSITY OF OSLO DEPARTMENT OF ECONOMICS

UNIVERSITETET I OSLO

UNIVERSITETET I OSLO

Ma Flerdimensjonal Analyse Øving 1

Mathematics 114Q Integration Practice Problems SOLUTIONS. = 1 8 (x2 +5x) 8 + C. [u = x 2 +5x] = 1 11 (3 x)11 + C. [u =3 x] = 2 (7x + 9)3/2

Verifiable Secret-Sharing Schemes

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

Oppgave 1a Definer følgende begreper: Nøkkel, supernøkkel og funksjonell avhengighet.

Motzkin monoids. Micky East. York Semigroup University of York, 5 Aug, 2016

Han Ola of Han Per: A Norwegian-American Comic Strip/En Norsk-amerikansk tegneserie (Skrifter. Serie B, LXIX)

Exercise 1: Phase Splitter DC Operation

Information search for the research protocol in IIC/IID

Eksamen i TMA4190 Mangfoldigheter Onsdag 4 juni, Tid :

buildingsmart Norge seminar Gardermoen 2. september 2010 IFD sett i sammenheng med BIM og varedata

Second Order ODE's (2P) Young Won Lim 7/1/14

Mannen min heter Ingar. Han er også lege. Han er privatpraktiserende lege og har et kontor på Grünerløkka sammen med en kollega.

Databases 1. Extended Relational Algebra

TFY4170 Fysikk 2 Justin Wells

Oppgave 1. ( xφ) φ x t, hvis t er substituerbar for x i φ.

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

Maple Basics. K. Cooper

Norsk (English below): Guide til anbefalt måte å printe gjennom plotter (Akropolis)

UNIVERSITY OF OSLO. Faculty of Mathematics and Natural Sciences

TMA4329 Intro til vitensk. beregn. V2017

Prosjektet Digital kontaktinformasjon og fullmakter for virksomheter Digital contact information and mandates for entities

Perpetuum (im)mobile

Den som gjør godt, er av Gud (Multilingual Edition)

Kneser hypergraphs. May 21th, CERMICS, Optimisation et Systèmes

Right Triangle Trigonometry

Newtons fargeskive. Regnbuens farger blir til hvitt. Sett skiva i rask rotasjon ved hjelp av sveiva.


FIRST LEGO League. Härnösand 2012

Speed Racer Theme. Theme Music: Cartoon: Charles Schultz / Jef Mallett Peanuts / Frazz. September 9, 2011 Physics 131 Prof. E. F.

Exam in Quantum Mechanics (phys201), 2010, Allowed: Calculator, standard formula book and up to 5 pages of own handwritten notes.

PSi Apollo. Technical Presentation

Samlede Skrifter PDF. ==>Download: Samlede Skrifter PDF ebook

Call function of two parameters

Christmas in the round A Holiday Prism for Band. Preview Only

Macbeth: Frozen Scenes

INF5820 Natural Language Processing - NLP. H2009 Jan Tore Lønning

EN Skriving for kommunikasjon og tenkning

Public roadmap for information management, governance and exchange SINTEF

Little Mountain Housing

Existence of resistance forms in some (non self-similar) fractal spaces

ECON3120/4120 Mathematics 2, spring 2004 Problem solutions for the seminar on 5 May Old exam problems

PATIENCE TÅLMODIGHET. Is the ability to wait for something. Det trenger vi når vi må vente på noe

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

Stationary Phase Monte Carlo Methods

MID-TERM EXAM TDT4258 MICROCONTROLLER SYSTEM DESIGN. Wednesday 3 th Mars Time:

PARABOLSPEIL. Still deg bak krysset

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

Trådløsnett med Windows XP. Wireless network with Windows XP

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

2018 ANNUAL SPONSORSHIP OPPORTUNITIES

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

API: Application programming interface, eller programmeringsgrensesnitt

IN2010: Algoritmer og Datastrukturer Series 2

5 E Lesson: Solving Monohybrid Punnett Squares with Coding

The internet of Health

Demografisk og økonomisk bærekraft av pensionsreformer i Norge, Sverige og Tyskland

Den som gjør godt, er av Gud (Multilingual Edition)

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

Eksamen ENG1002/1003 Engelsk fellesfag Elevar og privatistar/elever og privatister. Nynorsk/Bokmål

pnvdb Documentation Release Jan Tore Kyrdalen

of color printers at university); helps in learning GIS.

Appendix B, not for publication, with screenshots for Fairness and family background

Ma Linær Algebra og Geometri Øving 5

Dagens tema: Eksempel Klisjéer (mønstre) Tommelfingerregler

NO X -chemistry modeling for coal/biomass CFD

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

Start MATLAB. Start NUnet Applications Statistical and Computational packages MATLAB Release 13 MATLAB 6.5

Røde Kors Grunnkurs i Førstehjelp

STILLAS - STANDARD FORSLAG FRA SEF TIL NY STILLAS - STANDARD

HOW TO GET TO TØI By subway (T-bane) By tram By bus By car Fra flyplassen

Transkript:

Transformations

Moving Objects We need to move our objects in 3D space.

Moving Objects We need to move our objects in 3D space. An object/model (box, car, building, character,... ) is defined in one position (often centered around origo). Will be needed in another position in the scene.

Moving Objects We need to move our objects in 3D space. An object/model (box, car, building, character,... ) is defined in one position (often centered around origo). Will be needed in another position in the scene. Maybe in several places in one scene (town with houses and cars).

Moving Objects We need to move our objects in 3D space. An object/model (box, car, building, character,... ) is defined in one position (often centered around origo). Will be needed in another position in the scene. Maybe in several places in one scene (town with houses and cars). Maybe in different places in different scenes/frames (animation).

Moving Objects We need to move our objects in 3D space. An object/model (box, car, building, character,... ) is defined in one position (often centered around origo). Will be needed in another position in the scene. Maybe in several places in one scene (town with houses and cars). Maybe in different places in different scenes/frames (animation). Move model move triangles move points (vertices) f : R 3 R 3

Translation

Translation x x + d x f y = y + d y z z + d z

Scaling

Scaling x s x x f y = s y y z s z z

Rotation Euler [1775]: for enhver orientering af en model findes der en linie l gennem (0,0,0) og en vinkel φ, således at denne orientering opnås ved at rotere φ grader om l.

Rotation Euler [1775]: for enhver orientering af en model findes der en linie l gennem (0,0,0) og en vinkel φ, således at denne orientering opnås ved at rotere φ grader om l. Rotation around line through origin:

Rotation Euler [1775]: for enhver orientering af en model findes der en linie l gennem (0,0,0) og en vinkel φ, således at denne orientering opnås ved at rotere φ grader om l. Rotation around line through origin: f x y = z???

Rotation Simpler case: Rotation around z-axis.

Rotation Simpler case: Rotation around z-axis. From formula for rotation in 2D: x x cos φ y sin φ f y = x sin φ + y cos φ z z

Rotation Similar: Rotation around x-axis and y-axis. x x f y = y cos φ z sin φ z y sin φ + z cos φ f x z sin φ + x cos φ y = y z z cos φ x sin φ

Euler Theorem (Euler, 1775): any rotation with axis through origo can be created as three succesive rotations around the three coordinate axes. The angles of the three coordinate axis rotations are called Euler angles. Using Euler angles to specify generic rotations is often intuitive, but also has drawbacks. We will return to that later.

Matrices Move model move triangles move points (vertices) f : R 3 R 3

Matrices Move model move triangles move points (vertices) f : R 3 R 3 Any matrix induces a (linear) funktion f : R 3 R 3 : x 1 2 3 x 1x + 2y + 3z f y = 4 5 6 y = 4x + 5y + 6z z 7 8 9 z 7x + 8y + 9z

Matrices Move model move triangles move points (vertices) f : R 3 R 3 Any matrix induces a (linear) funktion f : R 3 R 3 : x 1 2 3 x 1x + 2y + 3z f y = 4 5 6 y = 4x + 5y + 6z z 7 8 9 z 7x + 8y + 9z Recall: Matrix multiplication is associative: A (B C) = (A B) C.

Matrices Move model move triangles move points (vertices) f : R 3 R 3 Any matrix induces a (linear) funktion f : R 3 R 3 : x 1 2 3 x 1x + 2y + 3z f y = 4 5 6 y = 4x + 5y + 6z z 7 8 9 z 7x + 8y + 9z Recall: Matrix multiplication is associative: A (B C) = (A B) C. Hence: x x A (B (C (E (F y )))) = ((((A B) C) E) F ) y z z

Matrices Move model move triangles move points (vertices) f : R 3 R 3 Any matrix induces a (linear) funktion f : R 3 R 3 : x 1 2 3 x 1x + 2y + 3z f y = 4 5 6 y = 4x + 5y + 6z z 7 8 9 z 7x + 8y + 9z Recall: Matrix multiplication is associative: A (B C) = (A B) C. Hence: x x A (B (C (E (F y )))) = ((((A B) C) E) F ) y z z Saves calculations: 3D object = many triangles = many points. All points go through the same sequence of transformations (moves). Calculate the matrix product once.

Matrices Move model move triangles move points (vertices) f : R 3 R 3 Any matrix induces a (linear) funktion f : R 3 R 3 : x 1 2 3 x 1x + 2y + 3z f y = 4 5 6 y = 4x + 5y + 6z z 7 8 9 z 7x + 8y + 9z Recall: Matrix multiplication is associative: A (B C) = (A B) C. Hence: x x A (B (C (E (F y )))) = ((((A B) C) E) F ) y z z Saves calculations: 3D object = many triangles = many points. All points go through the same sequence of transformations (moves). Calculate the matrix product once. Question: can all our needed transformations be expressed as matrices?

Transformations as Matrices

Transformations as Matrices Scaling x s 1 x s 1 0 0 x f y = s 2 y = 0 s 2 0 y z s 3 z 0 0 s 3 z

Transformations as Matrices Scaling x s 1 x s 1 0 0 x f y = s 2 y = 0 s 2 0 y z s 3 z 0 0 s 3 z Rotation angle φ around the z-axis x x cos φ y sin φ cos φ sin φ 0 x f y = x sin φ + y cos φ = sin φ cos φ 0 y z z 0 0 1 z

Transformations as Matrices Scaling x s 1 x s 1 0 0 x f y = s 2 y = 0 s 2 0 y z s 3 z 0 0 s 3 z Rotation angle φ around the z-axis x x cos φ y sin φ cos φ sin φ 0 x f y = x sin φ + y cos φ = sin φ cos φ 0 y z z 0 0 1 z Translation? x x + x 0??? x f y = y + y 0 =??? y z z + z 0??? z

Transformations as Matrices Scaling x s 1 x s 1 0 0 x f y = s 2 y = 0 s 2 0 y z s 3 z 0 0 s 3 z Rotation angle φ around the z-axis x x cos φ y sin φ cos φ sin φ 0 x f y = x sin φ + y cos φ = sin φ cos φ 0 y z z 0 0 1 z Translation? x x + x 0??? x f y = y + y 0 =??? y z z + z 0??? z No. For (non-trivial) translation we have f (0, 0, 0) (0, 0, 0), but all functions induced by matrices have f (0, 0, 0) = (0, 0, 0).

Homogeneous Coordinates Go to 4D: x x y y z z 1

Homogeneous Coordinates Go to 4D: And back: x x y y z z 1 x y x/w z y/w z/w w

Homogeneous Coordinates Translations (in 3D) can now be expressed as matrix multiplication: 1 0 0 x 0 x x + x 0 0 1 0 y 0 0 0 1 z 0 y z = y + y 0 z + z 0 0 0 0 1 1 1

Homogeneous Coordinates Translations (in 3D) can now be expressed as matrix multiplication: 1 0 0 x 0 x x + x 0 0 1 0 y 0 0 0 1 z 0 y z = y + y 0 z + z 0 0 0 0 1 1 1 All 3x3 matrices are still available (incl. scaling and rotation): 1 2 3 0 x 1x + 2y + 3z 4 5 6 0 7 8 9 0 y z = 4x + 5y + 6z 7x + 8y + 9z 0 0 0 1 1 1

Projection Projection to screen: f : R 3 R 2.

Projection Projection to screen: f : R 3 R 2. Prespective projection:

Projection Projection to screen: f : R 3 R 2. Prespective projection: Expressed as 4x4 matrix multiplication (d = near): 1 0 0 0 x x 0 1 0 0 0 0 1 0 y z = y xd/z z yd/z d 0 0 1/d 0 1 z/d

Transformations in OpenGL OpenGL uses 4x4-matrices/homogeneous coordinates internally. Matrices are normally created by more intuitive commands: gltranslatef(dx,dy,dz) glscalef(sx,sy,sz) glrotatef(angle,ax,ay,az)

Transformations in OpenGL OpenGL uses 4x4-matrices/homogeneous coordinates internally. Matrices are normally created by more intuitive commands: gltranslatef(dx,dy,dz) glscalef(sx,sy,sz) glrotatef(angle,ax,ay,az) Each command generates the corresponding matrix, and right-multiplies it on the current matrix. So last transformaton specified in code is first applied to vertices. Cf. the math notation f (g(h(x))) (where h is applied first to x, then g, then f ).

Transformations in OpenGL OpenGL uses 4x4-matrices/homogeneous coordinates internally. Matrices are normally created by more intuitive commands: gltranslatef(dx,dy,dz) glscalef(sx,sy,sz) glrotatef(angle,ax,ay,az) Each command generates the corresponding matrix, and right-multiplies it on the current matrix. So last transformaton specified in code is first applied to vertices. Cf. the math notation f (g(h(x))) (where h is applied first to x, then g, then f ). There is a current matrix for model-view transformations, for projections, and for textures. Each has a stack. (Note: legacy code. In shader-based code, similar techniques are used.)

Matrix Stack

The Trick Note that rotations are always around origo. To get the effect of a), a single rotation will not work, but will give the effect of b). Instead, do as in c) (translate to origo, rotate, translate back). This kind of thinking is referred to as the trick in the textbook. Similar considerations relate to scaling.