本文整理汇总了C++中Matrix3f::det方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix3f::det方法的具体用法?C++ Matrix3f::det怎么用?C++ Matrix3f::det使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix3f
的用法示例。
在下文中一共展示了Matrix3f::det方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: matrix
void Physics_testTest::testCase1()
{
Matrix3f matrix(Matrix3f::kZero);
Matrix3f identity(Matrix3f::kIdentity);
Matrix3f sum(identity + identity);
Matrix3f sum2 = identity * 2.0f;
QVERIFY2(sum2 - sum == Matrix3f::kZero, "Sum" );
QVERIFY2(sum2.det() == 8.0f, "Det");
Matrix3f inverse = sum2.inverse();
QVERIFY2(inverse.det() - (1.0f/8.0f) < 0.01f, "Inverse");
QVERIFY2(inverse*sum2 == Matrix3f::kIdentity, "Inverse2");
Matrix3f rotX = Matrix3f::RotationX(0.1);
Matrix3f rotY = Matrix3f::RotationY(0.5);
Matrix3f rotZ = Matrix3f::RotationZ(2.0);
Matrix3f total = rotX * rotY * rotZ;
QVERIFY2(fabs(((total * total.inverse()) - Matrix3f::kIdentity).det()) < 0.00000001f, "Complex");
Vector3f y_up = Vector3f(0.0f, 1.0f, 0.0f);
Vector3f x_right = Vector3f(1.0f, 0.0f, 0.0f);
Vector3f imageY = rotX * y_up;
QVERIFY2(fabs(imageY.dot(y_up) - cosf(0.1f)) < 0.00001, "Rotation");
Matrix3f rot_axis = Matrix3f::FromAxisAngle(y_up, 0.5);
Vector3f imageX = rot_axis * y_up;
QVERIFY2(fabs(imageX.dot(y_up) - y_up.lengthSquared()) < 0.00001, "Axis Angle");
imageX = rot_axis * x_right;
QVERIFY2(fabs(imageX.dot(x_right) - cosf(0.5)) < 0.00001, "Axis Angle");
//Matrix3f identity = Matrix3f::kIdentity;
QVERIFY2(true, "Failure");
}
示例2: testDeterminant
void testDeterminant()
{
Matrix3f rab = ma * mb;
CPPUNIT_ASSERT(rab.det() == -684);
}