More CTransform affine operators

This commit is contained in:
Jack Andersen 2016-02-15 19:49:52 -10:00
parent bd88f654a9
commit 876a6030bb
1 changed files with 16 additions and 0 deletions

View File

@ -43,12 +43,28 @@ public:
static inline CTransform Translate(float x, float y, float z) { return Translate({x, y, z}); } static inline CTransform Translate(float x, float y, float z) { return Translate({x, y, z}); }
inline CTransform operator+(const CVector3f& other)
{
return CTransform(m_basis, m_origin + other);
}
inline CTransform& operator+=(const CVector3f& other) inline CTransform& operator+=(const CVector3f& other)
{ {
m_origin += other; m_origin += other;
return *this; return *this;
} }
inline CTransform operator-(const CVector3f& other)
{
return CTransform(m_basis, m_origin - other);
}
inline CTransform& operator-=(const CVector3f& other)
{
m_origin -= other;
return *this;
}
inline void rotate(const CVector3f& euler) { *this = *this * CMatrix3f(CQuaternion(euler)); } inline void rotate(const CVector3f& euler) { *this = *this * CMatrix3f(CQuaternion(euler)); }
static inline CTransform RotateX(float theta) static inline CTransform RotateX(float theta)