/[classpath]/classpath/java/awt/geom/AffineTransform.java
ViewVC logotype

Diff of /classpath/java/awt/geom/AffineTransform.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by mkoch, Fri Oct 1 08:47:41 2004 UTC revision 1.8 by mkoch, Tue Nov 16 21:24:07 2004 UTC
# Line 1234  public class AffineTransform implements Line 1234  public class AffineTransform implements
1234    public Point2D inverseTransform(Point2D src, Point2D dst)    public Point2D inverseTransform(Point2D src, Point2D dst)
1235      throws NoninvertibleTransformException      throws NoninvertibleTransformException
1236    {    {
1237      double det = getDeterminant();      return createInverse().transform(src, dst);
     if (det == 0)  
       throw new NoninvertibleTransformException("couldn't invert transform");  
     if (dst == null)  
       dst = new Point2D.Double();  
     double x = src.getX();  
     double y = src.getY();  
     double nx = (m11 * x + -m10 * y) / det - m02;  
     double ny = (m01 * x + -m00 * y) / det - m12;  
     dst.setLocation(nx, ny);  
     return dst;  
1238    }    }
1239    
1240    /**    /**
# Line 1268  public class AffineTransform implements Line 1258  public class AffineTransform implements
1258                                 double[] dstPts, int dstOff, int num)                                 double[] dstPts, int dstOff, int num)
1259      throws NoninvertibleTransformException      throws NoninvertibleTransformException
1260    {    {
1261      double det = getDeterminant();      createInverse().transform(srcPts, srcOff, dstPts, dstOff, num);
     if (det == 0)  
       throw new NoninvertibleTransformException("couldn't invert transform");  
     if (srcPts == dstPts && dstOff > srcOff  
         && num > 1 && srcOff + 2 * num > dstOff)  
       {  
         double[] d = new double[2 * num];  
         System.arraycopy(srcPts, srcOff, d, 0, 2 * num);  
         srcPts = d;  
       }  
     while (--num >= 0)  
       {  
         double x = srcPts[srcOff++];  
         double y = srcPts[srcOff++];  
         dstPts[dstOff++] = (m11 * x + -m10 * y) / det - m02;  
         dstPts[dstOff++] = (m01 * x + -m00 * y) / det - m12;  
       }  
1262    }    }
1263    
1264    /**    /**
# Line 1359  public class AffineTransform implements Line 1333  public class AffineTransform implements
1333     * which only stores points in float precision.     * which only stores points in float precision.
1334     *     *
1335     * @param src the shape source to transform     * @param src the shape source to transform
1336     * @return the shape, transformed by this     * @return the shape, transformed by this, <code>null</code> if src is
1337     * @throws NullPointerException if src is null     * <code>null</code>.
1338     * @see GeneralPath#transform(AffineTransform)     * @see GeneralPath#transform(AffineTransform)
1339     */     */
1340    public Shape createTransformedShape(Shape src)    public Shape createTransformedShape(Shape src)
1341    {    {
1342        if(src == null)
1343          return null;
1344      GeneralPath p = new GeneralPath(src);      GeneralPath p = new GeneralPath(src);
1345      p.transform(this);      p.transform(this);
1346      return p;      return p;

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26