예제 #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]);
        }
예제 #2
0
 public void SetUpper2x2(Matrix2 m)
 {
     this[0] = m[0];
     this[1] = m[1];
 }
예제 #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));
 }
예제 #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));
 }
예제 #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);
 }
예제 #6
0
 public static Matrix2 Inverse(Matrix2 m)
 {
     return(Inverse(m, Determinant(m)));
 }
예제 #7
0
 public static float Determinant(Matrix2 m)
 {
     return(m[0][0] * m[1][1] - m[0][1] * m[1][0]);
 }
예제 #8
0
 public static Matrix2 Transpose(Matrix2 m)
 {
     return(new Matrix2(m[0][0], m[1][0], m[0][1], m[1][1]));
 }
예제 #9
0
 public bool Equals(Matrix2 m)
 {
     return(this == m);
 }