0% found this document useful (0 votes)
42 views76 pages

04 Transformations

The document discusses coordinates and transformations. It covers vectors, points, homogeneous coordinates, and linear transformations. It explains how to define coordinate systems, change between coordinate systems, and transform objects using matrices.

Uploaded by

snoweverwyhere
Copyright
© © All Rights Reserved
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)
42 views76 pages

04 Transformations

The document discusses coordinates and transformations. It covers vectors, points, homogeneous coordinates, and linear transformations. It explains how to define coordinate systems, change between coordinate systems, and transform objects using matrices.

Uploaded by

snoweverwyhere
Copyright
© © All Rights Reserved
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/ 76

Coordinates and

Transformations
MIT ECCS 6.837

many slides follow Steven Gortler’s book

1
Coordinates and
Transformations
MIT ECCS 6.837

many slides follow Steven Gortler’s book

2
Hierarchical modeling
• Many coordinate systems:
• Camera
• Static scene
• car
• driver
• arm
• hand
• ...

3
A Philosophical Point

Where is (0,0,0)?
A Philosophical Point

Where is (0,0,0)?
A Philosophical Point

Did it move?
Observation

Rarely do we use
“absolute” positions
in real life.
Coordinates
• We represent points with tuples of coordinates
such as
• But the tuples are meaningless without a
coordinate system

could be this point could be this point


in the red in the blue
coordinate system coordinate system

8
Different objects
• Points
• represent locations
• Vectors
• represent movement, force, displacement from A to B
• Normals
• represent orientation, unit length
• Coordinates
• numerical representation of the above objects
in a given coordinate system

9
Points & vectors are different
• The 0 vector has a fundamental meaning:
no movement, no force
• Why would there be a special 0 point?

• It’s meaningful to add vectors, not points


• Boston + NYC = ?

+ =?

10
Points & vectors are different
• Moving car
• points describe location of car elements
• vectors describe velocity, distance between pairs of
points
• If I translate the moving car to a different road
• The points (location) change
• The vectors (speed, distance between points) don’t

11
Matrices have two purposes
• (At least for geometry)
• Transform things
• e.g. rotate the car from facing
north to facing east

• Change coordinates
• e.g. given the driver's location in
the coordinate system of the car,
express it in the coordinate
system of the world

12
Goals for today
• How to define coordinate systems

• How to change coordinate systems

• How to transform objects

• Difference between points, vectors, normals,


and their coordinates

13
Plan
• Vectors

• Points

• Homogenous coordinates

• Normals (in the next lecture)

14
Vector space
• Roughly: Set of elements equipped with
addition and scalar multiplication

• There is a special element, the zero vector


• no displacement, no force

15
Vector space
• We can use a basis to produce all the vectors in
the space:
• Given n basis vectors
any vector can be written as

here:

16
Linear algebra notation

• can be written as

• Nice because it makes the basis


(coordinate system) explicit
• Shorthand:

• where bold means triplet 17


Linear transformation

• Transformation of the vector space

18
Linear transformation

• Transformation of the vector space so that

• Note that it implies


• Notation for transformations

19
Matrix notation
• Linearity implies

20
Matrix notation
• Linearity implies

• L is determined by

• Algebraic notation:

21
Algebraic notation
• The are also vectors in the same space
• Can be expressed in the same basis:

which gives us

22
Putting everything together

23
Two interpretations

• transforming the basis

• transforming the coordinates

24
So What?
• Many existing fast algorithms for linear algebra

• Convenient formulation to keep track of current


basis/coordinate system

25
Change of basis
• Critical in computer graphics
- world to car to arm to hand coordinate system
- Bezier to B splines and back

• Typical issues:
- Remembering which is M or M-1
- Keeping track of where you are

26
High-level advice

Output Input
Change of basis
• Assume we have two bases and
• And we have the coordinates of in

• Then

• This implies

28
Change of basis
• We have &
• Given the coordinate of in B:

• What are the coordinates in A?

29
Change of basis
• We have &
• Given the coordinate of in B:

• Replace B by its expression in A

• has coordinates in A
• Note how we keep track of the coordinate system
by having the basis on the left
30
Linear Transformations?
•L(p + q) = L(p) + L(q)
•L(ap) = a L(p)

31
Linear Transformations
•L(p + q) = L(p) + L(q)
•L(ap) = a L(p)

Translation
Similitudes is not linear:
Linear
Rigid / Euclidean
f(p) = p+t Scalin
Identit
g
f(ap) = ap+t
Translation ≠ a(p+t)Scaling
y Isotropic
Rotati = aReflection
f(p)
Shea
on
f(p+q) = p+q+t ≠ (p+t)+(q+t) = f(p)r + f(q)

32
Plan
• Vectors

• Points

• Homogenous coordinates

• Normals

33
Points vs. Vectors
• A point is a location
• A vector is a motion between two points
• Adding vectors is meaningful
• going 3km North + 4km East = going 5km North-East
• Adding points is not meaningful
• Boston location + New York location = ?
• Multiplying a point by a scalar?
• The zero vector is meaningful (no movement)
• Zero point ?
34
Affine space
• Points are elements of an affine space
• We denote them with a tilde

• Affine spaces are an extension of vector spaces

35
Algebra notation
• We like matrix-vector expressions
• We want to keep track of the frame
• Cheat a little for elegance; decide that 1 times a
point is the point

• is represented by 4 coordinates, where the


extra dummy coordinate is always 1 (for now)
36
Point-vector operations
• Subtracting points gives a vector

• Adding a vector to a point gives a point

37
Affine frames
• A frame is an origin plus a basis B
• We can obtain any point in the space by adding a
vector to the origin

• using the coordinates c of the vector in B

38
Recap
• Vectors can be expressed in a basis
• keep track of basis with left notation
• change basis
• Points can be expressed in a frame
(origin+basis)
• keep track of frame with left notation
• adds a dummy 4th coordinate always 1

39
Affine transformations
• Include all linear transformations
• Applied to the vector basis
• Plus translation

40
Affine matrix
• In 3D a 4 x 4 matrix
Affine transformation
• Applying an affine transform to point
Affine transformation

• Produce valid points (the last coordinate is 1)

• Produce valid frames


Linear component
• We know how to transform the vector basis

44
Linear component

• Note how we leave the fourth component alone


45
Translation component

• Express translation vector t in the basis

46
Translation

47
Full affine expression

How to get a new frame FM


or how to get the coordinates Mc after transformation
48
More notation properties
• If the fourth coordinate is zero, we get a vector
• Subtracting two points:

• Gives us

a vector (last coordinate = 0)


49
More notation properties
• Adding a point

to a vector

• Gives us

a point (fourth coordinate=1)

50
More notation properties
• Vectors are not affected by the translation part

because their 4th coordinate is 0


• If I rotate my moving car in the world, I want its
motion to rotate
• If I translate it, motion should be unaffected
51
Frames & hierarchical modeling
• Many coordinate systems (frames):
• Camera
• Static scene
• car
• driver
• arm
• hand
• ...

• Need to understand nested transformations


52
Frames & hierarchical modeling
• Example: what if I rotate the wheel of the moving
car:
• frame 1: world
• frame 2: car
• transformation: rotation

53
Similarity transformation
• Transformation S wrt car frame F

• If A goes from car frame to world frame:

Car World Transformed Transformed


world car

54
How are transforms combined?
Scale then Translate
(5,3)
Scale(2,2) (2,2) Translate(3,1)
(1,1) (3,1)
(0,0) (0,0)

Use matrix multiplication: p' = T ( S p ) = TS p


1 0 3 2 0 0 2 0 3
TS = 0 1 1 0 2 0 = 0 2 1
0 0 1 0 0 1 0 0 1

Caution: matrix multiplication is NOT commutative!


55
55
Non-commutative Composition
Scale then Translate: p' = T ( S p ) = TS p
(5,3)
Scale(2,2) (2,2) Translate(3,1)
(1,1) (3,1)
(0,0) (0,0)

Translate then Scale: p' = S ( T p ) = ST p


(8,4)
Translate(3,1) (4,2) Scale(2,2)
(1,1) (6,2)
(3,1)
(0,0)

56
Non-commutative Composition
Scale then Translate: p' = T ( S p ) = TS p
1 0 3 2 0 0 2 0 3
TS = 0 1 1 0 2 0 = 0 2 1
0 0 1 0 0 1 0 0 1

Translate then Scale: p' = S ( T p ) = ST p


2 0 0 1 0 3 2 0 6
ST = 0 2 0 0 1 1 = 0 2 2
0 0 1 0 0 1 0 0 1

57
Plan
• Vectors

• Points

• Homogenous coordinates

• Normals

58
Forward reference and eye
• The fourth coordinate is useful for perspective
projection
• Called homogenous coordinates

59
Homogeneous Coordinates in R 2

All points of the form

where we identify

for all nonzero c.


Some Exercises

• Convert (x,y) to homogeneous


coordinates.

• Convert the following points from


homogeneous coordinates:
- (1,5;1) 
- (12,-6;3) 
- (5,15;-5) 
Homogeneous Coordinates
•Add an extra dimension (same as frames)
• in 2D, we use 3-vectors and 3 x 3 matrices
• In 3D, we use 4-vectors and 4 x 4 matrices
•The extra coordinate is now an arbitrary value, w
• You can think of it as “scale,” or “weight”
• For transformations except
perspective, can set w=1
and not worry about it x' a b c x
=
y‘ d e f y
1 0 0 1 1
62
Points at Infinity

Encodes points
and directions!
Points at Infinity

Encodes points
and directions!

Challenge for math students:

What is the topology of


the projective plane?
Why homogeneous?
• This picture gives away almost
the whole story.

w=1

w=2

65
Perspective in 2D
• Camera at origin, looking along z, 90 degree
f.o.v., “image plane” at z=1

66
Perspective in 2D
The projected point in
homogeneous
coordinates
(we just added w=1):

67
Perspective in 2D

Projectively
equivalent

68
Perspective in 2D
We’ll just copy z to w,
and get the projected
point after
homogenization!

69
Homogeneous Visualization
• Divide by w to normalize (project)

(0,0,0)

(0, 0, 1) = (0, 0, 2) = … w=1


(7, 1, 1) = (14, 2, 2) = …
(4, 5, 1) = (8, 10, 2) = … w=2

70
Projective Equivalence – Why?
• For affine transformations,
adding w=1 in the end proved to be convenient.
• The real showpiece is perspective.

71
Fun example: Photo tourism
• Application of homogenous coordinates
• Goal: given N photos of a scene
• find where they were taken
• get 3D geometry for points in the scene

72
Step 1: point correspondences
• Extract salient points (corners) from images
• Find the same scene point in other images
• To learn how it’s done, take 6.815

73
Structure from motion
• Given point correspondences
• Unknowns: 3D point location, camera poses
• For each point in each image, write perspective
equations p 4

p1 p3 minimize
p2
f (R, T, P)
p5 p7
p6

Camera 1 Camera 3
R1,t1 Camera 2 R3,t3
R2,t2 74
Eye candy: photo tourism

QuickTime™ and a
MPEG-4 Video decompressor
are needed to see this picture.

75
That’s All for Today
• Further Reading
–Buss, Chapter 2

• Other Cool Stuff


–Algebraic Groups
–http://phototour.cs.washington.edu/
–http://phototour.cs.washington.edu/findingpaths/
–Free-form deformation of solid objects
–Harmonic coordinates for character articulation

76

You might also like