1
Graphics
CSCI 343, Fall 2015Lecture 10
Coordinate Transformations
2
Matrices
A Matrix is a rectangular array of quantities:
2x2 Matrix 2x3 Matrix3x1 Matrix
mxn Matrix
3
Matrix multiplication
To multiply two matrices, multiply the rows in the first matrix by the columns of the second matrix.
Example:
4
Matrix multiplication
In general:
5
Practice
a)
b)
6
Representing systems of equations
A system of equations, e.g.
can be represented with a matrix equation:
7
Matrix terminology
1. The transpose of a matrix, exchanges the rows and columns of that matrix.
2. When a matrix, A, is multiplied by the identity matrix, the result is the same matrix A.
3. The a matrix, A, is multiplied by its inverse, A-1, the result is the identity matrix.
AI = A
AA-1 = I
8
Recall Coordinate systems
Coordinate systems are represented by a set of basis vectors (v1, v2, v3) and a reference point, P0.
Points can be written as:
v1
v2
v3
P
P0
Vectors can be written as:
9
Changing the basis set
We can move from basis (v1, v2, v3) to basis (u1, u2, u3) using the following set of equations:
v1
v2
v3
u1u2
u3In matrix form:
u = Mv
10
Representing a vector in the new basis set
Suppose:
We would like to find b, such that:
11
Solving for b
We will solve for b in class
12
Homogeneous coordinatesTransformation of basis vectors leaves the origin unchanged.Homogeneous coordinates allow us to transform the origin.Recall representation of a point:
To represent P with matrices, we add a 4th dimension so we can include position:
P is represented by:
For vectors, the fourth coordinate is zero.
13
Changing frames in homogeneous coordinates
Changing from (v1, v2, v3, P0) to (u1, u2, u3, Q0):
v1
v2
v3
u1
u2
u3
P0
Q0
In matrix form:
14
Transforming a point between coordinate systems
Suppose P is represented by b in the u, Q0 space andby a in the v, P0 space. (bT = [1, 2, 3, 1], aT = [1, 2, 3, 1])
We will solve for b in class.
15
Affine transformationsAffine transformations are linear transformations from a point in one frame to another frame:
f(p + q) = f(p) + f(q)
, are scalars; p, q are vertices.
Affine transformations preserve lines.
We can represent the transformation as: v = Au where
16
Translation
Translation: Displace points by a fixed distance in a given direction.
d
x' = x + x
y' = y + y
z' = z + z
p' = Tp where
Equations: In matrix form:
17
Inverse translation
T is the translation matrix
Inverse translation: Displace by -d