Graphics Programs Reference
In-Depth Information
▪
Translation:
shifting an object to a new position
▪
Scaling:
changing the dimensions of an object
▪
Rotation:
rotating an object about a center
In Geometric transformation, an object is transformed to a new position (translation),
a new size (scaling), or a new configuration (rotation). This transformation is
achieved using matrices for various types of geometric transformation. Therefore,
translation
is achieved by using a
translate matrix
,
scaling
is achieved by using a
scale matrix
, and
rotation
is achieved by using a
rotate matrix
.
Note
It is possible to combine various transformations in a single
matrix. For now, I do not want to expose you to advanced concepts.
Chapter 3
demonstrates combining transformations, using
Android's matrix math utilities.
Figure 2-4
shows a spacecraft trying to dodge incoming rocks. Assuming the image
is a 3D scene in a game within which the motion of spacecraft is confined along the
x and y axes, the only possible way to successfully dodge the rocks is by translating
along the x-axis (in the directions in which the longer arrows are pointing). In graph-
ic rendering APIs, this can only be achieved by translation transformation.
Search WWH ::
Custom Search