diff options
Diffstat (limited to 'intern/moto/include')
-rw-r--r-- | intern/moto/include/MT_Matrix3x3.h | 7 | ||||
-rw-r--r-- | intern/moto/include/MT_Vector3.h | 2 | ||||
-rw-r--r-- | intern/moto/include/MT_Vector3.inl | 7 |
3 files changed, 15 insertions, 1 deletions
diff --git a/intern/moto/include/MT_Matrix3x3.h b/intern/moto/include/MT_Matrix3x3.h index 6d709fae662..17dd5335217 100644 --- a/intern/moto/include/MT_Matrix3x3.h +++ b/intern/moto/include/MT_Matrix3x3.h @@ -84,11 +84,18 @@ public: MT_Vector3 getColumn(int i) const { return MT_Vector3(m_el[0][i], m_el[1][i], m_el[2][i]); } + void setColumn(int i, const MT_Vector3& v) { m_el[0][i] = v[0]; m_el[1][i] = v[1]; m_el[2][i] = v[2]; } + + void setRow(int i, const MT_Vector3& v) { + m_el[i][0] = v[0]; + m_el[i][1] = v[1]; + m_el[i][2] = v[2]; + } void setValue(const float *m) { m_el[0][0] = *m++; m_el[1][0] = *m++; m_el[2][0] = *m++; m++; diff --git a/intern/moto/include/MT_Vector3.h b/intern/moto/include/MT_Vector3.h index 83c53a19d66..b06f345bdaf 100644 --- a/intern/moto/include/MT_Vector3.h +++ b/intern/moto/include/MT_Vector3.h @@ -75,7 +75,7 @@ public: void normalize(); MT_Vector3 normalized() const; MT_Vector3 safe_normalized() const; - + MT_Vector3 safe_normalized_vec(MT_Vector3 vecnormalized) const; void scale(MT_Scalar x, MT_Scalar y, MT_Scalar z); MT_Vector3 scaled(MT_Scalar x, MT_Scalar y, MT_Scalar z) const; diff --git a/intern/moto/include/MT_Vector3.inl b/intern/moto/include/MT_Vector3.inl index b17ef47c709..09c92c6ab54 100644 --- a/intern/moto/include/MT_Vector3.inl +++ b/intern/moto/include/MT_Vector3.inl @@ -77,6 +77,13 @@ GEN_INLINE MT_Vector3 MT_Vector3::safe_normalized() const { *this / len; } +GEN_INLINE MT_Vector3 MT_Vector3::safe_normalized_vec(MT_Vector3 vecnormalized) const { + MT_Scalar len = length(); + return MT_fuzzyZero(len) ? + vecnormalized : + *this / len; +} + GEN_INLINE void MT_Vector3::scale(MT_Scalar xx, MT_Scalar yy, MT_Scalar zz) { m_co[0] *= xx; m_co[1] *= yy; m_co[2] *= zz; } |