Download presentation
Presentation is loading. Please wait.
1
Math Fundamentals Maths revisit
2
Overview Vectors Coordinate systems Matrices Homogenous coordinates
Lines Planes
3
Vector Used to represent In graphics, usually 2D, 3D, 4D quantities
Points in space E.g. locations of objects, vertices of a triangle mesh Spatial directions E.g. orientation of the camera, surface normals In graphics, usually 2D, 3D, 4D quantities Quantity with direction and magnitude E.g. if we connect two points with a directed line segment Directed line segment has magnitude (its length) and direction (its orientation) No fixed position
4
Vectors Representation Vector operations Scalar multiplication
Can have their lengths altered by multiplying with real numbers
5
Vectors Vector operations (cont.) Vector addition and subtraction
Can combine using head-to-tail rule Inverse/negate
6
Vectors Can use a vector to move from one point to another (point-vector addition): P = Q + v Any two points define a vector from one point to the second (point-point subtraction): v = P – Q Unit vector Vector of magnitude = 1 normalisation
7
Vectors Vectors operations (cont.) Dot product
E.g. [ax ay az ] • [bx by bz ] = axbx + ayby + azbz
8
Vectors Vectors operations (cont.) Vector cross product
3D vectors only Cross product results in a vector Length of resulting vector
9
Coordinate Systems Need a frame of reference to relate points and objects to our physical world E.g. where is a point? Can’t answer without a reference system
10
Coordinate Systems Handedness of the system Determined by
Thumb: + x-axis Index finger: + y-axis Middle finger: + z-axis OpenGL: right-handed system DirectX: left-handed system
11
Matrices Transformations are central to 3D graphics Matrices
Almost every pipeline stage involves a change of coordinate system Moving from one coordinate system to another requires the use of transformation matrices Matrices Rectangular grid of numbers arranged in rows and columns Dimensions rows x columns
12
Matrices Square matrices Same number of rows and columns
Diagonal elements Elements where row and column index the same Identity matrix Diagonal elements = 1, all others 0 In some ways, what is 1 is for scalars M-1 M = I MI = IM = M
13
Matrices Transposition Flip the matrix diagonally
Multiplying a matrix with a scalar
14
Matrices Multiplying two matrices AB ≠ BA AI = IA = A
15
Matrices Multiplying two matrices (cont.)
16
Matrices Multiplying two matrices (cont.)
17
Matrices Multiplying two matrices (cont.)
18
Homogenous Coordinates
Homogenous coordinates are key to all computer graphics systems Points are typically represented by (x,y) or (x,y,z) Add a 3rd or 4th coordinate, w All standard transformations (rotation, translation, scaling) can be implemented with matrix multiplication using 3 x 3 or 4 x 4 matrices Hardware pipeline works with 4-dimensional representations
19
Lines and Rays A line extends infinitely in two directions
A line segment is a finite portion of a line that has two endpoints A ray is half of a line that has an origin and extends infinitely in one direction Sometimes defined as a directed line segment (finite length)
20
Lines and Rays Parametric definition of a line segment with endpoints (x0, y0) and (x1, y1) x(t) = x0 + t ∆x y(t) = y0 + t ∆y In vector notation, p(t) = p0 + td Straightforward extension of r3D, add z(t) The ray starts at point p0 : (x0, y0, z0). p0 contains information about the position of the ray 0 ≤ t ≤ 1 ∆x = (x1 – x0) ∆y = (y1 – y0)
21
Plane A plane is a flat surface (3D), has no thickness, extends infinitely Equation of a plane ax + by + cz + d = 0 p = (x, y, z) A 3D point on a plane n = (a, b, c) Normal vector, perpendicular to the plane n.p + d = 0
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.