Graphics Reference
In-Depth Information
where s x and s y are the factors of scaling in the x -axis and y -axis directions, re-
spectively. We represent this scaling operation as
V as =
V a S
(
s x ,
s y )=
V a S
.
=
Figure 8.5 shows an example where the scaling operator has scale factors of s x
3
=
.
and s y
0
5, or
Y-a xis
S
(
s x ,
s y )=
S
(
3
,
0
.
5
) ,
S(3,0.5)
V a (3,8)
operating on the point V a :
V as (9,4)
V a = x a y a = 38
X-axis
Origin
and resizing the point to the new position V as :
Figure 8.5.
The scale
operator.
V as = x as y as
=
V a S
(
s x ,
s y )
= x a ×
s y
s x y a ×
= 3
5
×
38
×
0
.
94
=
.
Notice that we can work with the x and the y scaling factors independently: the
amount of size change in the x -axis direction is defined solely by the s x parameter
and is unrelated to s y in any way. Typically, scaling factors are positive floating-
point numbers.
0 has the effect of stretching a
point in the positive direction of the corresponding axis, whereas a factor less
than 1
A scaling factor greater than 1
.
Y-axis
0 has the effect of compressing a point toward the origin. From Figure 8.5,
we see that s x
.
=
3 stretches x a (the x -component of V a ) from x
=
3to x
=
9,
S(3,0.5)
)
will push all input points to the origin. As in the case of the translation operator,
the scaling operator repositions a point relative to the point's initial position, and
this operation is independent of any other points.
=
.
=
=
(
,
whereas s y
0
5 compresses y a from y
8to y
4. Scaling factors of S
0
0
V c = (1,5)
V cs =(3 , 2.5)
X-axis
Origin
Figure 8.6. Scaling two
points with S ( 3 , 0 . 5 ) .
As we saw in the case of translation, this property allows us to apply the same
operator on any number of points. Figure 8.6 shows that we can apply the same
S
(
,
.
)
3
0
5
operator on the point V c :
V c = x c y c = 15 ,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Search WWH ::




Custom Search