Graphics Reference
In-Depth Information
The discussion in Section 8.5 tells us that both T and S are 4
×
4 matrices, and M a
is also a 4
×
4 matrix. Now when applying M a to any vertex position V 1 =(
x 1 ,
y 1 )
,
Cost of concatenation. It
costs exactly 16 floating-point
multiplications and nine
floating-point additions to
compute the concatenation of
two 4
the net effect is the same as applying the S and T operators in succession:
V 2
=
V 1 M a
= (
y s .
x 1 +
t x ) ×
x s
(
y 1 +
t y ) ×
×
4 matrices.
The advantages of concatenating multiple operators (matrices) into a single oper-
ator (matrix) include the following.
Compact representation. Instead of writing TS , we can simply express
the combined operation as M a . This more compact representation allows
simpler and more precise expression for the desired operations.
Vector-to-matrix multiplica-
tions. Depending on the ac-
tual implementation, in 3D
space, this operation typi-
cally involves nine floating-
point multiplications and nine
floating-point additions, or 18
floating-point operations.
Computation efficiency. From the given example, we see that there are
two ways to compute V at s , either by applying T and S separately or by ap-
plying the concatenated matrix M a . Mathematically, the results from the
two approaches are identical. Computationally, the first approach involves
two vector-matrix multiplications, while the second approach involves one
matrix-matrix multiplication and one vector-matrix multiplication. If we
need to compute this same operation for a large number of vertices (e.g.,
n vertices), the first approach would take 2 n vector-matrix multiplications,
whereas the second approach can reuse the same concatenated matrix and
would only need to perform n extra vector-matrix multiplications. In gen-
eral, the characteristics of computer graphics applications are such that we
often perform the same sequence of transformations on a large number of
vertices. Usually, it is more cost efficient to concatenate matrices.
Order of concatenation. As
discussed in Section 8.5, the
order is important in matrix
multiplication. In general,
Notice that in Equation (9.2), the translation is on the left side of the scaling
operator. This means that the translation matrix will operate on the input vertex
position before the scaling operator. If we switch the order of the two transform
operators, we get
M 1 M 2
= M 2 M 1 .
M b =
ST
.
Notice that the operator M b applies scaling before translation. In general,
M a =
M b ,
or
TS
=
ST
.
In transformation operations, the order of applying the operators, or the order of
concatenation, is very important! For example, we can easily verify the effects of
Search WWH ::




Custom Search