本文整理汇总了C++中Matrix3::GetElem方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix3::GetElem方法的具体用法?C++ Matrix3::GetElem怎么用?C++ Matrix3::GetElem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix3
的用法示例。
在下文中一共展示了Matrix3::GetElem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void Matrix3::Add(const Matrix3& other, Matrix3* result) const
{
result->SetElem(0, m_Elems[0] + other.GetElem(0));
result->SetElem(1, m_Elems[1] + other.GetElem(1));
result->SetElem(2, m_Elems[2] + other.GetElem(2));
result->SetElem(3, m_Elems[3] + other.GetElem(3));
result->SetElem(4, m_Elems[4] + other.GetElem(4));
result->SetElem(5, m_Elems[5] + other.GetElem(5));
result->SetElem(6, m_Elems[6] + other.GetElem(6));
result->SetElem(7, m_Elems[7] + other.GetElem(7));
result->SetElem(8, m_Elems[8] + other.GetElem(8));
}
示例2: TransformInertiaTensor
void RigidBody::TransformInertiaTensor(Matrix3* iitWorld
, const Matrix3& iitBody
, const Matrix3& rotMat) const
{
/*
//I(t) = R(t) . I_body . R(t)^T
Matrix3 rotatedIit;
rotMat.Multiply(iitBody, &rotatedIit);
Matrix3 transRotMat;
rotMat.GetTranspose(&transRotMat);
rotatedIit.Multiply(transRotMat, iitWorld);
*/
//Generated using an optimising compiler
real t4 = (rotMat.GetElem(0)*iitBody.GetElem(0)) +
(rotMat.GetElem(1)*iitBody.GetElem(3)) +
(rotMat.GetElem(2)*iitBody.GetElem(6));
real t9 = (rotMat.GetElem(0)*iitBody.GetElem(1)) +
(rotMat.GetElem(1)*iitBody.GetElem(4)) +
(rotMat.GetElem(2)*iitBody.GetElem(7));
real t14 = (rotMat.GetElem(0)*iitBody.GetElem(2)) +
(rotMat.GetElem(1)*iitBody.GetElem(5)) +
(rotMat.GetElem(2)*iitBody.GetElem(8));
real t28 = (rotMat.GetElem(4)*iitBody.GetElem(0)) +
(rotMat.GetElem(5)*iitBody.GetElem(3)) +
(rotMat.GetElem(6)*iitBody.GetElem(6));
real t33 = (rotMat.GetElem(4)*iitBody.GetElem(1)) +
(rotMat.GetElem(5)*iitBody.GetElem(4)) +
(rotMat.GetElem(6)*iitBody.GetElem(7));
real t38 = (rotMat.GetElem(4)*iitBody.GetElem(2)) +
(rotMat.GetElem(5)*iitBody.GetElem(5)) +
(rotMat.GetElem(6)*iitBody.GetElem(8));
real t52 = (rotMat.GetElem(8)*iitBody.GetElem(0)) +
(rotMat.GetElem(9)*iitBody.GetElem(3)) +
(rotMat.GetElem(10)*iitBody.GetElem(6));
real t57 = (rotMat.GetElem(8)*iitBody.GetElem(1)) +
(rotMat.GetElem(9)*iitBody.GetElem(4)) +
(rotMat.GetElem(10)*iitBody.GetElem(7));
real t62 = (rotMat.GetElem(8)*iitBody.GetElem(2)) +
(rotMat.GetElem(9)*iitBody.GetElem(5)) +
(rotMat.GetElem(10)*iitBody.GetElem(8));
iitWorld->SetElem(0, (t4*rotMat.GetElem(0)) +
(t9*rotMat.GetElem(1)) +
(t14*rotMat.GetElem(2)));
iitWorld->SetElem(1, (t4*rotMat.GetElem(4)) +
(t9*rotMat.GetElem(5)) +
(t14*rotMat.GetElem(6)));
iitWorld->SetElem(2, (t4*rotMat.GetElem(8)) +
(t9*rotMat.GetElem(9)) +
(t14*rotMat.GetElem(10)));
iitWorld->SetElem(3, (t28*rotMat.GetElem(0)) +
(t33*rotMat.GetElem(1)) +
(t38*rotMat.GetElem(2)));
iitWorld->SetElem(4, (t28*rotMat.GetElem(4)) +
(t33*rotMat.GetElem(5)) +
(t38*rotMat.GetElem(6)));
iitWorld->SetElem(5, (t28*rotMat.GetElem(8)) +
(t33*rotMat.GetElem(9)) +
(t38*rotMat.GetElem(10)));
iitWorld->SetElem(6, (t52*rotMat.GetElem(0)) +
(t57*rotMat.GetElem(1)) +
(t62*rotMat.GetElem(2)));
iitWorld->SetElem(7, (t52*rotMat.GetElem(4)) +
(t57*rotMat.GetElem(5)) +
(t62*rotMat.GetElem(6)));
iitWorld->SetElem(8, (t52*rotMat.GetElem(8)) +
(t57*rotMat.GetElem(9)) +
(t62*rotMat.GetElem(10)));
}