Recall: Function Calls to Create Transform Matrices

Similar documents
Computer Graphics CS 543 Lecture 5 (Part 2) Implementing Transformations

Computer Graphics (CS 4731) Lecture 11: Implementing Transformations. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Computer Graphics (CS 4731) Lecture 11: Implementing Transformations. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

CSCE 155N Spring Homework Assignment 3: Coordinates Transformation Tool 1. Assigned: February 15, 2013 Due: March 8, 2013

Control of industrial robots. Control with vision sensors

Transformations. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Objectives. transformation. General Transformations. Affine Transformations. Notation. Pipeline Implementation. Introduce standard transformations

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

10.2 Solving Quadratic Equations by Completing the Square

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

CSCE 155N Fall Homework Assignment 3: Coordinates Transformation Tool 1. Assigned: September 29, 2016 Due: October 20, 2016

CS 543: Computer Graphics. 3D Transformations

CS 450: COMPUTER GRAPHICS REVIEW: CLIPPING SPRING 2015 DR. MICHAEL J. REALE

Modeling Transformations

CS 543: Computer Graphics Lecture 4 (Part I): 3D Affine transforms. Emmanuel Agu

Modeling Transformations

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

CSCI-4972/6963 Advanced Computer Graphics

What and Why Transformations?

Computer Graphics (CS 543) Lecture 4a: Introduction to Transformations

CS D Transformation. Junqiao Zhao 赵君峤

What does OpenGL do?

Order of Transformations

Modeling Transformations Revisited

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

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

Projections. Let us start with projections in 2D, because there are easier to visualize.

4. Two Dimensional Transformations

High Dimensional Rendering in OpenGL

Introduction to Computer Graphics with WebGL

CS 251, Winter 2019, Assignment % of course mark

Curves and Surfaces. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

IMGD The Game Development Process: 3D Modeling and Transformations

CS 4204 Computer Graphics

Computer Graphics. Geometric Transformations

Motivation. General Idea. Goals. (Nonuniform) Scale. Outline. Foundations of Computer Graphics. s x Scale(s x. ,s y. 0 s y. 0 0 s z.

Computer Graphics. Geometric Transformations

ANNALS of Faculty Engineering Hunedoara International Journal of Engineering

Computer Graphics. P04 Transformations. Aleksandra Pizurica Ghent University

A sufficient condition for spiral cone beam long object imaging via backprojection

Homogeneous Coordinates

Computer Graphics (CS 543) Lecture 6a: Viewing & Camera Control. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Application of Propositional Logic - How to Solve Sudoku? Moonzoo Kim

Three Lorentz Transformations. Considering Two Rotations

Picking and Curves Week 6

CS Computer Graphics: Transformations & The Synthetic Camera

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

CSC 470 Computer Graphics

Using Singular Value Decomposition to Compare Correlated Modal Vectors

CS 153 Design of Operating Systems Spring 18

CS452/552; EE465/505. Transformations

Application of Propositional Logic - How to Solve Sudoku? Moonzoo Kim

CS 4731/543: Computer Graphics Lecture 5 (Part I): Projection. Emmanuel Agu

An Event Display for ATLAS H8 Pixel Test Beam Data

To Do. Demo (Projection Tutorial) Motivation. What we ve seen so far. Outline. Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 5: Viewing

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

Scene Graphs & Modeling Transformations COS 426

Computer Graphics CS 543 Lecture 4 (Part 2) Building 3D Models (Part 2)

Transformations. Standard Transformations. David Carr Virtual Environments, Fundamentals Spring 2005 Based on Slides by E. Angel

TDT4255 Friday the 21st of October. Real world examples of pipelining? How does pipelining influence instruction

Introduction to Computer Graphics with WebGL

Chap 7, 2009 Spring Yeong Gil Shin

Two Dimensional Viewing

EXAMINATIONS 2010 END OF YEAR NWEN 242 COMPUTER ORGANIZATION

Object Pose from a Single Image

Recall: Indexing into Cube Map

Introduction to Seismology Spring 2008

Motivation. What we ve seen so far. Demo (Projection Tutorial) Outline. Projections. Foundations of Computer Graphics

Transformations II. Week 2, Wed Jan 17

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

6. Modelview Transformations

The extra single-cycle adders

More on Transformations. COS 426, Spring 2019 Princeton University

Comp 410/510 Computer Graphics Spring Programming with OpenGL Part 4: Three Dimensions

POWER-OF-2 BOUNDARIES

STRAND I: Geometry and Trigonometry. UNIT 37 Further Transformations: Student Text Contents. Section Reflections. 37.

Modeling Transformations

Image Warping. Some slides from Steve Seitz

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

The final datapath. M u x. Add. 4 Add. Shift left 2. PCSrc. RegWrite. MemToR. MemWrite. Read data 1 I [25-21] Instruction. Read. register 1 Read.

CS 251, Winter 2018, Assignment % of course mark

SCREEN LAYOUT AND HANDLING

Scheduling Contract Algorithms on Multiple Processors

Recursion examples: Problem 2. (More) Recursion and Lists. Tail recursion. Recursion examples: Problem 2. Recursion examples: Problem 3

Special Relativistic (Flight-)Simulator

CS 335 Graphics and Multimedia. Geometric Warping

STRAND J: TRANSFORMATIONS, VECTORS and MATRICES

Viewing. Cliff Lindsay, Ph.D. WPI

The single-cycle design from last time

Chapter 6: Pipelining

Orientation of the coordinate system

Modeling Transformations

Review Multicycle: What is Happening. Controlling The Multicycle Design

CMSC 425: Lecture 10 Basics of Skeletal Animation and Kinematics

Math 26: Fall (part 1) The Unit Circle: Cosine and Sine (Evaluating Cosine and Sine, and The Pythagorean Identity)

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

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

An Effective Hardware Architecture for Bump Mapping Using Angular Operation

Topic 7: Transformations. General Transformations. Affine Transformations. Introduce standard transformations

Modeling Transform. Chapter 4 Geometric Transformations. Overview. Instancing. Specify transformation for objects 李同益

Transcription:

Reall: Fntion Calls to Create Transform Matries Previosl made fntion alls to generate 44 matries for identit, translate, sale, rotate transforms Pt transform matri into CTM Eample mat4 m = Identit(; CTM Matri

Arbitrar Matries Can mltipl b matries from transformation ommands (Translate, Rotate, Sale into CTM Can also load arbitrar 44 matries into CTM Load into CTM Matri 34 2 24 5 3 3 2 2

Matri Staks CTM is atall not jst matri bt a matri STACK Mltiple matries in stak, rrent matri at top Can save transformation matries for se later (psh, pop E.g: Traversing hierarhial data strtres (Ch. 8 Pre 3. OpenGL also maintained matri staks Right now jst implement level CTM Matri stak later for hierarhial transforms

Reading Bak State Can also aess OpenGL variables (and other parts of the state b qer fntions glgetintegerv glgetfloatv glgetbooleanv glgetdoblev glisenabled Eample: to find ot maimm nmber of tetre nits glgetintegerv(gl_max_texture_units, &MaTetreUnits;

Using Transformations Eample: se idle fntion to rotate a be and mose fntion to hange diretion of rotation Start with program that draws be as before Centered at origin Sides aligned with aes

Reall: main. void main(int arg, har **argv { gltinit(&arg, argv; gltinitdisplamode(glut_double GLUT_RGB GLUT_DEPTH; gltinitwindowsie(5, 5; gltcreatewindow("olorbe"; gltreshapefn(mreshape; } gltdisplafn(displa; gltidlefn(spincbe; gltmosefn(mose; glenable(gl_depth_test; gltmainloop(; Calls spincbe ontinosl Whenever OpenGL program is idle

Reall: Idle and Mose allbaks void spincbe( { theta[ais] += 2.; if( theta[ais] > 36. theta[ais] -= 36.; gltpostredispla(; } void mose(int btton, int state, int, int { if(btton==glut_left_button && state == GLUT_DOWN ais = ; if(btton==glut_middle_button && state == GLUT_DOWN ais = ; if(btton==glut_right_button && state == GLUT_DOWN ais = 2; }

Displa allbak void displa( { glclear(gl_color_buffer_bit GL_DEPTH_BUFFER_BIT; tm = RotateX(theta[]*RotateY(theta[] *RotateZ(theta[2]; gluniformmatri4fv(matri_lo,,gl_true,tm; gldrawarras(gl_triangles,, N; gltswapbffers(; } Alternativel, we an send rotation angle +ais to verte shader, Let shader form CTM then do rotation Ineffiient: if mesh has, verties eah one forms CTM, redndant!!!!

Using the Model view Matri In OpenGL the model view matri sed to Transform 3D models (translate, sale, rotate Position amera (sing LookAt fntion (net The projetion matri sed to define view volme and selet a amera lens (later Althogh these matries no longer part of OpenGL, good to reate them in or appliations (as CTM

3D? Interfaes Major interative graphis problem: how to se 2D devies (e.g. mose to ontrol 3D objets Some alternatives Virtal trakball 3D inpt devies sh as the spaeball Use areas of the sreen Distane from enter ontrols angle, position, sale depending on mose btton depressed

Compter Graphis 473 Letre : Rotations and Matri Conatenation Prof Emmanel Ag Compter Siene Dept. Worester Poltehni Institte (WPI

Reall: 3D Translate Eample Eample: If we translate a point (2,2,2 b displaement (2,4,6, new loation of point is (4,6,8 objet Translation of objet 8 6 4 6 4 2 2 2 2 Translate(2,4,6 Translation Matri Original point Translated point Translated : 2 + 2 = 4 Translated : 2 + 4 = 6 Translated : 2 + 6 = 4

Reall: 3D Sale Eample If we sale a point (2,4,6 b saling fator (.5,.5,.5 Saled point position = (, 2, 3 6 4 2.5.5.5 3 2 Sale Matri for Sale(.5,.5,.5 Saled : 2.5 = Saled : 4.5 = 2 Saled : 6.5 = 3 Saled point Original point

Nate Robbins Translate, Sale Rotate Demo

Rotating in 3D Man degrees of freedom. Rotate abot what ais? 3D rotation: abot a defined ais Different transform matri for: Rotation abot ais Rotation abot ais Rotation abot ais +

Rotating in 3D New terminolog X roll: rotation abot ais Y roll: rotation abot ais Z roll: rotation abot ais Whih wa is +ve rotation Look in ve diretion (into +ve arrow CCW is +ve rotation +

Rotating in 3D

Rotating in 3D For a rotation angle, abot an ais Define: os sin s s s R -roll or (RotateX

Rotating in 3D s s R -roll (or RotateY s s R -roll (or RotateZ Rles: Write in rotation row, olmn Write in the other rows/olmns Write,s in ret pattern

Eample: Rotating in 3D Qestion: Using -roll eqation, rotate P = (3,,4 b 3 degrees: Answer: = os(3 =.866, s = sin(3 =.5, and M m m m 2 3 m m m 2 22 32 m m m 3 23 33 m m m 4 24 34 Line : 3. +. + 4.s +. = 3.866 + 4.5 = 4.6

3D Rotation Rotate(angle,,, : rotate b angle β abot an arbitrar ais (a vetor passing throgh origin and (,, Note: Anglar position of speified as aimth/longitde (Θ and latitde (φ (,, Origin P Q β

Approah : 3D Rotation Abot Arbitrar Ais Can ompose arbitrar rotation as ombination of: X roll (b an angle β Y roll (b an angle β 2 Z roll (b an angle β 3 M R ( 3 R ( 2 R ( Read in reverse order

Approah : 3D Rotation sing Eler Theorem Classi: se Eler s theorem Eler s theorem: an seqene of rotations = one rotation abot some ais Want to rotate abot arbitrar ais throgh origin Or approah:. Use two rotations to align and ais 2. Do roll throgh angle 3. Negate two previos rotations to de align and ais

Approah : 3D Rotation sing Eler Theorem Note: Anglar position of speified as aimth (Θ and latitde (φ First tr to align with ais

Approah : 3D Rotation sing Eler Theorem Step : Do roll to line p rotation ais with plane ( R Θ

Approah : 3D Rotation sing Eler Theorem Step 2: Do roll to line p rotation ais with ais R ( R ( φ

Approah : 3D Rotation sing Eler Theorem Remember: Or goal is to do rotation b β arond Bt ais is now lined p with ais. So, Step 3: Do roll b β arond ais R ( R ( R ( β

Approah : 3D Rotation sing Eler Theorem Net 2 steps are to retrn vetor to original position Step 4: Do roll in plane φ ( ( ( ( R R R R

Approah : 3D Rotation sing Eler Theorem Step 5: Do roll to retrn to original position Θ ( ( ( ( ( ( R R R R R R

Approah 2: Rotation sing Qaternions Etension of imaginar nmbers from 2 to 3 dimensions Reqires real and 3 imaginar omponents i, j, k q=q +q i+q 2 j+q 3 k Qaternions an epress rotations on sphere smoothl and effiientl

Approah 2: Rotation sing Qaternions Derivation skipped! Chek answer Soltion has lots of smmetr ( ( ( ( ( ( ( ( ( ( 2 2 2 s s s s s s R os sin s Arbitrar ais

Inverse Matries Can ompte inverse matries b general formlas Bt some eas inverse transform observations Translation: T - (d, d, d = T( d, d, d Saling: S (s, s, s = S ( /s, /s, /s Rotation: R (q = R( q Holds for an rotation matri

Instaning Dring modeling, often start with simple objet entered at origin, aligned with ais, and nit sie Can delare one op of eah shape in sene E.g. delare mesh for soldier, 5 instanes to reate arm Then appl instane transformation to its verties to Sale Orient Loate

Referenes Angel and Shreiner, Chapter 3 Hill and Kelle, Compter Graphis Using OpenGL, 3 rd edition