vecmat3 addouter()

This commit is contained in:
Jiri Pittner 2024-01-18 13:54:21 +01:00
parent ae83e43b4e
commit e75248eb23
2 changed files with 18 additions and 0 deletions

View File

@ -69,6 +69,23 @@ m[2][2]=q[2]*rhs.q[2];
return m;
}
template<typename T>
void Vec3<T>::addouter(Mat3<T> &m, const Vec3<T> &rhs, const T weight) const
{
m[0][0]+=weight* q[0]*rhs.q[0];
m[0][1]+=weight* q[0]*rhs.q[1];
m[0][2]+=weight* q[0]*rhs.q[2];
m[1][0]+=weight* q[1]*rhs.q[0];
m[1][1]+=weight* q[1]*rhs.q[1];
m[1][2]+=weight* q[1]*rhs.q[2];
m[2][0]+=weight* q[2]*rhs.q[0];
m[2][1]+=weight* q[2]*rhs.q[1];
m[2][2]+=weight* q[2]*rhs.q[2];
}
template<typename T>
void Vec3<T>::inertia(Mat3<T> &m, const T weight) const

View File

@ -96,6 +96,7 @@ public:
const Vec3 operator*(const Mat3<T> &rhs) const;
const Vec3 timesT(const Mat3<T> &rhs) const; //with transpose
Mat3<T> outer(const Vec3 &rhs) const; //tensor product
void addouter(Mat3<T> &m, const Vec3 &rhs, const T weight) const; //tensor product
void inertia(Mat3<T> &itensor, const T weight) const; //contribution to inertia tensor
void randomize(const T x);