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

            if (Math.Abs(det) < ZERO)
            {
                // awt.204=Determinant is zero
                throw new InvalidOperationException("awt.204");
            }

            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);
        }
Ejemplo n.º 2
0
        public virtual 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);
        }
Ejemplo n.º 3
0
 public virtual 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;
     }
 }