//----------------------------------------------------------------
        public void Begin(double x, double y, uint len)
        {
            // Calculate transformed Coordinates At x1,y1
            double xt = x;
            double yt = y;

            m_trans_dir.Transform(ref xt, ref yt);
            int x1 = Basics.Round(xt * subpixel_scale);
            int y1 = Basics.Round(yt * subpixel_scale);

            double dx;
            double dy;
            double delta = 1 / (double)subpixel_scale;

            // Calculate Scale by X At x1,y1
            dx = xt + delta;
            dy = yt;
            m_trans_inv.Transform(ref dx, ref dy);
            dx -= x;
            dy -= y;
            int sx1 = (int)Basics.UnsignedRound(subpixel_scale / Math.Sqrt(dx * dx + dy * dy)) >> subpixel_shift;

            // Calculate Scale by Y At x1,y1
            dx = xt;
            dy = yt + delta;
            m_trans_inv.Transform(ref dx, ref dy);
            dx -= x;
            dy -= y;
            int sy1 = (int)Basics.UnsignedRound(subpixel_scale / Math.Sqrt(dx * dx + dy * dy)) >> subpixel_shift;

            // Calculate transformed Coordinates At x2,y2
            x += len;
            xt = x;
            yt = y;
            m_trans_dir.Transform(ref xt, ref yt);
            int x2 = Basics.Round(xt * subpixel_scale);
            int y2 = Basics.Round(yt * subpixel_scale);

            // Calculate Scale by X At x2,y2
            dx = xt + delta;
            dy = yt;
            m_trans_inv.Transform(ref dx, ref dy);
            dx -= x;
            dy -= y;
            int sx2 = (int)Basics.UnsignedRound(subpixel_scale / Math.Sqrt(dx * dx + dy * dy)) >> subpixel_shift;

            // Calculate Scale by Y At x2,y2
            dx = xt;
            dy = yt + delta;
            m_trans_inv.Transform(ref dx, ref dy);
            dx -= x;
            dy -= y;
            int sy2 = (int)Basics.UnsignedRound(subpixel_scale / Math.Sqrt(dx * dx + dy * dy)) >> subpixel_shift;

            // Initialize the interpolators
            m_coord_x = new Dda2LineInterpolator(x1, x2, (int)len);
            m_coord_y = new Dda2LineInterpolator(y1, y2, (int)len);
            m_scale_x = new Dda2LineInterpolator(sx1, sx2, (int)len);
            m_scale_y = new Dda2LineInterpolator(sy1, sy2, (int)len);
        }
Exemplo n.º 2
0
        public void Scaling(out double x, out double y)
        {
            double      x1 = 0.0;
            double      y1 = 0.0;
            double      x2 = 1.0;
            double      y2 = 1.0;
            Perspective t  = new Perspective(this);

            t *= Affine.NewRotation(-Rotation());
            t.Transform(ref x1, ref y1);
            t.Transform(ref x2, ref y2);
            x = x2 - x1;
            y = y2 - y1;
        }
Exemplo n.º 3
0
        // Inverse transformation of x and y. It works slow because
        // it explicitly inverts the matrix on every call. For massive
        // operations it's better to Invert() the matrix and then use
        // direct transformations.
        public void InverseTransform(ref double x, ref double y)
        {
            Perspective t = new Perspective(this);

            if (t.Invert())
            {
                t.Transform(ref x, ref y);
            }
        }
Exemplo n.º 4
0
 public void Scaling(out double x, out double y)
 {
     double x1 = 0.0;
     double y1 = 0.0;
     double x2 = 1.0;
     double y2 = 1.0;
     Perspective t=new Perspective(this);
     t *= Affine.NewRotation(-Rotation());
     t.Transform(ref x1, ref y1);
     t.Transform(ref x2, ref y2);
     x = x2 - x1;
     y = y2 - y1;
 }
Exemplo n.º 5
0
 // Inverse transformation of x and y. It works slow because
 // it explicitly inverts the matrix on every call. For massive
 // operations it's better to Invert() the matrix and then use
 // direct transformations.
 public void InverseTransform(ref double x, ref double y)
 {
     Perspective t = new Perspective(this);
     if(t.Invert()) t.Transform(ref x, ref y);
 }