Page 132 - DCAP313_LAB_ON_COMPUTER_GRAPHICS
P. 132
Lab on Computer Graphics
Notes • Vector form:
1. P´ = S*P
s Ê 0 ˆ
S = Á Ë 0 x s ¯ ˜
y
8.2.3 2D Scaling From the Origin
General fixed point scaling (scaling about a point (a b) :
• Translate Origin To (a b).
• Scale by (Sx Sy).
• Translate Origin Back.
It can be clarify as:
Point P defined as P(x, y),
Perform a scale (stretch) to Point P’(x’, y’) by a factor S x along the x-axis,
And S y along the y-axis
X’ = S x *X, Y’ = S y *Y
So scaling around the origin:
S È x 0 ˘
[x y] = [x y] Í 0 s ˙
or Í y ˙
Ê Q ˆ s Ê x 0 0 0ˆ Ê P ˆ
x
x
Á Q ˜ Á 0 s 0 0 ˜ Á P ˜
y
˜ Á
y
Á Á Q ˜ ˜ = Á 0 Á 0 y s 0˜ Á P ˜ ˜
Á z ˜ Á z ˜ Á z ˜
1 Ë ¯ 0 Ë 0 0 1¯ Ë 1 ¯
8.2.4 Scaling about a Particular Point
Figure 8.13 illustrates a scaling about a particular point.
Figure 8.13: Scaling about a Particular Point
3
2
1.5
1
1
0.5
-1 1 2 3 4 -1 -0.5 1 2 3 4
-1 x x
Scaling in 2D
Coordinates multiplied by the scaling factor:
• x’ = sx*x
• y’ = sy*y
126 LOVELY PROFESSIONAL UNIVERSITY