Game Development Reference
In-Depth Information
Solution :
0
j
(
0
0
1
0
)
x
j
(
0
0
)
1
y
0
j
(
0
0
0
1
)
z
So, j = (0, 1, 0). Recall from the section titled “Dot Products” that if
u·v = 0, then u v . Since j · k = 0 and j · i = 0, we know j is orthogo-
nal to both k and i .
We use the following D3DX function to compute the cross product
between two vectors:
D3DXVECTOR3 *D3DXVec3Cross(
D3DXVECTOR3* pOut, // Result.
CONST D3DXVECTOR3* pV1, // Left sided operand.
CONST D3DXVECTOR3* pV2 // Right sided operand.
);
It is obvious from Figure 7 that the vector - p is also mutually orthogo-
nal to both u and v . The order in which we perform the cross product
determines whether we get p or - p as a result. In other words, u v =
-( v u ). This shows that the cross product is not commutative. You can
determine the vector returned by the cross product by the left hand
thumb rule . (We use a left hand rule because we are using a left-handed
coordinate system. We would switch to the right hand rule if we were
using a right-handed coordinate system.) If you curve the fingers of
your left hand in the direction of the first vector toward the second vec-
tor, your thumb points in the direction of the returned vector.
Matrices
In this section we concentrate on the mathematics of matrices. Their
applications to 3D graphics are explained in the next section.
An m n matrix is a rectangular array of numbers with m rows and
n columns. The number of rows and columns give the dimension of the
matrix. We identify a matrix entry by specifying the row and column
that it is in using a double subscript, where the first subscript identifies
the row and the second subscript identifies the column. Examples of a 3
3 matrix M ,a2 4 matrix B ,anda3 2 matrix C follow:
m
m
m
c
c
11
12
13
11
12
b
b
b
b
11
12
13
14
M
m
m
m
B
C
c
c
21
22
23
21
22
b
b
b
b
21
22
23
24
c
c
m
m
m
31
32
31
32
33
Search WWH ::




Custom Search