CSCE 441 Lecture 8
Jump to navigation
Jump to search
« previous | Friday, January 31, 2014 | next »
2D Transformations
Coordinates
Depends on choice of origin (0,0) and axes.
Analogous to assembly language:
- Assembly is a necessary evil for computation
- But we'd like to think at a higher level
Vector operations
- dot product
- commutative
- 2D cross product
- Rotates by
Types of Transformations
- Conformal
- Preserves angles
- Translation, rotation, uniform scaling
- Affine
- Represented by matrix multiplication
- Translation, rotation, general scaling, shear
Translation
Add vector to point :
Uniform Scaling
origin about which to scale
Given point to scale and scaling factor ,
- find vector from to :
- scale that vector by alpha:
- add the vector back to to get final position:
Rearranging the terms gives
Non-Uniform Scaling
Point and vector:
- origin point for center of scaling
- direction of scale (assumed unit length)
Given point to scale and a scaling factor ,
- find vector from to :
- take vector projection of onto :
- use projection to find residual vector:
- scale the -parallel component of :
- add residual vector back in and add to origin point to get final point:
Substituting definitions and rearranging the formula gives
Rotation
Need center of rotation and angle
Given point to rotate about point ,
- find vector from to :
- set up a "coordinate system" by taking the 2D cross product
- using and as new axes, observe that the rotated point is at position
- hence the vector from to is given by
- Add the origin point to get the final position.
Shearing
Point and unit vector .
Given point to shear by amount ,
- compute
- set up a coordinate system by finding the 2D cross product of :
- project onto and to get and , respectively.
- the shearing vector scales (in the direction of depending on the magnitude of and :
- Add to get the final position
Plugging in definitions and rearranging gives
Transformations as Matrices
- Compact representation of all affine transformations
- allows multiple transformatinos to be represented as a single matrix
- requires coordinates