Exemplo n.º 1
0
 public static Transform2D Scale (float x, float y)
 {
     var t = new Transform2D ();
     t.M11 = x;
     t.M22 = y;
     //t.M33 = 1;
     return t;
 }
Exemplo n.º 2
0
 public static Transform2D Translate (float x, float y)
 {
     var t = new Transform2D ();
     t.M11 = 1;
     t.M22 = 1;
     //t.M33 = 1;
     t.M13 = x;
     t.M23 = y;
     return t;
 }
Exemplo n.º 3
0
		public Transform2D Invert ()
		{
			// [ M22, -M12,  M12*M23 - M13*M22; 
			//  -M21,  M11, -M11*M23 + M13*M21; 
			//     0,    0,  M11*M22 - M12*M21]/(M11*M22 - M21*M12)
			var d = M11 * M22 - M21 * M12;
			if (d == 0)
				throw new InvalidOperationException ();

			var r = 1.0f / d;
			var t = new Transform2D ();
			t.M11 = r * (M22);
			t.M12 = r * (-M12);
			t.M13 = r * (M12 * M23 - M13 * M22);
			t.M21 = r * (-M21);
			t.M22 = r * (M11);
			t.M23 = r * (-M11 * M23 + M13 * M21);
			return t;
		}
Exemplo n.º 4
0
 public static Transform2D Identity ()
 {
     var t = new Transform2D ();
     t.M11 = 1;
     t.M22 = 1;
     //t.M33 = 1;
     return t;
 }
Exemplo n.º 5
0
        public static Transform2D operator * (Transform2D l, Transform2D r)
        {
            var t = new Transform2D ();

			t.M11 = l.M11 * r.M11 + l.M12 * r.M21;// +l.M13 * r.M31;
			t.M12 = l.M11 * r.M12 + l.M12 * r.M22;// +l.M13 * r.M32;
			t.M13 = l.M11 * r.M13 + l.M12 * r.M23 + l.M13;// *r.M33;

			t.M21 = l.M21 * r.M11 + l.M22 * r.M21;// +l.M23 * r.M31;
			t.M22 = l.M21 * r.M12 + l.M22 * r.M22;// +l.M23 * r.M32;
			t.M23 = l.M21 * r.M13 + l.M22 * r.M23 + l.M23;// *r.M33;

            //t.M31 = l.M31 * r.M11 + l.M32 * r.M21 + l.M33 * r.M31;
            //t.M32 = l.M31 * r.M12 + l.M32 * r.M22 + l.M33 * r.M32;
            //t.M33 = l.M31 * r.M13 + l.M32 * r.M23 + l.M33 * r.M33;

            return t;
        }