Game Development Reference
In-Depth Information
All matrix identities are square. Here are the identities for a 3
3 matrix and a
4 4 matrix.
2
3
2
3
1000
0100
0010
0001
100
010
001
4
5
4
5
When creating a matrix operation, the identity is the perfect starting place. It
doesn't do anything to the vertices it's applied to so only the changes you apply
on top of the identity will be performed. If a matrix of all zeros was applied to any
model, then that model would disappear; all its vertices would be collapsed down
to a singularity like a black hole. The matrix class should by default be initialized
to the identity matrix.
Add these definitions to your matrix class.
public static readonly Matrix Identity =
new Matrix(new Vector(1, 0, 0),
new Vector(0, 1, 0),
new Vector(0, 0, 1),
new Vector(0, 0, 1));
public Matrix() : this (Identity)
{
}
public Matrix(Matrix m)
{
_m11 = m._m11;
_m12 = m._m12;
_m13 = m._m13;
_m21 = m._m21;
_m22 = m._m22;
_m23 = m._m23;
_m31 = m._m31;
_m32 = m._m32;
_m33 = m._m33;
_m41 = m._m41;
Search WWH ::




Custom Search