本文整理汇总了C#中SharpDX.Matrix3x2.Determinant方法的典型用法代码示例。如果您正苦于以下问题:C# Matrix3x2.Determinant方法的具体用法?C# Matrix3x2.Determinant怎么用?C# Matrix3x2.Determinant使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharpDX.Matrix3x2
的用法示例。
在下文中一共展示了Matrix3x2.Determinant方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Invert
public static void Invert(ref Matrix3x2 matrix, out Matrix3x2 result)
{
float determinant = matrix.Determinant();
if (MathUtil.WithinEpsilon(determinant, 0.0f)) {
result = Matrix3x2.Identity;
return;
}
float invdet = 1.0f / determinant;
float _offsetX = matrix.M31;
float _offsetY = matrix.M32;
result = new Matrix3x2(
matrix.M22 * invdet,
-matrix.M12 * invdet,
-matrix.M21 * invdet,
matrix.M11 * invdet,
(matrix.M21 * _offsetY - _offsetX * matrix.M22) * invdet,
(_offsetX * matrix.M12 - matrix.M11 * _offsetY) * invdet);
}
示例2: Invert
/// <summary>
/// Calculates the inverse of the specified matrix.
/// </summary>
/// <param name="value">The matrix whose inverse is to be calculated.</param>
/// <param name="result">When the method completes, contains the inverse of the specified matrix.</param>
public static void Invert(ref Matrix3x2 value, out Matrix3x2 result)
{
float determinant = value.Determinant();
if (MathUtil.WithinEpsilon(determinant, 0.0f))
{
result = Identity;
return;
}
float invdet = 1.0f / determinant;
float _offsetX = value.M31;
float _offsetY = value.M32;
result = new Matrix3x2(
value.M22 * invdet,
-value.M12 * invdet,
-value.M21 * invdet,
value.M11 * invdet,
(value.M21 * _offsetY - _offsetX * value.M22) * invdet,
(_offsetX * value.M12 - value.M11 * _offsetY) * invdet);
}
示例3: Invert
// This should be added to SharpDX.
private static Matrix3x2 Invert(Matrix3x2 value)
{
Matrix3x2 result = Matrix3x2.Identity;
float determinant = value.Determinant();
if (determinant == 0.0f)
{
return value;
}
float invdet = 1.0f / determinant;
float offsetX = value.M31;
float offsetY = value.M32;
return new Matrix3x2(
value.M22 * invdet,
-value.M12 * invdet,
-value.M21 * invdet,
value.M11 * invdet,
((value.M21 * offsetY) - (offsetX * value.M22)) * invdet,
((offsetX * value.M12) - (value.M11 * offsetY)) * invdet);
}