0% found this document useful (0 votes)
103 views7 pages

Course: Next Steps: Foundations of Computer Graphics

This document provides an overview and outline of an online lecture on foundational computer graphics concepts. It reviews basic math topics like vectors, dot and cross products, matrices, and constructing coordinate frames. Vectors are introduced as having magnitude and direction to represent offsets, displacements, and locations. Dot products calculate the cosine of the angle between two vectors and are used to find projections. Cross products are orthogonal to the two initial vectors. Matrices can represent transformations and are used to multiply vectors and other matrices. Constructing an orthonormal coordinate frame from arbitrary vectors is also covered.

Uploaded by

Shefalimodi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
103 views7 pages

Course: Next Steps: Foundations of Computer Graphics

This document provides an overview and outline of an online lecture on foundational computer graphics concepts. It reviews basic math topics like vectors, dot and cross products, matrices, and constructing coordinate frames. Vectors are introduced as having magnitude and direction to represent offsets, displacements, and locations. Dot products calculate the cosine of the angle between two vectors and are used to find projections. Cross products are orthogonal to the two initial vectors. Matrices can represent transformations and are used to multiply vectors and other matrices. Constructing an orthonormal coordinate frame from arbitrary vectors is also covered.

Uploaded by

Shefalimodi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Foundations of Computer Graphics

Online Lecture 2: Review of Basic Math Vectors and Dot Products Ravi Ramamoorthi

Complete HW 0

Course: Next Steps

Sets up basic compilation issues Verifies you can work with feedback/grading servers This lecture is a revision of basic math concepts

First few lectures core math ideas in graphics HW 1 has few lines of code (but start early) Textbooks: None required

Use some ideas discussed in lecture, create images OpenGL/GLSL reference helpful (but not required)

Motivation and Outline


Many graphics concepts need basic math like linear algebra Vectors (dot products, cross products, ) Matrices (matrix-matrix, matrix-vector mult., ) E.g: a point is a vector, and an operation like translating or rotating points on object can be matrix-vector multiply Should be refresher on very basic material for most of you Only basic high school math required

Vectors
=
Usually written as a or in bold. Magnitude written as a Length and direction. Absolute position not important

Use to store offsets, displacements, locations

But strictly speaking, positions are not vectors and cannot be added: a location implicitly involves an origin, while an offset does not.

Vector Addition
a = +b
a
Geometrically: Parallelogram rule In cartesian coordinates (next), simply add coords

Cartesian Coordinates
A=4X+3Y

b+

a
b

x A = y

A =

x y

A = x2 + y 2

X and Y can be any (usually orthogonal unit) vectors

Vector Multiplication
Dot product Cross product Orthonormal bases and coordinate frames

Dot (scalar) product


b

aib = bia = ?
Note: We use right-handed (standard) coordinates

Dot (scalar) product


b

Dot (scalar) product


b

aib = bia = ?

a i b = a b cos aib = cos1 a b

aib = bia = ? a i (b + c) = a i b + a i c (ka) i b = a i (kb) = k(a i b)

a i b = a b cos aib = cos1 a b

Dot product in Cartesian components

Dot product in Cartesian components

x x a b =? a b= ya yb

x x a b =? a b= ya yb
x x a b = xa xb + y a y b a b= ya yb

Dot product: some applications in CG


Find angle between two vectors (e.g. cosine of angle between light source and surface for shading)

Projections (of b on a)
b

Finding projection of one vector on another (e.g. coordinates of point in arbitrary coordinate system) Advantage: computed easily in cartesian components

ba =? ba =?

b a = b cos = ba= ba

aib a

a aib = a 2 a a

Foundations of Computer Graphics


Online Lecture 2: Review of Basic Math Vectors: Cross Products Ravi Ramamoorthi

Vector Multiplication
Dot product Cross product Orthonormal bases and coordinate frames Note: We use right-handed (standard) coordinates

Cross (vector) product


a b = b a a b = a b sin b
Cross product orthogonal to two initial vectors Direction determined by right-hand rule Useful in constructing coordinate systems (later)

Cross product: Properties


x y = +z y x = z y z = +x z y = x z x = +y x z = y a b = b a aa = 0 a (b + c) = a b + a c a (kb) = k(a b)

Cross product: Cartesian formula?

y z y z b a a b a b = xa y a za = za xb xa zb xb y b zb xa y b y a xb 0 z y a xb a 0 xa y b a b = A*b = za 0 zb y a xa x y z

Cross product: Cartesian formula?


Dual matrix of vector a

Foundations of Computer Graphics


Online Lecture 2: Review of Basic Math Vectors: Orthonormal Basis Frames Ravi Ramamoorthi

Vector Multiplication
Dot product Cross product Orthonormal bases and coordinate frames Note: We use right-handed (standard) coordinates

Orthonormal bases/coordinate frames


Important for representing points, positions, locations Often, many sets of coordinate systems (not just X, Y, Z) Global, local, world, model, parts of model (head, hands, ) Critical issue is transforming between these systems/bases Topic of next 3 lectures

Coordinate Frames
Any set of 3 vectors (in 3D) so that

u = v = w =1 u iv = v iw = u iw = 0 w = u v p = (p i u)u + (p i v)v + (p i w)w

Constructing a coordinate frame


Often, given a vector a (viewing direction in HW1), want to construct an orthonormal basis Need a second vector b (up direction of camera in HW1) Construct an orthonormal basis (for instance, camera coordinate frame to transform world objects into in HW1)

Constructing a coordinate frame?


We want to associate w with a, and v with b But a and b are neither orthogonal nor unit norm And we also need to find u

Constructing a coordinate frame?


We want to associate w with a, and v with b But a and b are neither orthogonal nor unit norm And we also need to find u

Constructing a coordinate frame?


We want to associate w with a, and v with b But a and b are neither orthogonal nor unit norm And we also need to find u

w=

a a

w= u=

a a

bw bw

Constructing a coordinate frame?


We want to associate w with a, and v with b But a and b are neither orthogonal nor unit norm And we also need to find u

Foundations of Computer Graphics


Online Lecture 2: Review of Basic Math Matrices Ravi Ramamoorthi

a w= a u=

bw bw

v =w u

Matrices
Can be used to transform points (vectors)
Translation, rotation, shear, scale (more detail next lecture)

What is a matrix
Array of numbers (mn = m rows, n columns)

1 3 5 2 0 4
Addition, multiplication by a scalar simple: element by element

Matrix-matrix multiplication
Number of columns in first must = rows in second
1 3 3 6 9 4 5 2 2 7 8 3 0 4

Matrix-matrix multiplication
Number of columns in first must = rows in second
9 27 33 13 1 3 3 6 9 4 5 2 2 7 8 3 = 19 44 61 26 8 28 32 12 0 4

Element (i,j) in product is dot product of row i of first matrix and column j of second matrix

Element (i,j) in product is dot product of row i of first matrix and column j of second matrix

Matrix-matrix multiplication
Number of columns in first must = rows in second
9 27 33 13 1 3 3 6 9 4 = 19 44 61 26 5 2 2 7 8 3 8 28 32 12 0 4

Matrix-matrix multiplication
Number of columns in first must = rows in second
9 27 33 13 1 3 3 6 9 4 = 19 44 61 26 5 2 2 7 8 3 8 28 32 12 0 4

Element (i,j) in product is dot product of row i of first matrix and column j of second matrix

Element (i,j) in product is dot product of row i of first matrix and column j of second matrix

Matrix-matrix multiplication
Number of columns in first must = rows in second
1 3 3 6 9 4 5 2 NOT EVEN LEGAL!! 2 7 8 3 0 4 Non-commutative (AB and BA are different in general)
Associative and distributive A(B+C) = AB + AC (A+B)C = AC + BC

Matrix-Vector Multiplication
Key for transforming points (next lecture) Treat vector as a column matrix (m1) E.g. 2D reflection about y-axis
1 0 x x = 0 1 y y

Transpose of a Matrix (or vector?)


1 2 1 3 5 3 4 = 2 4 6 5 6
T

Identity Matrix and Inverses


I33 1 0 0 = 0 1 0 0 0 1

(AB)T = BT AT

AA1 = A1A = I (AB)1 = B 1A1

Vector multiplication in Matrix form


Dot product?
a b = aT b

(x
Cross product?

ya

za

0 a b = A b = za y a
*

x b y b = xa xb + y a y b + za zb zb

za 0 xa

Dual matrix of vector a

y a xb xa y b 0 zb

You might also like