Game Development Reference
In-Depth Information
e12 += m.e12;
e13 += m.e13;
e21 += m.e21;
e22 += m.e22;
e23 += m.e23;
e31 += m.e31;
e32 += m.e32;
e33 += m.e33;
return *this;
}
Matrix addition (and subtraction) is commutative, associative, and distributive; thus:
M + N = N + M
M + ( N + P ) = ( M + N ) + P
M ( N + P ) = M N + M P
( N + P ) M = N M + P M
Matrix Subtraction: The −= Operator
This operator simply subtracts the passed matrix from the current one on an element-
by-element basis. For two matrices to be subtracted, they must be of the same order
that is, they must have the same number of rows and columns:
inline Matrix3x3& Matrix3x3::operator-=(Matrix3x3 m)
{
e11 -= m.e11;
e12 -= m.e12;
e13 -= m.e13;
e21 -= m.e21;
e22 -= m.e22;
e23 -= m.e23;
e31 -= m.e31;
e32 -= m.e32;
e33 -= m.e33;
return *this;
}
Scalar Multiplication: The *= Operator
This operator simply multiplies each element by the scalar s :
inline Matrix3x3& Matrix3x3::operator*=(float s)
{
e11 *= s;
e12 *= s;
e13 *= s;
e21 *= s;
e22 *= s;
e23 *= s;
e31 *= s;
Search Nedrilad ::




Custom Search