Exemplo n.º 1
0
        public virtual void  CurveTo(PointFP control1, PointFP control2, PointFP point)
        {
            PointFP tmp1 = new PointFP(currPoint.X - control1.X * 2 + control2.X, currPoint.Y - control1.Y * 2 + control2.Y);
            PointFP tmp2 = new PointFP((control1.X - control2.X) * 3 - currPoint.X + point.X, (control1.Y - control2.Y) * 3 - currPoint.Y + point.Y);

            PointFP f    = new PointFP(currPoint);
            PointFP df   = new PointFP((control1.X - currPoint.X) * 3 / SUBDIVIDE + tmp1.X * 3 / SUBDIVIDE2 + tmp2.X / SUBDIVIDE3, (control1.Y - currPoint.Y) * 3 / SUBDIVIDE + tmp1.Y * 3 / SUBDIVIDE2 + tmp2.Y / SUBDIVIDE3);
            PointFP ddf  = new PointFP(tmp1.X * 6 / SUBDIVIDE2 + tmp2.X * 6 / SUBDIVIDE3, tmp1.Y * 6 / SUBDIVIDE2 + tmp2.Y * 6 / SUBDIVIDE3);
            PointFP dddf = new PointFP(tmp2.X * 6 / SUBDIVIDE3, tmp2.Y * 6 / SUBDIVIDE3);

            for (int c = 0; c < SUBDIVIDE - 1; c++)
            {
                f.Add(df); df.Add(ddf); ddf.Add(dddf); LineTo(f);
            }

            LineTo(point);
        }
Exemplo n.º 2
0
        public virtual void  CurveTo(PointFP control, PointFP point)
        {
            // Compute forward difference values for a quadratic
            // curve of type A*(1-t)^2 + 2*B*t*(1-t) + C*t^2

            PointFP f   = new PointFP(currPoint);
            PointFP tmp = new PointFP((currPoint.X - control.X * 2 + point.X) / SUBDIVIDE2, (currPoint.Y - control.Y * 2 + point.Y) / SUBDIVIDE2);
            PointFP ddf = new PointFP(tmp.X * 2, tmp.Y * 2);
            PointFP df  = new PointFP(tmp.X + (control.X - currPoint.X) * 2 / SUBDIVIDE, tmp.Y + (control.Y - currPoint.Y) * 2 / SUBDIVIDE);

            for (int c = 0; c < SUBDIVIDE - 1; c++)
            {
                f.Add(df); df.Add(ddf); LineTo(f);
            }

            // We specify the last point manually since
            // we obtain rounding errors during the
            // forward difference computation.
            LineTo(point);
        }