lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 -...

42
lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates

Upload: others

Post on 17-Apr-2020

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates

lecture 2

- model transformations (rotations, scaling, translation)

- intro to homogeneous coordinates

Page 2: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates
Page 3: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates

2D Rotation

Page 4: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates
Page 5: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates
Page 6: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates

Two ways to think about R.

1) R rotates points within a fixed coordinate frame ("world coordinates")

Page 7: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates

2) R maps to a new coordinate system by projecting onto new axes.

Page 8: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates

How will rotations be used?

1) re-orient an object ("model")

2) map from world coordinates to camera coordinates ("view")

Page 9: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates

3D Rotations

Page 10: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates

counter-clockwise(assuming eye is looking in the -z directionand the coordinates are righthanded)

Example: rotate about z axis

Page 11: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates
Page 12: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates
Page 13: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates
Page 14: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates
Page 15: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates
Page 16: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates
Page 17: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates
Page 18: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates
Page 19: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates
Page 20: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates
Page 21: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates
Page 22: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates
Page 23: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates
Page 24: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates
Page 25: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates
Page 26: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates

Problem Example 4

Find a rotation matrix that rotates by aroundan axis p and that is composed of a sequenceof rotations only around axes x, y, z.

Example solution: (think this through for yourself )

1. Rotate around x axis to bring p to the xy plane.2. Rotate around z axis to bring p to the y axis.3. Rotate by around y axis.4. Apply inverse rotation of 2.5. Apply inverse rotation of 1.

Page 27: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates

ASIDE: Representations of rotations

(very important for Computer Animation)

1) Axis-Angle -> OpenGL's glRotate()

2) Euler angles (Rz Rx Ry)

3) Quaternions

https://www.youtube.com/watch?v=syQnn_xuB8U&list=PL2y2aRaUaygU2zXme_Z11GyJUslwgaeUD

https://www.youtube.com/watch?v=zc8b2Jo7mno

Page 28: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates
Page 29: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates
Page 30: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates
Page 31: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates
Page 32: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates
Page 33: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates

This is called a "homogeneous coordinates"representation.

Trick: use a 4th coordinate.

Page 34: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates

In computer graphics, we always use a 4Drepresentation to transform points.

rotation scaling

Page 35: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates

Homogeneous Coordinates

We represent (x,y, z) by (x, y, z, 1).

Now define an equivalence:

(x, y, z, 1 ) (w x, wy, wz, w) for any w 0.

This takes each line { (wx, wy, wz, w) } in R^4and associates it with the 3D point (x, y, z).

Page 36: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates

Careful:

The above is an abuse of notation.It is meant to express that:

Page 37: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates
Page 38: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates
Page 39: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates
Page 40: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates
Page 41: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates
Page 42: lecture 2 - model transformations (rotations, scaling ...langer/557/2-slides.pdf · lecture 2 - model transformations (rotations, scaling, translation) - intro to homogeneous coordinates