# 06a Transformation

Document Sample

```					        CPSC 453:
Transformations
(Chapter 4.7)

Mark Matthews
matthews@cpsc.ucalgary.ca
Office Hours: 3:15-4:00PM TR (same)
Office: 680J (same)
www.cpsc.ucalgary.ca/~sheelagh/courses/453
Review
• 2P-Q okay
• P-3Q+2v not okay
• Why? Substitute:
• POINTS = 1
• vector = 0
• 2P-Q = 2(1) – 1 = 1 …. A valid point
• P-3Q+2v = (1) – 3(1) + 2(0) = -2 … invalid
• Result must be 0 or 1
Transformations
Transformations
• Essential concept of computer graphics

• Translation

• Rotation

• Scaling
Transformations
• Adjusts objects for proper size, situation and
direction
• Change transformation properties over time for
animation
• Compose a scene out of similar objects

• Viewing is also a transformation (discussed later)
Rotation

• Can be used for points or vectors
• Affine transformation
• Transforming endpoints is enough
Translation
• Point Translation

• P’ = P + v

• Is there a matrix form for this?

• Is it affine? Line preserving?

• Does it work for points and vectors?
• There is no matrix operation for translation

 x' a b   x 
 y '   c d    y 
              
• Translation is affine.

• Different interpretations for points and vectors

• We need a new method
Homogenous Coordinates
Useful Representation

• Good separation between points and vectors

• Shows directly our method for Affine
transformations

• A method for translation using matrices
Translation
• Point Translation

•   Points: moved by translation.
•   Vectors: unaffected by translation.
•   2D translation in homogenous coordinates
•   3D translation in homogenous coordinates
New Rotation
• Rotation:

 x' cos         sin    0  x 
 y '   sin    cos          y
0  
  
1  0
                  0       1  1 
  
Scaling
• Changes the size of the object, uniformly
or non-uniformly
• Matrix operation:

• Negative values produce reflection
Criteria for Affine Transformations
• Is the transformation affine?
• What is a simple criteria
• Matrix form of an affine transform:
• 2D

• 3D

• So scaling is affine
Review of Affine Transforms
• Affine Transform
• A maps points to points
• A maps vectors to vectors
Shear Transformation?
• Along the x-axis:
• 2D Matrix

• 3D Matrix

• Affine Transformation
Rotation in 3D
• Pick an axis to rotate about
• Simple extension of planar rotation

• For z-axis, matrix is:

• Where c denotes cos and s denotes sin
• Also given as P’ = Rz() . P
Rotation about the X and Y axis
• For x-axis, the matrix
is:

• For y-axis, the matrix
is:

```
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
 views: 6 posted: 9/12/2012 language: Unknown pages: 18