CSC Computer Graphics

Similar documents
Physically Based Rendering ( ) Geometry and Transformations

CS 335 Graphics and Multimedia. 2D Graphics Primitives and Transformation

Graphics Example: Type Setting

A Tutorial on Euler Angles and Quaternions

Affine transformations

( ) ( ) ( ) ( ) TNM046: Datorgrafik. Transformations. Linear Algebra. Linear Algebra. Sasan Gooran VT Transposition. Scalar (dot) product:

Simultaneous Orthogonal Rotations Angle

Graphics (INFOGR), , Block IV, lecture 8 Deb Panja. Today: Matrices. Welcome

Affine transformations. Brian Curless CSE 557 Fall 2014

Rigid Body Transforms-3D. J.C. Dill transforms3d 27Jan99

CS100: DISCRETE STRUCTURES. Lecture 3 Matrices Ch 3 Pages:

Linear Algebra and Matrix Inversion

CS 354R: Computer Game Technology

Affine transformations

Reading. 4. Affine transformations. Required: Watt, Section 1.1. Further reading:

Phys 201. Matrices and Determinants

ECS 178 Course Notes QUATERNIONS

sin(α + θ) = sin α cos θ + cos α sin θ cos(α + θ) = cos α cos θ sin α sin θ

Kevin James. MTHSC 3110 Section 2.1 Matrix Operations

03 - Basic Linear Algebra and 2D Transformations

CS 4300 Computer Graphics. Prof. Harriet Fell Fall 2011 Lecture 11 September 29, 2011

Matrix Arithmetic. j=1

Why Transforms? Want to animate objects and camera Translations Rotations Shears And more.. Want to be able to use projection transforms

Matrices BUSINESS MATHEMATICS

Math113: Linear Algebra. Beifang Chen

Matrices: 2.1 Operations with Matrices

We could express the left side as a sum of vectors and obtain the Vector Form of a Linear System: a 12 a x n. a m2

Course 2BA1: Hilary Term 2007 Section 8: Quaternions and Rotations

Vectors and matrices: matrices (Version 2) This is a very brief summary of my lecture notes.

Prepared by: M. S. KumarSwamy, TGT(Maths) Page

Mathematical Fundamentals

Elementary maths for GMT

RELATIVE MOTION ANALYSIS: VELOCITY (Section 16.5)

A matrix over a field F is a rectangular array of elements from F. The symbol

Matrix Algebra for Engineers Jeffrey R. Chasnov

Math 3108: Linear Algebra

CS 246 Review of Linear Algebra 01/17/19

ICS 6N Computational Linear Algebra Matrix Algebra

Linear Algebra March 16, 2019

Linear Equations and Matrix

Matrix representation of a linear map

CS-184: Computer Graphics. Today

Two conventions for coordinate systems. Left-Hand vs Right-Hand. x z. Which is which?

Math 4377/6308 Advanced Linear Algebra

TENSOR TRANSFORMATION OF STRESSES

Countable and uncountable sets. Matrices.

PHYS 705: Classical Mechanics. Rigid Body Motion Introduction + Math Review

Linear Algebraic Equations

. a m1 a mn. a 1 a 2 a = a n

MAT 2037 LINEAR ALGEBRA I web:

Quaternions. Basilio Bona. Semester 1, DAUIN Politecnico di Torino. B. Bona (DAUIN) Quaternions Semester 1, / 40

Lecture 3: Matrix and Matrix Operations

CS 378: Computer Game Technology

By drawing Mohr s circle, the stress transformation in 2-D can be done graphically. + σ x σ y. cos 2θ + τ xy sin 2θ, (1) sin 2θ + τ xy cos 2θ.

STATICS. Equivalent Systems of Forces. Vector Mechanics for Engineers: Statics VECTOR MECHANICS FOR ENGINEERS: Contents & Objectives.

2D Geometric Transformations. (Chapter 5 in FVD)

Matrix Algebra & Elementary Matrices

Fundamentals of Engineering Analysis (650163)

Reading. Affine transformations. Vector representation. Geometric transformations. x y z. x y. Required: Angel 4.1, Further reading:

Linear Algebra review Powers of a diagonalizable matrix Spectral decomposition

University of Bergen. Solutions to Exam in MAT111 - Calculus 1

LU Factorization. LU Decomposition. LU Decomposition. LU Decomposition: Motivation A = LU

Countable and uncountable sets. Matrices.

Lecture 27: More on Rotational Kinematics

Matrix & Linear Algebra

9.2. Cartesian Components of Vectors. Introduction. Prerequisites. Learning Outcomes

CLASS 12 ALGEBRA OF MATRICES

Foundations of Cryptography

also today: how to read a research paper CS 4300/5310 Computer Graphics

Matrices. Math 240 Calculus III. Wednesday, July 10, Summer 2013, Session II. Matrices. Math 240. Definitions and Notation.

MATRIX TRANSFORMATIONS

Fall Inverse of a matrix. Institute: UC San Diego. Authors: Alexander Knop

Chapter 1 Matrices and Systems of Equations

CP3 REVISION LECTURES VECTORS AND MATRICES Lecture 1. Prof. N. Harnew University of Oxford TT 2013

KINEMATIC RELATIONS IN DEFORMATION OF SOLIDS

Complex Numbers and Quaternions for Calc III

EXAMPLE CFG. L = {a 2n : n 1 } L = {a 2n : n 0 } S asa aa. L = {a n b : n 0 } L = {a n b : n 1 } S asb ab S 1S00 S 1S00 100

Lecture 4: Products of Matrices

Lecture 2 INF-MAT : A boundary value problem and an eigenvalue problem; Block Multiplication; Tridiagonal Systems

Review of Linear Algebra

Chapter XI Novanion rings

INSTITIÚID TEICNEOLAÍOCHTA CHEATHARLACH INSTITUTE OF TECHNOLOGY CARLOW MATRICES

GAUSSIAN ELIMINATION AND LU DECOMPOSITION (SUPPLEMENT FOR MA511)

A FIRST COURSE IN LINEAR ALGEBRA. An Open Text by Ken Kuttler. Matrix Arithmetic

Determinants. Chia-Ping Chen. Linear Algebra. Professor Department of Computer Science and Engineering National Sun Yat-sen University 1/40

Computer Graphics: 2D Transformations. Course Website:

Chapter 1: Systems of linear equations and matrices. Section 1.1: Introduction to systems of linear equations

All Rights Reserved Wiley India Pvt. Ltd. 1

Unit Generalized Quaternions in Spatial Kinematics

Additional Problem (HW 10)

a 11 x 1 + a 12 x a 1n x n = b 1 a 21 x 1 + a 22 x a 2n x n = b 2.

BSc (Hons) in Computer Games Development. vi Calculate the components a, b and c of a non-zero vector that is orthogonal to

Semester University of Sheffield. School of Mathematics and Statistics

Robot Dynamics Instantaneous Kinematiccs and Jacobians

Math 314/814 Topics for first exam

Linear and affine transformations

Lecture 7. Quaternions

1 Multiply Eq. E i by λ 0: (λe i ) (E i ) 2 Multiply Eq. E j by λ and add to Eq. E i : (E i + λe j ) (E i )

Dynamics and control of mechanical systems

ELEMENTARY LINEAR ALGEBRA

Transcription:

CSC. Computer Graphics Lecture 4 P T P t, t t P,, P T t P P T Kasun@dscs.sjp.ac.lk Department o Computer Science Universit o Sri Jaewardanepura Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP r r, otation in angle about a pivot (rotation) point r, r. r r cos r sin r r sin r cos B origin B actor m = m = m, r r, P Pr P Pr cos sin sin cos Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP 3 Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP 4, S S s, s s s P S P Scaling about a ied point, s s s s P P S P - S Parallel to ais B actor a = +a = Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP 5 Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP 6

Use to change the location, orientation, and sie o an object Scale otate Translate Shear Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP 7 Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP 8 Translation can not be represented using D matri. Wh? otate and then displace a point P : P = M P + M M : rotation matri. M : displacement vector. Displacement is unortunatel a non linear operation. Make displacement linear with Homoheneous Coordinates.,,,. Transormations turn into 33 matrices. Ver big advantage. All transormations are concatenated b matri multiplication. Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP 9 Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP D Translation t t, P Tt, t P D otation cos sin sin cos, P P D Scaling S S, P SS, S P Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP

Inverse transormations: t cos sin S T t, sin cos, S S Composite transormations: P M M P M M P MP Composite otations: P P P P P t, t t, t t, t t, t P T T P T T P t t t t Composite translations: t t t t t, t t, t t t, t t T T T Composite Scaling: S S S S S S S S S, S S, S S S, S S S S S Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP 3 Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP 4 Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP 5 Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP 6 r, r Move to origin otate Move back, Move to origin Scale Move back r cos sin r r sin cos r cos sin r cos rsin sin cos rcos rsin Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP 7 S S S S S S Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP 8 3

S SS, S S S cos S sin S S cos sin S S cos sin S sin S cos S S 45 O Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP 9 Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP Ver similar to D. Using 44 matrices rather than 33. Translation t t t,,,, t t t Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP.Translate the object such that rotation ais passes through the origin..otate the object such that rotation ais coincides with one o Cartesian aes. 3.Perorm speciied rotation about the Cartesian ais. 4.Appl inverse rotation to return rotation ais to original direction. 5.Appl inverse translation to return rotation ais to original position. P P P P P P P P P P P P Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP 3 Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP 4 4

The vector rom P to P is: V P P,, Unit rotation vector: u V V abc,, a b c V V V a b c T u abc,, otating u to coincide with ais First rotate u around ais to la in plane. Equivqlent to rotation u 's projection on plane around ais. cos c b c c d, sin b d. We obtained a unit vector w a,, b c d in plane. c d b d b d c d u u abc,, Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP 5 Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP 6 otate w counterclockwise around ais. w is a unit vector whose component is a, component is, hence component is b c d. cos d, sin a d a a d u abc,, w a,, d T T cos sin sin cos T T M cos cos cos sin cos sin cos sin cos cos cos sin cos sin cos sin cos cos a ab c ac b ba c b bc a ca b cb a c Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP 7 Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP 8 Quaternions are etensions o comple numbers to 4-dimension. v v q s ia jb kc s, s : real a, b, c : imaginar i j k, ij ji k, jk kj i, ki ik j Addition: q q s s, v v Multiplication: q q s s v v, s v + s v v v q s v v, q s,, qq q q, q v u otate a point position p,, about the unit vector u. Quarternion representation: otation: q cos, usin Position: P, p, p,, otation o P is carried out with the quarternion operation: P qpq, s p vpv s vp vvp This can be calculated b eicient HW or ast 3D rotations when man rotation operations are involved. Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP 9 Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP 3 5

Scaling with respect to a ied point (not necessaril o object) S S S Enlarging object also moves it rom origin S S P SP S,,,,,,,, S S S S TST S S Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP 3 Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP 3 glpushmatri (); gltranslate(.,.,.); glotate(6,.,.,.); glscale(.,.,.); glcolor3 (,, ); glutwirecube(.); glpopmatri (); Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP 33 Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP 34 Kasun@dscs.sjp.ac.lk - Facult o Applied Sciences o USJP 35 6