當前位置: 首頁>>代碼示例>>C#>>正文


C# Matrix3x2.Determinant方法代碼示例

本文整理匯總了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);
        }
開發者ID:sleepless1,項目名稱:GameSharp,代碼行數:21,代碼來源:MathHelper.cs

示例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);
        }
開發者ID:CSharpDev,項目名稱:SharpDX,代碼行數:27,代碼來源:Matrix3x2.cs

示例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);
        }
開發者ID:modulexcite,項目名稱:Avalonia,代碼行數:24,代碼來源:Direct2D1DrawingContext.cs


注:本文中的SharpDX.Matrix3x2.Determinant方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。