Download presentation

Presentation is loading. Please wait.

Published byRandall Greer Modified about 1 year ago

1
Mathematical Foundations UBI 516 Advanced Computer Graphics Aydın Öztürk

2
Mathematical Foundations l Hearn and Baker (A1 – A4) appendix gives good review l I’ll give a brief, informal review of some of the mathematical tools we’ll employ –Geometry (2D, 3D) –Trigonometry –Vector spaces n Points, vectors, and coordinates –Dot and cross products –Linear transforms and matrices –Complex numbers

3
2D Geometry l Know your high school geometry: –Total angle around a circle is 360° or 2 π radians –When two lines cross: n Opposite angles are equivalent n Angles along line sum to 180° –Similar triangles: n All corresponding angles are equivalent

4
Trigonometry l Sine: “opposite over hypotenuse” l Cosine: “adjacent over hypotenuse” l Tangent: “opposite over adjacent” l Unit circle definitions: –sin ( ) = y –cos ( ) = x –tan ( ) = y/x –Etc… ( x, y )

5
Slope-intercept Line Equation Slope: Solve for y: or: y = mx + b x y

6
Parametric Line Equation l Given points and l When: –u =0, we get –u =1, we get –(0< u <1), we get points on the segment between and x y

7
Other helpful formulas Length = l l Two lines perpendicular if: l Cosine of the angle between them is 0.

8
Coordinate Systems l 2D systems Cartesian system Polar coordinates l 3D systems Cartesian system 1) Right-handed 2) Left handed Cylindiric system Spherical system

9
Coordinate Systems(cont.) Z X Y Y X Z Right-handed coordinate system Left-handed coordinate system l Grasp z-axis with hand l Roll fingers from positive x-axis towards positive y-axis l Thumb points in direction of z-axis

10
Points l Points support these operations: –Point-point subtraction: Q - P = v n Result is a vector pointing from P to Q –Vector-point addition: P + v = Q n Result is a new point –Note that the addition of two points is not defined P Q v

11
Vectors l We commonly use vectors to represent: –Points in space (i.e., location) –Displacements from point to point –Direction (i.e., orientation)

12
Vector Spaces l Two types of elements: –Scalars (real numbers): … –Vectors ( n -tuples): u, v, w, … l Operations: –Addition –Subtraction –Dot Product –Cross Product –Norm

13
Vector Addition/Subtraction –operation u + v, with: Identity 0 v + 0 = v Inverse - v + (- v ) = 0 –Vectors are “arrows” rooted at the origin –Addition uses the “parallelogram rule”: u+v y x u v u-v y x u v -v

14
Scalar Multiplication –Scalar multiplication: Distributive rule: ( u + v ) = ( u ) + ( v ) ( + ) u = u + u –Scalar multiplication “streches” a vector, changing its length (magnitude) but not its direction

15
Dot Product l The dot product or, more generally, inner product of two vectors is a scalar: v 1 v 2 = x 1 x 2 + y 1 y 2 + z 1 z 2 (in 3D) l Useful for many purposes –Computing the length (Euclidean Norm) of a vector: length( v ) = ||v|| = sqrt( v v) –Normalizing a vector, making it unit-length: v = v / ||v|| –Computing the angle between two vectors: u v = ||u|| ||v|| cos(θ) –Checking two vectors for orthogonality u v = 0 u θ v

16
u Dot Product l Projecting one vector onto another –If v is a unit vector and we have another vector, w –We can project w perpendicularly onto v –And the result, u, has length w v w v

17
Dot Product l Is commutative –u v = v u l Is distributive with respect to addition –u (v + w) = u v + u w

18
Cross Product l The cross product or vector product of two vectors is a vector: l The cross product of two vectors is orthogonal to both l Right-hand rule dictates direction of cross product

19
Cross Product Right Hand Rule l See: l Orient your right hand such that your palm is at the beginning of A and your fingers point in the direction of A l Twist your hand about the A-axis such that B extends perpendicularly from your palm l As you curl your fingers to make a fist, your thumb will point in the direction of the cross product

20
Cross Product Right Hand Rule l See: l Orient your right hand such that your palm is at the beginning of A and your fingers point in the direction of A l Twist your hand about the A-axis such that B extends perpendicularly from your palm l As you curl your fingers to make a fist, your thumb will point in the direction of the cross product

21
Cross Product Right Hand Rule l See: l Orient your right hand such that your palm is at the beginning of A and your fingers point in the direction of A l Twist your hand about the A-axis such that B extends perpendicularly from your palm l As you curl your fingers to make a fist, your thumb will point in the direction of the cross product

22
Cross Product Right Hand Rule l See: l Orient your right hand such that your palm is at the beginning of A and your fingers point in the direction of A l Twist your hand about the A-axis such that B extends perpendicularly from your palm l As you curl your fingers to make a fist, your thumb will point in the direction of the cross product

23
Cross Product Right Hand Rule l See: l Orient your right hand such that your palm is at the beginning of A and your fingers point in the direction of A l Twist your hand about the A-axis such that B extends perpendicularly from your palm l As you curl your fingers to make a fist, your thumb will point in the direction of the cross product

24
Triangle Arithmetic l Consider a triangle, (a, b, c) –a,b,c = (x,y,z) tuples l Surface area = s a = ½ * ||(b –a) X (c-a)|| l Unit normal = (1/2s a ) * (b-a) X (c-a) a c b

25
Vector Spaces l A linear combination of vectors results in a new vector: v = 1 v 1 + 2 v 2 + … + n v n l If the only set of scalars such that 1 v 1 + 2 v 2 + … + n v n = 0 is 1 = 2 = … = 3 = 0 then we say the vectors are linearly independent l The dimension of a space is the greatest number of linearly independent vectors possible in a vector set l For a vector space of dimension n, any set of n linearly independent vectors form a basis

26
Vector Spaces: Basis Vectors l Given a basis for a vector space: –Each vector in the space is a unique linear combination of the basis vectors –The coordinates of a vector are the scalars from this linear combination –If basis vectors are orthogonal and unit length: n Vectors comprise orthonormal basis –Best-known example: Cartesian coordinates –Note that a given vector v will have different coordinates for different bases

27
Matrices l Matrix addition l Matrix multiplication l Matrix tranpose l Determinant of a matrix l Matrix inverse

28
Complex numbers A complex number z is an ordered pair of real numbers z = (x,y), x = Re(z), y = Im(z) Addition, substraction and scalar multiplication of complex numbers are carried out using the same rules as for two-dimensional vectors. Multiplication is defined as (x 1, y 1 )(x 2, y 2 ) = (x 1 x 2 – y 1 y 2, x 1 y 2 + x 2 y 1 )

29
Complex numbers(cont.) Real numbers can be represented as x = (x, 0) It follows that (x 1, 0 )(x 2, 0) = (x 1 x 2,0) i = (0, 1) is called the imaginary unit. We note that i 2 = (0, 1) (0, 1) = (-1, 0).

30
Complex numbers(cont.) Using the rule for complex addition, we can write any complex number as the sum z = (x,0) + (0,y) = x + iy Which is the usual form used in practical applications.

31
Complex numbers(cont.) The complex conjugate is defined as z̃ = x -iy Modulus or absolute value of a complex number is |z| = z z̃ = √ (x 2 +y 2 ) Division of of complex numbers:

32
Complex numbers(cont.) Polar coordinate representation

33
Complex numbers(cont.) Complex multiplication

34
Conclusion l Read Chapters 1 – 3 of OpenGL Programming Guide

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google