本文整理汇总了C#中Matrix3x2.GetDeterminant方法的典型用法代码示例。如果您正苦于以下问题:C# Matrix3x2.GetDeterminant方法的具体用法?C# Matrix3x2.GetDeterminant怎么用?C# Matrix3x2.GetDeterminant使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix3x2
的用法示例。
在下文中一共展示了Matrix3x2.GetDeterminant方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Matrix3x2DeterminantTest1
public void Matrix3x2DeterminantTest1()
{
Matrix3x2 a = new Matrix3x2();
a.M11 = 5.0f; a.M12 = 2.0f;
a.M21 = 12.0f; a.M22 = 6.8f;
a.M31 = 6.5f; a.M32 = 1.0f;
Matrix3x2 i;
Assert.IsTrue(Matrix3x2.Invert(a, out i));
float detA = a.GetDeterminant();
float detI = i.GetDeterminant();
float t = 1.0f / detI;
// only accurate to 3 precision
Assert.IsTrue(System.Math.Abs(detA - t) < 1e-3, "Matrix3x2.GetDeterminant was not set correctly.");
// sanity check against 4x4 version
Assert.AreEqual(new Matrix4x4(a).GetDeterminant(), detA);
Assert.AreEqual(new Matrix4x4(i).GetDeterminant(), detI);
}
示例2: Matrix3x2InvertTest1
public void Matrix3x2InvertTest1()
{
Matrix3x2 a = new Matrix3x2();
a.M11 = 0.0f;
a.M12 = 2.0f;
a.M21 = 0.0f;
a.M22 = 4.0f;
a.M31 = 5.0f;
a.M32 = 6.0f;
float detA = a.GetDeterminant();
Assert.True(MathHelper.Equal(detA, 0.0f), "Matrix3x2.Invert did not return the expected value.");
Matrix3x2 actual;
Assert.False(Matrix3x2.Invert(a, out actual));
// all the elements in Actual is NaN
Assert.True(
float.IsNaN(actual.M11) && float.IsNaN(actual.M12) &&
float.IsNaN(actual.M21) && float.IsNaN(actual.M22) &&
float.IsNaN(actual.M31) && float.IsNaN(actual.M32)
, "Matrix3x2.Invert did not return the expected value.");
}