本文整理汇总了C++中Matrix3f::Determinant方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix3f::Determinant方法的具体用法?C++ Matrix3f::Determinant怎么用?C++ Matrix3f::Determinant使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix3f
的用法示例。
在下文中一共展示了Matrix3f::Determinant方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AffineTransform
//----------------------------------------------------------------------------
void AffineTransform (int warmups, Ellipsoid3f& ellipsoid0,
Ellipsoid3f& ellipsoid1)
{
float random = 0.0f;
for (int i = 0; i < warmups; ++i)
{
random = Mathf::SymmetricRandom();
}
Matrix3f A;
Vector3f B;
for (int row = 0; row < 3; ++row)
{
for (int col = 0; col < 3; ++col)
{
A[row][col] = Mathf::SymmetricRandom();
}
B[row] = Mathf::SymmetricRandom();
}
if (A.Determinant() < 0.0f)
{
A[0][0] = -A[0][0];
A[0][1] = -A[0][1];
A[0][2] = -A[0][2];
}
Matrix3f invA = A.Inverse();
Vector3f K = invA*(ellipsoid0.Center - B);
Matrix3f D(
1.0f/(ellipsoid0.Extent[0]*ellipsoid0.Extent[0]),
1.0f/(ellipsoid0.Extent[1]*ellipsoid0.Extent[1]),
1.0f/(ellipsoid0.Extent[2]*ellipsoid0.Extent[2]));
Matrix3f N = A.TransposeTimes(D)*A;
Matrix3f R;
N.EigenDecomposition(R, D);
ellipsoid0.Center = K;
ellipsoid0.Axis[0] = R.GetColumn(0);
ellipsoid0.Axis[1] = R.GetColumn(1);
ellipsoid0.Axis[2] = R.GetColumn(2);
ellipsoid0.Extent[0] = Mathf::InvSqrt(D[0][0]);
ellipsoid0.Extent[1] = Mathf::InvSqrt(D[1][1]);
ellipsoid0.Extent[2] = Mathf::InvSqrt(D[2][2]);
K = invA*(ellipsoid1.Center - B);
D = Matrix3f(
1.0f/(ellipsoid1.Extent[0]*ellipsoid1.Extent[0]),
1.0f/(ellipsoid1.Extent[1]*ellipsoid1.Extent[1]),
1.0f/(ellipsoid1.Extent[1]*ellipsoid1.Extent[1]));
N = A.TransposeTimes(D)*A;
N.EigenDecomposition(R, D);
ellipsoid1.Center = K;
ellipsoid1.Axis[0] = R.GetColumn(0);
ellipsoid1.Axis[1] = R.GetColumn(1);
ellipsoid1.Axis[2] = R.GetColumn(2);
ellipsoid1.Extent[0] = Mathf::InvSqrt(D[0][0]);
ellipsoid1.Extent[1] = Mathf::InvSqrt(D[1][1]);
ellipsoid1.Extent[2] = Mathf::InvSqrt(D[2][2]);
}