outer product and intertia tensor in vecmat3

This commit is contained in:
2022-10-28 16:14:13 +02:00
parent 43e53b0bbc
commit 31c45d44ec
2 changed files with 47 additions and 0 deletions

View File

@@ -86,6 +86,9 @@ public:
Vec3& normalize(void) {*this /= norm(); return *this;};
Vec3& fast_normalize(void);
const Vec3 operator*(const Mat3<T> &rhs) const;
Mat3<T> outer(const Vec3 &rhs) const; //tensor product
void inertia(Mat3<T> &itensor, const T weight) const; //contribution to inertia tensor
//C-style IO
int fprintf(FILE *f, const char *format) const {return ::fprintf(f,format,q[0],q[1],q[2]);};
int sprintf(char *f, const char *format) const {return ::sprintf(f,format,q[0],q[1],q[2]);};
@@ -94,6 +97,10 @@ public:
};
template <typename T>
inline T hypot3(const Vec3<T> &c, const Vec3<T> &d) {return((c-d).norm());}
template <typename T>
class Mat3
{