Math/Matrix4: Add GetSquaredScale() method
Former-commit-id: c1ce74560b735dbcd5a4c377a7577a9d2c1bae09
This commit is contained in:
parent
6f06383ab0
commit
b0f418c481
|
|
@ -49,6 +49,7 @@ class NzMatrix4
|
|||
//NzMatrix3 GetRotationMatrix() const;
|
||||
NzVector4<T> GetRow(unsigned int row) const;
|
||||
NzVector3<T> GetScale() const;
|
||||
NzVector3<T> GetSquaredScale() const;
|
||||
NzVector3<T> GetTranslation() const;
|
||||
void GetTransposed(NzMatrix4* dest) const;
|
||||
|
||||
|
|
|
|||
|
|
@ -485,9 +485,16 @@ NzVector4<T> NzMatrix4<T>::GetRow(unsigned int row) const
|
|||
template<typename T>
|
||||
NzVector3<T> NzMatrix4<T>::GetScale() const
|
||||
{
|
||||
return NzVector3<T>(std::sqrt(m11*m11 + m21*m21 + m31*m31),
|
||||
std::sqrt(m12*m12 + m22*m22 + m32*m32),
|
||||
std::sqrt(m13*m13 + m23*m23 + m33*m33));
|
||||
NzVector3<T> squaredScale = GetSquaredScale();
|
||||
return NzVector3<T>(std::sqrt(squaredScale.x), std::sqrt(squaredScale.y), std::sqrt(squaredScale.z));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzVector3<T> NzMatrix4<T>::GetSquaredScale() const
|
||||
{
|
||||
return NzVector3<T>(m11*m11 + m21*m21 + m31*m31,
|
||||
m12*m12 + m22*m22 + m32*m32,
|
||||
m13*m13 + m23*m23 + m33*m33);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
|
|
|||
Loading…
Reference in New Issue