Beispiel #1
0
        public static void Decompose(Matrix2 m, out float scaleX, out float scaleY, out float shearXY,
                                     out float rot)
        {
            Matrix2 mtx = m;

            scaleX = Point.Length(mtx[0]) * Matrix2.Sign(mtx[0][0]);
            mtx[0] = mtx[0] / scaleX;

            shearXY = Point.Dot(mtx[0], mtx[1]);
            mtx[1] -= mtx[0] * shearXY;

            scaleY = Point.Length(mtx[1]) * Matrix2.Sign(mtx[1][1]);
            mtx[1] = mtx[1] / scaleY;

            shearXY /= scaleY;

            rot = (float)Math.Atan2(-mtx[1][0], mtx[1][1]);
        }
Beispiel #2
0
 public void SetUpper2x2(Matrix2 m)
 {
     this[0] = m[0];
     this[1] = m[1];
 }
Beispiel #3
0
 public static Matrix2 PreScale(float scaleX, float scaleY, Matrix2 m)
 {
     return(new Matrix2(m[0][0] * scaleX, m[0][1] * scaleX, m[1][0] * scaleY, m[1][1] * scaleY));
 }
Beispiel #4
0
 public static Matrix2 PostScale(Matrix2 m, float scaleX, float scaleY)
 {
     return(new Matrix2(m[0][0] * scaleX, m[0][1] * scaleY, m[1][0] * scaleX, m[1][1] * scaleY));
 }
Beispiel #5
0
 public static Matrix2 Inverse(Matrix2 m, float determinant)
 {
     return(new Matrix2(m[1][1], -m[0][1], -m[1][0], m[0][0]) / determinant);
 }
Beispiel #6
0
 public static Matrix2 Inverse(Matrix2 m)
 {
     return(Inverse(m, Determinant(m)));
 }
Beispiel #7
0
 public static float Determinant(Matrix2 m)
 {
     return(m[0][0] * m[1][1] - m[0][1] * m[1][0]);
 }
Beispiel #8
0
 public static Matrix2 Transpose(Matrix2 m)
 {
     return(new Matrix2(m[0][0], m[1][0], m[0][1], m[1][1]));
 }
Beispiel #9
0
 public bool Equals(Matrix2 m)
 {
     return(this == m);
 }