Docsity

Lecture Slides on 3D Transformations | CS 4620, Study notes of Computer Graphics

Partial preview of the text

Download Lecture Slides on 3D Transformations | CS 4620 and more Study notes Computer Graphics in PDF only on Docsity!

Cornell CS4620 Fall 2008 •!Lecture 7 © 2008 Steve Marschner •

3D Transformations

CS 4620 Lecture 7

1 Cornell CS4620 Fall 2008 •!Lecture 7 © 2008 Steve Marschner •

Translation

2

Translation

Translation

Cornell CS4620 Fall 2008 •!Lecture 7 © 2008 Steve Marschner •

Translation

2 Cornell CS4620 Fall 2008 •!Lecture 7 © 2008 Steve Marschner •

Scaling

3

Scaling

Scaling

Cornell CS4620 Fall 2008 •!Lecture 7 © 2008 Steve Marschner •

Rotation about x axis

5 Cornell CS4620 Fall 2008 •!Lecture 7 © 2008 Steve Marschner •

Rotation about y axis

6

Rotation about y axis

General rotations

• A rotation in 2D is around a point

• A rotation in 3D is around an axis

  • so 3D rotation is w.r.t a line, not just a point
  • there are many more 3D rotations than 2D
    • a 3D space around a given point, not just 1D

2D 3D

Cornell CS4620 Fall 2008 •!Lecture 7 © 2008 Steve Marschner •

Specifying rotations

• In 2D, a rotation just has an angle

  • if it’s about a particular center, it’s a point and angle

• In 3D, specifying a rotation is more complex

  • basic rotation about origin: unit vector (axis) and angle
    • convention: positive rotation is CCW when vector is pointing at you
  • about different center: point (center), unit vector, and angle
    • this is redundant: think of a second point on the same axis...

• Alternative: Euler angles

  • stack up three coord axis rotations 8 Cornell CS4620 Fall 2008 •!Lecture 7 © 2008 Steve Marschner •

Coming up with the matrix

• Showed matrices for coordinate axis rotations

  • but what if we want rotation about some random axis?

• Compute by composing elementary transforms

  • transform rotation axis to align with x axis
  • apply rotation
  • inverse transform back into position

• Just as in 2D this can be interpreted as a similarity transform

9

Building general rotations

• Using elementary transforms you need three

  • translate axis to pass through origin
  • rotate about y to get into x-y plane
  • rotate about z to align with x axis

• Alternative: construct frame and change coordinates

  • choose p , u , v , w to be orthonormal frame with p and u matching the rotation axis
  • apply similarity transform T = F Rx (! ) F–

Orthonormal frames in 3D!

• Useful tools for constructing transformations

• Recall rigid motions

  • affine transforms with pure rotation
  • columns (and rows) form right handed ONB
    • that is, an o rtho n ormal b asis

Cornell CS4620 Fall 2008 •!Lecture 7 © 2008 Steve Marschner •

Transforming normal vectors

• Transforming surface normals

  • differences of points (and therefore tangents) transform OK
  • normals do not 15