Академический Документы
Профессиональный Документы
Культура Документы
Larry F. Hodges 1
(modified by Amos Johnson)
Rotation About the Origin
y-axis
we observe:
A
(0,0)
x-axis
Larry F. Hodges 2
(modified by Amos Johnson)
Rotation About the Origin
From the double angle formulas: sin (A + B) = sinAcosB + cosAsinB
cos (A + B)= cosAcosB - sinAsinB
P2 = R . P1
(x2) (cosB -sinB) (x1)
=
(y2) (sinB cosB) (y1)
Larry F. Hodges 3
(modified by Amos Johnson)
Translations
Moving an object is called a translation. We translate a point by adding to
the x and y coordinates, respectively, the amount the point should be
shifted in the x and y directions. We translate an object by translating
each vertex in the object.
P2 = P 1 + T
Ty
P1 = ( x1 ) T = ( tx )
Tx ( y1 ) ( ty )
P2 = (x1 + tx)
(y1 + ty)
Larry F. Hodges 4
(modified by Amos Johnson)
Scaling
Changing the size of an object is called a scale. We scale an object by scaling
the x and y coordinates of each vertex in the object.
P2 = S .P1
S = (sx 0) P1 = ( x1 )
(0 sy) ( y1 )
P2 = (sxx1)
(syy1)
Larry F. Hodges 5
(modified by Amos Johnson)
Homogeneous Coordinates
Although the formulas we have shown are usually the most efficient way to
implement programs to do scales, rotations and translations, it is easier to
use matrix transformations to represent and manipulate them.
cos ø -sin ø 0
Rø = sin ø cos ø 0
(x)
0 0 1 Point P = (y)
(1)
Sx 0 0
S = 0 Sy 0
0 0 1
1 0 Tx
T = 0 1 Ty
0 0 1
Larry F. Hodges 6
(modified by Amos Johnson)
Composite Transformations - Scaling
Given our three basic transformations we can create other transformations.
(2 0 0) (4) = (8)
Before
(0 1 0) (1) (1)
(0 0 1) (1) (1) After
0 1 2 3 4 5 6 7 8 9 10
Larry F. Hodges 7
(modified by Amos Johnson)
Composite Transforms - Scaling (cont.)
If we scale a line between (0, 1) (2,1) to twice its length, the left-hand
endpoint does not move.
(2 0 0) (0) = (0)
(0 1 0) (1) (1)
(0 0 1) (1) (1)
(2 0 0) (2) = (0)
(0 1 0) (1) (1) Before
0 1 2 3 4 5 6 7 8 9 10
(0,0) is known as a fixed point for the basic scaling transformation. We can
used composite transformations to create a scale transformation with
different fixed points.
Larry F. Hodges 8
(modified by Amos Johnson)
Fixed Point Scaling
Scale by 2 with fixed point = (2,1)
• Translate the point (2,1) to the origin
• Scale by 2
• Translate origin to point (2,1)
(1 0 2) (2 0 0) (1 0 -2) = (2 0 -2)
(0 1 1) (0 1 0) (0 1 -1) (0 1 0)
(0 0 1) (0 0 1) (0 0 1) (0 0 1)
After
(2 0 -2) (4) = (6)
(0 1 0) (1) (1)
(0 0 1) (1) (1) 0 1 2 3 4 5 6 7 8 9 10
Larry F. Hodges 9
(modified by Amos Johnson)
More Fixed Point Scaling
Scale by 2 with fixed point = (3,1)
• Translate the point (3,1) to the origin
• Scale by 2
• Translate origin to point (3,1)
(1 0 3) (2 0 0) (1 0 -3) = (2 0 -3)
(0 1 1) (0 1 0) (0 1 -1) (0 1 0)
(0 0 1) (0 0 1) (0 0 1) (0 0 1)
(x,y) (x,y)
1 0 0 1 b 0
a 1 0 0 1 0
0 0 1 0 0 1
Larry F. Hodges 12
(modified by Amos Johnson)
Reflections
Reflection about the y-axis Reflection about the x-axis
-1 0 0 1 0 0
0 1 0 0 -1 0
0 0 1 0 0 1
Larry F. Hodges 13
(modified by Amos Johnson)
More Reflections
Reflection about the origin Reflection about the line y=x
-1 0 0 0 1 0
0 -1 0 1 0 0
0 0 1 0 0 1
Larry F. Hodges 14
(modified by Amos Johnson)