Esempio n. 1
0
        virtual public Point2D InverseTransform(Point2D src, Point2D dst)
        {
            double det = GetDeterminant();

            if (Math.Abs(det) < ZERO)
            {
                // awt.204=Determinant is zero
                throw new InvalidOperationException("awt.204"); //$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);
        }
Esempio n. 2
0
        virtual 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;
        }
Esempio n. 3
0
 virtual 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;
     }
 }
Esempio n. 4
0
        public Point2D Transform(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 + m02, x * m10 + y * m11 + m12);
            return(dst);
        }
        virtual public Point2D InverseTransform(Point2D src, Point2D dst) {
            double det = GetDeterminant();
            if (Math.Abs(det) < ZERO) {
                // awt.204=Determinant is zero
                throw new InvalidOperationException("awt.204"); //$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;
        }