本文整理汇总了C#中BEPUutilities.Matrix3x3.Determinant方法的典型用法代码示例。如果您正苦于以下问题:C# Matrix3x3.Determinant方法的具体用法?C# Matrix3x3.Determinant怎么用?C# Matrix3x3.Determinant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BEPUutilities.Matrix3x3
的用法示例。
在下文中一共展示了Matrix3x3.Determinant方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Invert
/// <summary>
/// Inverts the given matix.
/// </summary>
/// <param name="matrix">Matrix to be inverted.</param>
/// <param name="result">Inverted matrix.</param>
public static void Invert(ref Matrix3x3 matrix, out Matrix3x3 result)
{
float determinantInverse = 1 / matrix.Determinant();
float m11 = (matrix.M22 * matrix.M33 - matrix.M23 * matrix.M32) * determinantInverse;
float m12 = (matrix.M13 * matrix.M32 - matrix.M33 * matrix.M12) * determinantInverse;
float m13 = (matrix.M12 * matrix.M23 - matrix.M22 * matrix.M13) * determinantInverse;
float m21 = (matrix.M23 * matrix.M31 - matrix.M21 * matrix.M33) * determinantInverse;
float m22 = (matrix.M11 * matrix.M33 - matrix.M13 * matrix.M31) * determinantInverse;
float m23 = (matrix.M13 * matrix.M21 - matrix.M11 * matrix.M23) * determinantInverse;
float m31 = (matrix.M21 * matrix.M32 - matrix.M22 * matrix.M31) * determinantInverse;
float m32 = (matrix.M12 * matrix.M31 - matrix.M11 * matrix.M32) * determinantInverse;
float m33 = (matrix.M11 * matrix.M22 - matrix.M12 * matrix.M21) * determinantInverse;
result.M11 = m11;
result.M12 = m12;
result.M13 = m13;
result.M21 = m21;
result.M22 = m22;
result.M23 = m23;
result.M31 = m31;
result.M32 = m32;
result.M33 = m33;
}
示例2: Invert
/// <summary>
/// Inverts the given matix.
/// </summary>
/// <param name="matrix">Matrix to be inverted.</param>
/// <param name="result">Inverted matrix.</param>
public static void Invert(ref Matrix3x3 matrix, out Matrix3x3 result)
{
float determinantInverse = 1 / matrix.Determinant();
float m11 = (matrix.M2.Y * matrix.M3.Z - matrix.M2.Z * matrix.M3.Y) * determinantInverse;
float m12 = (matrix.M1.Z * matrix.M3.Y - matrix.M3.Z * matrix.M1.Y) * determinantInverse;
float m13 = (matrix.M1.Y * matrix.M2.Z - matrix.M2.Y * matrix.M1.Z) * determinantInverse;
float m21 = (matrix.M2.Z * matrix.M3.X - matrix.M2.X * matrix.M3.Z) * determinantInverse;
float m22 = (matrix.M1.X * matrix.M3.Z - matrix.M1.Z * matrix.M3.X) * determinantInverse;
float m23 = (matrix.M1.Z * matrix.M2.X - matrix.M1.X * matrix.M2.Z) * determinantInverse;
float m31 = (matrix.M2.X * matrix.M3.Y - matrix.M2.Y * matrix.M3.X) * determinantInverse;
float m32 = (matrix.M1.Y * matrix.M3.X - matrix.M1.X * matrix.M3.Y) * determinantInverse;
float m33 = (matrix.M1.X * matrix.M2.Y - matrix.M1.Y * matrix.M2.X) * determinantInverse;
result.M1.X = m11;
result.M1.Y = m12;
result.M1.Z = m13;
result.M2.X = m21;
result.M2.Y = m22;
result.M2.Z = m23;
result.M3.X = m31;
result.M3.Y = m32;
result.M3.Z = m33;
}