matrix scalar pre multiplication and general scalar multiplication for

quaternions
This commit is contained in:
Thomas Gubler
2015-12-26 13:15:39 +01:00
parent 99ac532746
commit 45e6012818
3 changed files with 31 additions and 0 deletions
+6
View File
@@ -417,6 +417,12 @@ Matrix<Type, M, N> ones() {
return m;
}
template<typename Type, size_t M, size_t N>
Matrix<Type, M, N> operator*(Type scalar, const Matrix<Type, M, N> &other)
{
return other * scalar;
}
#if defined(SUPPORT_STDIOSTREAM)
template<typename Type, size_t M, size_t N>
std::ostream& operator<<(std::ostream& os,
+12
View File
@@ -104,6 +104,18 @@ public:
self = self * other;
}
Quaternion operator*(Type scalar) const
{
const Quaternion &q = *this;
return scalar * q;
}
void operator*=(Type scalar)
{
Quaternion &q = *this;
q = q * scalar;
}
Matrix41 derivative(const Matrix31 & w) const {
const Quaternion &q = *this;
Type dataQ[] = {