17
1 Graphics CSCI 343, Fall 2015 Lecture 10 Coordinate Transformations

1 Graphics CSCI 343, Fall 2015 Lecture 10 Coordinate Transformations

Embed Size (px)

Citation preview

Page 1: 1 Graphics CSCI 343, Fall 2015 Lecture 10 Coordinate Transformations

1

Graphics

CSCI 343, Fall 2015Lecture 10

Coordinate Transformations

Page 2: 1 Graphics CSCI 343, Fall 2015 Lecture 10 Coordinate Transformations

2

Matrices

A Matrix is a rectangular array of quantities:

2x2 Matrix 2x3 Matrix3x1 Matrix

mxn Matrix

Page 3: 1 Graphics CSCI 343, Fall 2015 Lecture 10 Coordinate Transformations

3

Matrix multiplication

To multiply two matrices, multiply the rows in the first matrix by the columns of the second matrix.

Example:

Page 4: 1 Graphics CSCI 343, Fall 2015 Lecture 10 Coordinate Transformations

4

Matrix multiplication

In general:

Page 5: 1 Graphics CSCI 343, Fall 2015 Lecture 10 Coordinate Transformations

5

Practice

a)

b)

Page 6: 1 Graphics CSCI 343, Fall 2015 Lecture 10 Coordinate Transformations

6

Representing systems of equations

A system of equations, e.g.

can be represented with a matrix equation:

Page 7: 1 Graphics CSCI 343, Fall 2015 Lecture 10 Coordinate Transformations

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

Page 8: 1 Graphics CSCI 343, Fall 2015 Lecture 10 Coordinate Transformations

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:

Page 9: 1 Graphics CSCI 343, Fall 2015 Lecture 10 Coordinate Transformations

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

Page 10: 1 Graphics CSCI 343, Fall 2015 Lecture 10 Coordinate Transformations

10

Representing a vector in the new basis set

Suppose:

We would like to find b, such that:

Page 11: 1 Graphics CSCI 343, Fall 2015 Lecture 10 Coordinate Transformations

11

Solving for b

We will solve for b in class

Page 12: 1 Graphics CSCI 343, Fall 2015 Lecture 10 Coordinate Transformations

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.

Page 13: 1 Graphics CSCI 343, Fall 2015 Lecture 10 Coordinate Transformations

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:

Page 14: 1 Graphics CSCI 343, Fall 2015 Lecture 10 Coordinate Transformations

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.

Page 15: 1 Graphics CSCI 343, Fall 2015 Lecture 10 Coordinate Transformations

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

Page 16: 1 Graphics CSCI 343, Fall 2015 Lecture 10 Coordinate Transformations

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:

Page 17: 1 Graphics CSCI 343, Fall 2015 Lecture 10 Coordinate Transformations

17

Inverse translation

T is the translation matrix

Inverse translation: Displace by -d