Professional Documents
Culture Documents
CAD PAPERS
CAD PAPERS
Chapter 3 3
Chapter 3. 2D Transformations
3.1 Introduction
3.2 2D Transformation
3.3 Composing transformations
3.4 Geometric transformations around a point
3.5 Coordinate system transformations
• The transformations we are going to study are: translation, rotation and scaling
Y Right-handed
coordinate system
Y
R2 R3
Point at (2,3)
X X
Z Point at (2,-2,2)
R2
There=(7,7)
Operation to move
sum 5 to x,
sum 4 to y Here=(2,3)
N
γ
θ L’
L
Sum of vectors
Y Y
⎡ 2⎤ ⎡ 4 ⎤ ⎡ 6 ⎤ P+P’
P' ' = P + P' = ⎢ ⎥ + ⎢ ⎥ = ⎢ ⎥
⎣3 ⎦ ⎣ 2 ⎦ ⎣ 5 ⎦
⎡ 2⎤
P=⎢ ⎥ P
⎣3 ⎦
⎡ 4⎤
P' = ⎢ ⎥
⎣ 2⎦
P’
X X
• Product by a scalar
• Linear dependency
– Two vector are linearly dependents
when one is multiple of the other
Y
Y αP
⎡2x ⎤ ⎡2 ⋅ 3⎤ ⎡6⎤
2P ⎢ ⎥ = ⎢
= ⎥ =⎢ ⎥
⎣ 2y ⎦ ⎣2 ⋅ 2⎦ ⎣ 4⎦
2P
⎡ x ⎤ ⎡3 ⎤ P
P=⎢ ⎥=⎢ ⎥
⎣ y ⎦ ⎣ 2⎦
X X
-P
⎡n⎤ ⎡a ⎤ ⎡ c ⎤ ⎡α ⋅ a + β ⋅ c ⎤
⎢m⎥ = α ⋅ ⎢b ⎥ + β ⋅ ⎢d ⎥ = ⎢α ⋅ b + β ⋅ d⎥
⎣ ⎦ ⎣ ⎦ ⎣ ⎦ ⎣ ⎦
– It is always possible to find α and β meanwhile [a b] and [c d] do not be linearly
dependents
|P|cosθ
⎡- 3 ⎤ Y
P' = ⎢ ⎥
⎣4⎦ ⎡ 4⎤
P=⎢ ⎥
P ⎣3 ⎦
X
θ (θ−φ)
P • P' = x ⋅ x' + y ⋅ y' = (4 ⋅ -3) + (3 ⋅ 4) = 0
φ W
P • P' = P ⋅ P' ⋅ cos(90 o ) = P ⋅ P' ⋅ 0 = 0
θ (θ−φ)
φ W
• Translation
– To move an object from one position to another different
X’ = X + Tx; Y’ = Y + Ty;
⎡X⎤ ⎡ X ′⎤ ⎡T x ⎤
P=⎢ ⎥ P′ = ⎢ ⎥ T =⎢ ⎥
⎣Y ⎦ ⎣Y ′ ⎦ ⎣T y ⎦
P’ = P + T
• Scaling
– Modifying the size of an object
X’ = X * Sx; Y’ = Y * Sy;
⎡ X⎤ ⎡ X ′⎤ ⎡Sx 0 ⎤
P=⎢ ⎥ P′ = ⎢ ⎥ S =⎢ ⎥
⎣Y ⎦ ⎣Y ′ ⎦ ⎣ 0 Sy ⎦
• Scaling
• Rotation
– Rotation of a point with respect another one (in this case the origin)
– If a point in polar coordinates (r, β) a rotation is applied:
P’ = R * P
⎡ cos (α ) − sen( α ) ⎤
R =⎢ ⎥
r ⎣sen( α ) cos( α ) ⎦
• Homogenous coordinates
– Homogenize the three transformations: a matrix product
– In order to get homogeneous coordinates the plane is included into
a 3D space in which the third dimension is constant
[X Y] ⇒ [X Y 1]
– In this manner several transformations can be accumulated into
just one matrix
– The new matrices are:
• Order of transformations
– The matrix product is not commutative
M1*M2<>M2*M1
– Transformations either
– Transformations that are commutative
• Translation-Translation
• Scaling-Scaling
• Rotation-Rotation
Translation after rotation
• Proportional scaling-Rotation
– Non-commutative transformations
• Translation-Scaling
• Traslation-Rotation
• Non-proportional scaling-Rotation
• Window-viewport transformation:
– Windows bottom-left corner is moved to origin
– Scaling factor are applied in order to force window
wymin
an viewport identical sizes
– Origin is translated to viewport bottom-left corner Window
wxmin wxmax
Real world coordinates
vymax
Viewport
vymin
vxmin vxmax
Without clipping
ISOTROPIC
ANISOTROPIC
Window
With clipping
• Isotropic (keeping proportions, 1 scaling factor) or
anisotropic (2 scaling factors). To achieve the isotropic,
viewport definition has to be proportional to the window
Viewport