« previous | Monday, February 10, 2014 | next »
3D Transformations
The following transformations are the same:
- Transformations
- Uniform Scaling
- Non-Uniform Scaling
Rotation
Rotation in 3D is slightly different.
Given a unit vector , a point , which is the 'origin' of , and a point to rotate,
- Compute
- Decompose into its components parallel () and perpendicular () to using vector projections:
- Compute cross product to define the basis for a plane perpendicular to with as an axis.
- Use and as a new 2D coordinate system.
- Find a new rotated form of with
- Add and to this rotated vector to get the rotated point:
Mirror Image
A new transformation for 3D space.
Given unit vector , a point , which is the 'origin' of reflection, and a point , we will mirror about the plane defined by the normal vector and point .
- Compute
- Decompose into its components parallel () and perpendicular () to :
- Subtract from to get the vector from to its reflection:
Note: This is identical to non-uniform scaling with a scale factor of
Orthogonal Projection
Useful for projecting 3D objects onto the screen for rendering.
Given a point , which is the 'origin' (like in mirror image), the orthogonal projection of a point is given by:
- Compute
- Decompose into its components parallel () and perpendicular () to as above
- Subtract from (instead of like in above)
Thus
Note: This is identical to non-uniform scaling with a scale factor of
Perspective Projection
Using a new point , which is the eye of the observer, is the intersection of and the plane defined by and .
- The equation of the plane is
- The equation of the line from to is
- Substitute the line equation for in the plane equation and solve for :
- evaluate to find the intersection point
Precondition: cannot be parallel to the plane? (since denominator wold be zero)
Perspective projection of vectors is not defined because we would get different projections depending on the location of the vector to project.
Warning: Perspective transformation is not affine
3D Transformations as Matrices
Exactly like 2D, but the matrices are now 4 × 4
Similar block-structure , but is a 3 × 3 matrix.
Dot Product
Still .
Cross Product
Component Decomposition
Translation
Uniform Scaling
What's multiplied by ?
What's added to ?
and
Non-Uniform Scaling
What's multiplied by ?
What's added to ?
and
Next time
Continue with rotation about an arbitrary axis.