Академический Документы
Профессиональный Документы
Культура Документы
Modeling Viewing
Transformation Transformation
Model 1
M1
2D
Image
2D Scene Projection
Rasterization
2D Transformation
Scaling
X → X'
X ' = X .T
a b
[x , y ] = [x, y ]
' '
= [(ax + cy ), (bx + dy )]
c d
If a = d = 1 and b = c = 0
T = Identity Matrix
X’ = X
2D Transformation
General 2x2 Matrix
If b = c = 0 y
X’ = [ax, dy] : Scaling
P’ P
If b = c = 0 and a = -1, d = 1
X’ = [-x, y] : Reflection
x
2D Transformation
General 2x2 Matrix
1 0
[x , y ] = [x, y ]
' '
= [ x + cy , y ] Shearing in X
c 1
2D Transformation
General 2x2 Matrix
1 b
[x , y ] = [x, y ]
' '
= [ x , bx + y ] Shearing in Y
0 1
2D Transformation
Translation
Scale/Rotate/Reflect/Shear: X’ = XT
Translate: X’ = X + T
P = [x, y ]
Ph = [ x , y , w ]
w (x, y,w)
(x/w, y/w,1)
w=1
x
y
2D Transformation
Homogenous Coordinates
X → X'
X ' = X .T
a b 0
[ x ' , y ' , w ] = [ x , y ,1] c d 0
l m 1
= [(ax + cy + l ), (bx + dy + m ),1]
2D Transformation
Homogenous Coordinates
Translation
1 0 0
T = 0 1 0
l m 1
X ' = XT
[x', y ' ] = [ x + l, y + m]
2D Transformation
Homogenous Coordinates
Scaling/Rotation/Shear
a b 0
T = c d 0
0 0 1
2D Transformation
Homogenous Coordinates
Successive translations: T1 = (l1, m1), T2 = (l2, m2)
After T1 After T1 and T2
1 0 0 1 0 0
X' = X 0 1 0 X'' = X' 0 1 0
l1 m1 1 l 2 m2 1
1 0 0 1 0 0 1 0 0
X'' = X 0 1 0 0 1 0 = X 0 1 0
l1 m1 1 l 2 m2 1 l1 + l 2 m1 + m2 1
Successive translations are additive
2D Transformation
Homogenous Coordinates
Successive scaling: S1 = (sx1, sy1), S2 = (sx2, sy2)
After S1 After S1 and S2
s x1 0 0 s x 2 0 0
X' = X 0 s y 1 0 X'' = X' 0 sy 2 0
0 0 1 0 0 1
s x 1 0 0 s x 2 0 0 s x 1s x 2 0 0
X'' = X 0 s y 1 0 0 sy 2 0 = X 0 s y 1s y 2 0
0 0 1 0 0 1 0 0 1
Successive scaling is multiplicative
2D Transformation
Homogenous Coordinates
Successive rotations: R(θ), R(φ)
After R(θ) After R(θ) and R(φ)
cos è sin è 0 cos ö sin ö 0
X' = X − sin è cos è 0 X'' = X' − sin ö cos ö 0
0 0 1 0 0 1
cos(è + ö ) sin(è + ö ) 0
X'' = X − sin(è + ö ) cos(è + ö ) 0
0 0 1
Successive rotations are additive
2D Transformation
Composition of transformation
Rotation about arbitrary point y
• Rotate about O
O x
cos è sin è 0
X'' = X' − sin è cos è 0
0 0 1
2D Transformation
Composition of transformation
Rotation about arbitrary point y
1 0 0 cos è sin è 0 1 0 0
Xf = X 0 1 0 − sin è cos è 0 0 1 0
− l −m 1 0 0 1 l m 1
cos è sin è 0
= X − sin è cos è 0
− m (cos è − 1) + n sin è − n(cos è − 1) − m sin è 1
2D Transformation
Composition of transformation
Reflection about an arbitrary line
B
y
C
A
O x
2D Transformation
Composition of transformation
Reflection about an arbitrary line
y
B
Translation C
A
O x
2D Transformation
Composition of transformation
Reflection about an arbitrary line
y
Rotation B
A C
O x
2D Transformation
Composition of transformation
Reflection about an arbitrary line
y
Reflection
O x
A C
B
2D Transformation
Composition of transformation
Reflection about an arbitrary line
y
Rotation
O A x
B
2D Transformation
Composition of transformation
Reflection about an arbitrary line
y
Translation
C
A
O B x
2D Transformation
Composition of transformation
Given T1 and T2
In general,
T = T1T2 ≠ T2T1
2D Transformation
Rigid Transformations
• Square remains square
• Preserves length and angles
• Sequence of rotations and translations
r11 r12 0
T = r21 r22 0
l m 1
2D Transformation
Affine Transformations
• Preserves parallelism
• Sequence of rotations, translations, scaling and shear
a b 0
T = c d 0
l m 1
• 3x3 matrix
a b p
T = c d q
l m s