2IV60 Computer Graphics Basic Math for CG

Slides:



Advertisements
Similar presentations
Demetriou/Loizidou – ACSC330 – Chapter 4 Geometric Objects and Transformations Dr. Giorgos A. Demetriou Dr. Stephania Loizidou Himona Computer Science.
Advertisements

UBI 516 Advanced Computer Graphics
Math Review Guest Lecturer: Michiel van de Panne Week 1, Wed Jan 9
Shivkumar Kalyanaraman Rensselaer Polytechnic Institute 1 : “shiv rpi” Linear Algebra A gentle introduction Linear Algebra has become as basic and as applicable.
Chapter 4.1 Mathematical Concepts
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry Trigonometric functions Defined using right triangle  x y h.
Now Playing: My Mathematical Mind Spoon From Gimme Fiction Released May 10, 2005.
CSCE 590E Spring 2007 Basic Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Computer Graphics CSC 630 Lecture 2- Linear Algebra.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Math Review Week 1, Wed.
Chapter 1 Vector analysis
Chapter 2: Vectors Ian Parberry University of North Texas Fletcher Dunn Valve Software 3D Math Primer for Graphics and Game Development.
Lecture 2: Geometry vs Linear Algebra Points-Vectors and Distance-Norm Shang-Hua Teng.
Computer Graphics (Fall 2005) COMS 4160, Lecture 2: Review of Basic Math
PHYS 218 sec Review Chap. 1. Caution This presentation is to help you understand the contents of the textbook. Do not rely on this review for.
3D Graphics Goal: To produce 2D images of a mathematically described 3D environment Issues: –Describing the environment: Modeling (mostly later) –Computing.
Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 2: Review of Basic Math
Chapter 3 Vectors.
Mathematical Fundamentals
Phys211C1V p1 Vectors Scalars: a physical quantity described by a single number Vector: a physical quantity which has a magnitude (size) and direction.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
COS 397 Computer Graphics Svetla Boytcheva AUBG, Spring 2013.
Graphics CSE 581 – Interactive Computer Graphics Mathematics for Computer Graphics CSE 581 – Roger Crawfis (slides developed from Korea University slides)
6.837 Linear Algebra Review Patrick Nichols Thursday, September 18, 2003.
1 February 24 Matrices 3.2 Matrices; Row reduction Standard form of a set of linear equations: Chapter 3 Linear Algebra Matrix of coefficients: Augmented.
ECON 1150 Matrix Operations Special Matrices
Patrick Nichols Thursday, September 18, Linear Algebra Review.
Recap of linear algebra: vectors, matrices, transformations, … Background knowledge for 3DM Marc van Kreveld.
Mathematics for Computer Graphics (Appendix A) Won-Ki Jeong.
Chapter 4.1 Mathematical Concepts
Geometry CSC 2141 Introduction to Computer Graphics.
Mathematical Foundations Sections A-1 to A-5 Some of the material in these slides may have been adapted from university of Virginia, MIT and Åbo Akademi.
Intro to 3D Models Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
CSCE 552 Spring 2011 Math By Jijun Tang. Layered.
6.837 Linear Algebra Review Patrick Nichols Thursday, September 18, 2003.
1 Math Review Coordinate systems 2-D, 3-D Vectors Matrices Matrix operations.
Shivkumar Kalyanaraman Rensselaer Polytechnic Institute 1 : “shiv rpi” Linear Algebra A gentle introduction Linear Algebra has become as basic and as applicable.
6.837 Linear Algebra Review Rob Jagnow Monday, September 20, 2004.
Graphics Graphics Korea University Mathematics for Computer Graphics Graphics Laboratory Korea University.
Background Mathematics Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006.
Chapter 3 Vectors. Vector quantities  Physical quantities that have both numerical and directional properties Mathematical operations of vectors in this.
CS 551 / 645: Introductory Computer Graphics Mathematical Foundations.
Chun-Yuan Lin Mathematics for Computer Graphics 2015/12/15 1 CG.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016 Tamara Munzner Math Basics Week 1, Fri.
Computer Graphics Matrices
CSCE 552 Fall 2012 Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Matrices and Matrix Operations. Matrices An m×n matrix A is a rectangular array of mn real numbers arranged in m horizontal rows and n vertical columns.
Basic Theory (for curve 01). 1.1 Points and Vectors  Real life methods for constructing curves and surfaces often start with points and vectors, which.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Math Review Week 1, Fri.
Physics 141Mechanics Lecture 3 Vectors Motion in 2-dimensions or 3-dimensions has to be described by vectors. In mechanics we need to distinguish two types.
Are the quantities that has magnitude only only  Length  Area  Volume  Time  Mass Are quantities that has both magnitude and a direction in space.
Linear Algebra Review Tuesday, September 7, 2010.
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry "Old Henry And His Old Aunt" Defined using right triangle  x y h.
Graphics Graphics Korea University kucg.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실.
Lecture 1 Linear algebra Vectors, matrices. Linear algebra Encyclopedia Britannica:“a branch of mathematics that is concerned with mathematical structures.
CA 302 Computer Graphics and Visual Programming
CSE 167 [Win 17], Lecture 2: Review of Basic Math Ravi Ramamoorthi
Math Fundamentals Maths revisit.
Mathematics for Computer Graphics
CSC461: Lecture 12 Geometry Objectives
Lecture 03: Linear Algebra
CSE 541 – Numerical Methods
CSE 411 Computer Graphics Lecture #2 Mathematical Foundations
Lecture 2: Geometry vs Linear Algebra Points-Vectors and Distance-Norm
Math review - scalars, vectors, and matrices
Game Programming Algorithms and Techniques
Serway and Jewett Chapter 3
Presentation transcript:

2IV60 Computer Graphics Basic Math for CG Jack van Wijk TU/e

Overview Coordinates, points, vectors Matrices H&B A-1

nD Space nD Space: n (typically) n : number of dimensions Examples: 1D space: time, along a line or curve 2D space: plane, sphere 3D space: the world we live in 4D space: 3D + time H&B A-2

Coordinates 2D Cartesian coordinates: Standard Screen (output, input) x y (x,y) (x,y) y x Standard Screen (output, input) H&B A-1

Polar coordinates y (x,y) r  x H&B A-1

3D coordinates 1 3D Cartesian coordinates: Right-handed Left-handed (x,y,z) z (x,y,z) z x y x y Right-handed Left-handed H&B A-1

3D coordinates 2 3D Cartesian coordinates: Right-handed Left-handed (x,y,z) z (middle) z (middle) (x,y,z) y (index) x (thumb) x (thumb) y (index) Right-handed Left-handed H&B A-1

3D coordinates 3 Cylinder coordinates: (x,y,z) z y x  H&B A-1

3D coordinates 4 Spherical coordinates: (x,y,z) z f r y x  H&B A-1

Points Point: position in nD space Notation: P (H&B), also P, p, p en p (x,y,z) (H&B), also (x1, x2, x3), (Px, Py, Pz), (r, , z), ( r, , ), … H&B A-2

Vectors 1 Vector: Notation: V (H&B), also V, v, v en v “arrow” multiple interpretations (displacement, velocity, force, …) has a magnitude and direction has no position Notation: V (H&B), also V, v, v en v (Vx, Vy, Vz) (H&B), also (x, y, z), (x1, x2, x3) H&B A-2

Vectors 2 y P2 y2 P1 y1 V: directed line segment, or difference between two points x1 x2 x H&B A-2

Vectors 3 Length of a vector: H&B A-2

Vectors 4 Direction of a vector: Direction angles. Unit vector V : Magnitude info is removed, direction is kept. z g b y x a H&B A-2

Vector addition Add components, put vector head to tail y y W V+W W V x x H&B A-2

Scalar multiplication of vector Multiplication components with scalar s y y 2V V x x H&B A-2

Combining vector operations Infinite line through P with direction V: L(t) = P + Vt, t  V y P t x t : parameter along line t [a, b]: line segment H&B A-2

Vector multiplication 1 Scalar product or dot product: Product of parallel components, gives 1 real value W V q |W| cos q |V| H&B A-2

Vector multiplication 2 Scalar product: H&B A-2

Vector multiplication 3 Vector product or cross product: gives a vector (in 3D) n perpendicular to V and W VW W q n V H&B A-2

Vector multiplication 5 Scalar product: H&B A-2

Vector multiplication 6 Scalar product: scalar Test if vectors are perpendicular cos project,… Vector product: vector Get a vector perpendicular to two given vectors sin surface area,… H&B A-2

Exercise 1 Given a point P. Requested: Reflect a point Q with respect to P. Q W = P – Q Q’ = Q + 2W = 2P – Q or: = P + (P – Q ) W P x y Q’ We don’t need coordinates!

Exercise 1 Given a point P. Requested: Reflect a point Q with respect to P. Q Alternative P is halfway Q and Q’: P = (Q + Q’)/2 2P = Q + Q’ Q’ = 2P – Q P Q’

Exercise 2 Given a line L: L(t) = P + Vt . Requested: Reflect a point Q with respect to L. Q Q’ We know: Q’ = Q + 2 W W = L(t) – Q W. V = 0 W V L(t) y P t x

Exercise 2 We know: L(t) = P + Vt Q’ = Q + 2 W W = L(t) – Q W. V = 0 Substitute to get t: (L(t) – Q).V = 0 (P + Vt – Q).V = 0 V .V t + (P – Q).V = 0 t = ((Q – P).V) / (V .V) Then: Q’ = Q + 2 (P + Vt – Q) = 2P – Q + V((Q – P).V / V .V)

Steps to be made Write down what you know Eliminate, substitute, etc. to get he result Check the result Does it make sense? Is there a simpler derivation?

Exercise 3 Given a triangle with vertices P, Q en R, where the angle PQR is perpendicular. Requested: Rotate the triangle around the line PQ over an angle a . What is the new position R’ of R? P  R’ Q R

Circle in space |A|=1, |B|=1, A.B = 0 y C() C()  P A B r P A B  x |A|=1, |B|=1, A.B = 0 C() = (r cos , r sin , 0) = (0,0,0) + r cos  (1,0,0) + r sin  (0,1,0) = P + r cos  A + r sin  B

Exercise 3 A = (R – Q) / |R – Q| B = (R – Q)(P – Q) / | (R – Q)(P – Q) | R’ = Q + |R – Q| cos  A + |R – Q| sin  B P B  R’ Q A R

Use: Scalar product, cross product coordinate independent definitions vector algebra Don’t use: arccos, arcsin y = f(x)

Very short intro to Linear Algebra System of linear equations: Such systems occur in many, many applications. They are studied in Linear Algebra. H&B A-5

Very short intro to Linear Algebra System of linear equations: Typical questions: Given u, v, w, what are x, y, z? Can we find a unique solution? H&B A-5

Very short intro to Linear Algebra System of linear equations: Crucial in computer graphics: Transforming geometric objects Change of coordinates H&B A-5

Example transformation y P: (x,y) x y’ P’ V U y x x’ H&B A-5

What is a matrix? Matrix: Mathematical objects with operations Matrix in computer graphics: Defines a coordinate frame Defines a transformation Handy tool for manipulating transformations H&B A-5

Matrix Matrix: rectangular array of elements Element: quantity (value, expression, function, …) Examples: H&B A-5

Matrix r  c matrix: r rows, c columns mij : element at row i and column j. H&B A-5

Matrix r  c matrix: r rows, c columns mij : element at row i and column j. r  c elements H&B A-5

Matrix r  c matrix: r rows, c columns mij : element at row i and column j. c columns H&B A-5

Matrix r  c matrix: r rows, c columns mij : element at row i and column j. r rows H&B A-5

Matrix Column vector: matrix with c =1 Used for vectors (and points) Row vector: matrix with r =1 Scalar: matrix with r=1and c=1 H&B A-5

Matrix Matrix as collection of column vectors: W Matrix contains an axis-frame: H&B A-5

Operations on matrices Multiplication with scalar simple Addition Matrix-matrix multiplication More difficult, but the most important H&B A-5

Scalar Matrix multiplication Matrix M multiplied with scalar s: H&B A-5

Scalar Matrix addition H&B A-5

Scalar Matrix addition Just add elements pairwise A and B must have the same number of rows and columns Generalization of vector and scalar addition H&B A-5

Matrix Matrix multiplication i = 2 ; k j = 1 ; k cij: dot product of row vector ai and column vector bj #columns A must be the same as #rows B: n = p C: m  q matrix H&B A-5

Matrix Matrix multiplication Example: i = 3 j = 2 i=3, j=2 H&B A-5

Matrix Matrix multiplication Example: H&B A-5

Matrix Matrix multiplication Example: H&B A-5

Matrix Matrix multiplication Example: AB  BA H&B A-5

Matrix Matrix multiplication AB  BA Matrix matrix multiplication is not commutative! Order matters! A(B+C) = AB+AC Matrix matrix multiplication is distributive H&B A-5

Example transformation sequence (coordinate version) Unclear! Error-prone! H&B A-5

Example transformation sequence (matrix vector version) H&B A-5

Example transformation sequence (compact matrix vector version) Matrix vector notation allows for compactness and genericity! H&B A-5

Matrix Transpose Transpose matrix: Interchange rows and columns. r  c matrix M  c  r matrix MT H&B A-5

Matrix Inverse Simple algebra puzzle. Let ax = b. What is x? Linear algebra puzzle. Let MU = V. What is U? H&B A-5

Matrix Inverse H&B A-5

Matrix Inverse examples H&B A-5

Matrix Inverse examples Does not exist, cannot be inverted. H&B A-5

Matrix Inverse Does not always exist In general: if determinant = | M | = 0, matrix cannot be inverted Inverse for n = 1 and n = 2: easy Inverse for higher n: use library function Important special case: orthonormal matrix. H&B A-5

Overview Coordinates, points, vectors Matrices definitions, operations, examples Matrices