[kaffe] CVS kaffe (dalibor): Resynced with GNU Classpath

Kaffe CVS cvs-commits at kaffe.org
Wed Feb 25 11:24:15 PST 2004


PatchSet 4462 
Date: 2004/02/25 19:09:58
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath
~
2004-02-24  Dalibor Topic <robilad at kaffe.org>

        Resynced with GNU Classpath

        2004-02-05  Olga Rodimina <rodimina at redhat.com>

        * java/awt/geom/AffineTransform.java:
        Corrected comments on the field definitions
        for m11 and m10
        (shear): Fixed few errors that caused shear
        transformation to be performed incorrectly.
        (createInverse): Fixed to return correct inverse
        of the given matrix.

Members: 
	ChangeLog:1.2042->1.2043 
	libraries/javalib/java/awt/geom/AffineTransform.java:1.2->1.3 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2042 kaffe/ChangeLog:1.2043
--- kaffe/ChangeLog:1.2042	Wed Feb 25 19:01:26 2004
+++ kaffe/ChangeLog	Wed Feb 25 19:09:58 2004
@@ -2,6 +2,20 @@
 
         Resynced with GNU Classpath
 
+	2004-02-05  Olga Rodimina <rodimina at redhat.com>
+
+        * java/awt/geom/AffineTransform.java:
+        Corrected comments on the field definitions 
+        for m11 and m10
+        (shear): Fixed few errors that caused shear 
+        transformation to be performed incorrectly.
+        (createInverse): Fixed to return correct inverse
+        of the given matrix.
+
+2004-02-24  Dalibor Topic <robilad at kaffe.org>
+
+        Resynced with GNU Classpath
+
 	2004-02-06  Michael Koch  <konqueror at gmx.de>
 
         * java/awt/datatransfer/DataFlavor.java
Index: kaffe/libraries/javalib/java/awt/geom/AffineTransform.java
diff -u kaffe/libraries/javalib/java/awt/geom/AffineTransform.java:1.2 kaffe/libraries/javalib/java/awt/geom/AffineTransform.java:1.3
--- kaffe/libraries/javalib/java/awt/geom/AffineTransform.java:1.2	Wed Oct 22 10:34:50 2003
+++ kaffe/libraries/javalib/java/awt/geom/AffineTransform.java	Wed Feb 25 19:09:59 2004
@@ -226,7 +226,7 @@
   private double m00;
 
   /**
-   * The Y coordinate scaling element of the transform matrix.
+   * The Y coordinate shearing element of the transform matrix.
    *
    * @serial matrix[1,0]
    */
@@ -240,7 +240,7 @@
   private double m01;
 
   /**
-   * The Y coordinate shearing element of the transform matrix.
+   * The Y coordinate scaling element of the transform matrix.
    *
    * @serial matrix[1,1]
    */
@@ -738,10 +738,10 @@
    */
   public void shear(double shx, double shy)
   {
-    double n00 = m00 + shx * m01;
-    double n01 = shx * m00 + m01;
-    double n10 = m10 * shy + m11;
-    double n11 = shx * m10 + m11;
+    double n00 = m00 + (shy * m01);
+    double n01 = m01 + (shx * m00);
+    double n10 = m10 + (shy * m11);
+    double n11 = m11 + (shx * m10);
     m00 = n00;
     m01 = n01;
     m10 = n10;
@@ -996,6 +996,38 @@
    * map multiple points to the same line or point). A transform exists only
    * if getDeterminant() has a non-zero value.
    *
+   * The inverse is calculated as:
+   * 
+   * <pre>
+   *
+   * Let A be the matrix for which we want to find the inverse:
+   *
+   * A = [ m00 m01 m02 ]
+   *     [ m10 m11 m12 ]
+   *     [ 0   0   1   ] 
+   *
+   *
+   *                 1    
+   * inverse (A) =  ---   x  adjoint(A) 
+   *                det 
+   *
+   *
+   *
+   *             =   1       [  m11  -m01   m01*m12-m02*m11  ]
+   *                ---   x  [ -m10   m00  -m00*m12+m10*m02  ]
+   *                det      [  0     0     m00*m11-m10*m01  ]
+   *
+   *
+   *
+   *             = [  m11/det  -m01/det   m01*m12-m02*m11/det ]
+   *               [ -m10/det   m00/det  -m00*m12+m10*m02/det ]
+   *               [   0           0          1               ]
+   *
+   *
+   * </pre>
+   *
+   *
+   *
    * @return a new inverse transform
    * @throws NoninvertibleTransformException if inversion is not possible
    * @see #getDeterminant()
@@ -1006,8 +1038,15 @@
     double det = getDeterminant();
     if (det == 0)
       throw new NoninvertibleTransformException("can't invert transform");
-    return new AffineTransform(m11 / det, -m10 / det, m01 / det, -m00 / det,
-                               -m02, -m12);
+    
+    double im00 = m11 / det;
+    double im10 = -m10 / det;
+    double im01 = -m01 / det;
+    double im11 = m00 / det;
+    double im02 = (m01 * m12 - m02 * m11) / det;
+    double im12 = (-m00 * m12 + m10 * m02) / det;
+    
+    return new AffineTransform (im00, im10, im01, im11, im02, im12);
   }
 
   /**




More information about the kaffe mailing list