Пример #1
0
        public Point2D inverseTransform(Point2D src, Point2D dst)
        {//throws NoninvertibleTransformException {
            double det = getDeterminant();

            if (java.lang.Math.abs(det) < ZERO)
            {
                // awt.204=Determinant is zero
                throw new NoninvertibleTransformException("Determinant is zero"); //$NON-NLS-1$
            }

            if (dst == null)
            {
                if (src is Point2D.Double)
                {
                    dst = new Point2D.Double();
                }
                else
                {
                    dst = new Point2D.Float();
                }
            }

            double x = src.getX() - m02;
            double y = src.getY() - m12;

            dst.setLocation((x * m11 - y * m01) / det, (y * m00 - x * m10) / det);
            return(dst);
        }
Пример #2
0
        public Point2D deltaTransform(Point2D src, Point2D dst)
        {
            if (dst == null)
            {
                if (src is Point2D.Double)
                {
                    dst = new Point2D.Double();
                }
                else
                {
                    dst = new Point2D.Float();
                }
            }

            double x = src.getX();
            double y = src.getY();

            dst.setLocation(x * m00 + y * m01, x * m10 + y * m11);
            return(dst);
        }
Пример #3
0
 public void transform(Point2D[] src, int srcOff, Point2D[] dst, int dstOff, int length)
 {
     while (--length >= 0)
     {
         Point2D srcPoint = src[srcOff++];
         double  x        = srcPoint.getX();
         double  y        = srcPoint.getY();
         Point2D dstPoint = dst[dstOff];
         if (dstPoint == null)
         {
             if (srcPoint is Point2D.Double)
             {
                 dstPoint = new Point2D.Double();
             }
             else
             {
                 dstPoint = new Point2D.Float();
             }
         }
         dstPoint.setLocation(x * m00 + y * m01 + m02, x * m10 + y * m11 + m12);
         dst[dstOff++] = dstPoint;
     }
 }