That’s a good question. Here’s the usual 4-dimensional matrix used in 3D, like TV_3DMATRIX in TV6.5 :
| 1 2 3 0 | | 5 6 7 0 | | 9 10 11 0 | | 13 14 15 1 |
It’s scary. It makes no sense. So let’s take it another way.
First, let’s think of a matrix as a combination of vectors. You know vectors, right? ...right? Alright, let’s take it from there.
The intuitive idea about vectors is that they’re a point in space. They’re not.
Vectors are lines in space... well almost. They’re lines without an origin; just a direction and a length.
For example, take this 3D vector here : V = [ 1 2 3 ] Don’t like him like that? It can also be expressed like this :
V = (1, 2, 3)
V = { 1, 2, 3 }
V = | 1 2 3 |
TV_3DVECTOR V = new TV_3DVECTOR(1, 2, 3)
The important part is that it’s called V, and has three components.
Three components... That’s fairly easy, it’s a 3D vector. One component for each dimension. Since the convention for Direct3D is X-Y-Z worlds where X is left-to-right, Y is bottom-to-top and Z is backward-to-forward, that means that V has a component of 1 for X, 2 for Y and 3 for Z.
That does not mean that its position in 3D space is (1, 2, 3). It has no position at all. Remember, a line without origin... a force in other words. A difference between two locations, wherever might those two locations be.
A good example vector would be a normal vector. A normal is the vector that pops out of a 3D triangle or a face and that is perpendicular to the surface of this triangle/face. It expresses the orientation of that face, and is used mainly for lighting and physics calculation. Since it only represents the orientation, its position is negligible.
We did mention vectors being a direction and a length. How would we fetch them from V?
Length of V : ||V||
||V|| = Sqrt(V.x² + V.y² + V.z²)
Direction of V : Normalized V
Normalized V = V / ||V||
= V / Sqrt(V.x² + V.y² + V.z²)
Hope this didn’t scare you too much.
V) if we know its separate components (x, y and z)... which we do. The length is then a single number.
1. This is the definition of a normalized vector; a vector whose length is 1. It can also be called a unit vector.
Once we know all of that terminology, we can start expressing matrices as vector arrays. Which is covered in part two, actually.