Пример #1
0
        /// <summary>
        /// Transforms a <see cref="M34f"/> to a <see cref="M33f"/> by deleting the
        /// specified row and column. Internally the <see cref="M34f"/> is tarnsformed
        /// to a <see cref="M44f"/> to delete the row and column.
        /// </summary>
        /// <param name="deleted_row">Row to delete.</param>
        /// <param name="deleted_column">Column to delete.</param>
        /// <returns>A <see cref="M33f"/>.</returns>
        public M33f Minor(int deleted_row, int deleted_column)
        {
            M44f temp = (M44f)this;

            M33f result      = new M33f();
            int  checked_row = 0;

            for (int actual_row = 0; actual_row < 4; actual_row++)
            {
                int checked_column = 0;

                if (actual_row != deleted_row)
                {
                    for (int actual_column = 0; actual_column < 4; actual_column++)
                    {
                        if (actual_column != deleted_column)
                        {
                            result[checked_row, checked_column] = temp[actual_row, actual_column];
                            checked_column++;
                        }
                    }
                    checked_row++;
                }
            }

            return(result);
        }
Пример #2
0
        public static M33f Multiply(Rot2f rot, M33f mat)
        {
            float a = (float)System.Math.Cos(rot.Angle);
            float b = (float)System.Math.Sin(rot.Angle);

            return(new M33f(a * mat.M00 +
                            b * mat.M10,

                            a * mat.M01 +
                            b * mat.M11,

                            a * mat.M02 +
                            b * mat.M12,

                            -b * mat.M00 +
                            a * mat.M10,

                            -b * mat.M01 +
                            a * mat.M11,

                            -b * mat.M02 +
                            a * mat.M12,

                            mat.M20,

                            mat.M21,

                            mat.M22));
        }
Пример #3
0
        /// <summary>
        /// Multiplacation of a <see cref="Scale3f"/> with a <see cref="M33f"/>.
        /// </summary>
        public static M33f Multiply(Scale3f scale, M33f mat)
        {
            return(new M33f(scale.X * mat.M00,
                            scale.X * mat.M01,
                            scale.X * mat.M02,

                            scale.Y * mat.M10,
                            scale.Y * mat.M11,
                            scale.Y * mat.M12,

                            scale.Z * mat.M20,
                            scale.Z * mat.M21,
                            scale.Z * mat.M22));
        }
Пример #4
0
        /// <summary>
        /// </summary>
        public static M33f operator *(Euclidean3f r3, Rot2f r2)
        {
            M33f m33 = (M33f)r3;
            M22f m22 = (M22f)r2;

            return(new M33f(
                       m33.M00 * m22.M00 + m33.M01 * m22.M10,
                       m33.M00 * m22.M01 + m33.M01 * m22.M11,
                       m33.M02,

                       m33.M10 * m22.M00 + m33.M11 * m22.M10,
                       m33.M10 * m22.M01 + m33.M11 * m22.M11,
                       m33.M12,

                       m33.M20 * m22.M00 + m33.M21 * m22.M10,
                       m33.M20 * m22.M01 + m33.M21 * m22.M11,
                       m33.M22
                       ));
        }
Пример #5
0
        /// <summary>
        /// A <see cref="M44f"/> is transformed to <see cref="M33f"/> by deleting specified row and column
        /// </summary>

        public M33f Minor(int rowToDelete, int columnToDelete)
        {
            M33f result      = new M33f();
            int  checked_row = 0;

            for (int actual_row = 0; actual_row < 4; actual_row++)
            {
                int checked_column = 0;

                if (actual_row != rowToDelete)
                {
                    for (int actual_column = 0; actual_column < 4; actual_column++)
                    {
                        if (actual_column != columnToDelete)
                        {
                            result[checked_row, checked_column] = this[actual_row, actual_column];
                            checked_column++;
                        }
                    }
                    checked_row++;
                }
            }
            return(result);
        }
Пример #6
0
 /// <summary>
 /// Creates a rigid transformation from a rotation matrix <paramref name="rot"/> and a (subsequent) translation <paramref name="trans"/>.
 /// </summary>
 public Euclidean3f(M33f rot, V3f trans, float epsilon = 1e-5f)
 {
     Rot   = Rot3f.FromM33f(rot, epsilon);
     Trans = trans;
 }
Пример #7
0
 public static M34f Multiply(M33f m, Euclidean3f r)
 {
     return(M34f.Multiply(m, (M34f)r));
 }