Пример #1
0
        /// <summary>
        /// Calculates the inverse matrix using Householder transformations
        /// </summary>
        public static M22d QrInverse(this M22d mat)
        {
            var qr   = new Matrix <double>((double[])mat, 2, 2);
            var diag = qr.QrFactorize();

            return((M22d)(qr.QrInverse(diag).Data));
        }
Пример #2
0
        /// <summary>
        /// Multiplacation of a <see cref="Scale3d"/> with a <see cref="M22d"/>.
        /// </summary>
        public static M33d Multiply(Scale3d scale, M22d mat)
        {
            return(new M33d(scale.X * mat.M00,
                            scale.X * mat.M01,
                            0,

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

                            0,
                            0,
                            scale.Z));
        }
Пример #3
0
        //WARNING: untested

        public static Rot2d FromM22d(M22d m)
        {
            // cos(a) sin(a)
            //-sin(a) cos(a)

            if (m.M00 >= -1.0 && m.M00 <= 1.0)
            {
                return(new Rot2d((double)System.Math.Acos(m.M00)));
            }
            else
            {
                throw new ArgumentException("Given M22d is not a Rotation-Matrix");
            }
        }
Пример #4
0
        /// <summary>
        /// </summary>
        public static M33d operator *(Euclidean3d r3, Rot2d r2)
        {
            M33d m33 = (M33d)r3;
            M22d m22 = (M22d)r2;

            return(new M33d(
                       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>
 /// Returns new array containing transformed points.
 /// </summary>
 public static V2d[] Transformed(this V2d[] pointArray, M22d m)
 {
     return(new V2d[pointArray.LongLength].SetByIndexLong(i => m.Transform(pointArray[i])));
 }
Пример #6
0
 public static M23d Multiply(M22d m, Euclidean2d r)
 {
     return(M23d.Multiply(m, (M23d)r));
 }
Пример #7
0
 /// <summary>
 /// Creates a rigid transformation from a rotation matrix <paramref name="rot"/> and a (subsequent) translation <paramref name="trans"/>.
 /// </summary>
 public Euclidean2d(M22d rot, V2d trans)
 {
     Rot   = Rot2d.FromM22d(rot);
     Trans = trans;
 }
Пример #8
0
 public static M22d Multiply(Rot2d rot, M22d mat)
 {
     return((M22d)rot * mat);
 }