Пример #1
0
void HrTransform::DecomposeWorldOriention(const Quaternion& orientation)
{
	m_worldOriention = HrMath::Normalize(orientation);

	Matrix4 matOrientation = HrMath::ToMatrix(m_worldOriention);

	Vector4 vRight = matOrientation.Row(0);
	m_vWorldRight = Vector3(vRight.x(), vRight.y(), vRight.z());

	Vector4 vUp = matOrientation.Row(1);
	m_vWorldUp = Vector3(vUp.x(), vUp.y(), vUp.z());

	Vector4 vForward = matOrientation.Row(2);
	m_vWorldForward = Vector3(vForward.x(), vForward.y(), vForward.z());
}
Пример #2
0
float Matrix4::Determinant() const
{
    // The determinant is the dot product of:
	// the first row and the first row of cofactors
	// which is the first col of the adjoint matrix
	Matrix4 cofactor;
	Cofactor( &cofactor );
	Vector3F rowOfCofactor, rowOfThis;
	cofactor.Row( 0, &rowOfCofactor );
	Row( 0, &rowOfThis );
	return DotProduct( rowOfCofactor, rowOfThis );
}