Game Development Reference
In-Depth Information
Figure 5.6
Scaling a 2D object
with various factors
for k x and k y
As is intuitively obvious, the basis vectors p and q are independently
affected by the corresponding scale factors:
p
= k x p = k x
1
0
=
k x
0
,
q
= k y q = k y
0
1
=
0 k y
.
Constructing the 2D scale matrix S (k x ,k y ) from these basis vectors, we get
p
k x 0
0 k y
S (k x ,k y ) =
=
.
2D matrix to scale on
cardinal axes
q
For 3D, we add a third scale factor k z , and the 3D scale matrix is then
given by
2
3
k x
0
0
3D matrix to scale on
cardinal axes
4
5
S (k x ,k y ,k z ) =
0 k y
0
.
0
0 k z
 
Search WWH ::




Custom Search