当前位置: 首页>>代码示例>>C#>>正文


C# Matrix3x3.Determinant方法代码示例

本文整理汇总了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;
        }
开发者ID:Indiefreaks,项目名称:igf,代码行数:32,代码来源:Matrix3x3.cs

示例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;
        }
开发者ID:d3x0r,项目名称:Voxelarium,代码行数:32,代码来源:Matrix3x3.cs


注:本文中的BEPUutilities.Matrix3x3.Determinant方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。