Commit b25609e3 authored by Isaak Lim's avatar Isaak Lim
Browse files

Added operator* for matrix * scalar multiplication, where each element of the...

Added operator* for matrix * scalar multiplication, where each element of the matrix is multiplied with the scalar.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@13072 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 12117b96
......@@ -171,6 +171,23 @@ operator*(const VectorT<T,4>& _v) const
//-----------------------------------------------------------------------------
template <typename Scalar>
Matrix4x4T<Scalar>
Matrix4x4T<Scalar>::operator*(const Scalar& scalar)
{
for (int i = 0; i < 4; ++i) {
for (int j = 0; j < 4; ++j) {
M(i,j) *= scalar;
}
}
return *this;
}
//-----------------------------------------------------------------------------
template <typename Scalar>
template <typename T>
VectorT<T,3>
......
......@@ -177,6 +177,9 @@ public:
/// self * _rhs
Matrix4x4T operator*(const Matrix4x4T<Scalar>& inst) const;
/// self * scalar
Matrix4x4T operator*(const Scalar& scalar);
/// self += _rhs
inline Matrix4x4T& operator+= ( const Matrix4x4T<Scalar>& _rhs) {
......@@ -209,7 +212,6 @@ public:
template <typename T>
inline VectorT<T,3> transform_vector(const VectorT<T,3>& _v) const;
/// sets all elements to zero
inline void clear();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment