예제 #1
0
        public Java.Lang.Object Evaluate(float t, Java.Lang.Object startValue, Java.Lang.Object endValue)
        {
            var start = (PathPoint)startValue;
            var end   = (PathPoint)endValue;

            float x, y;

            if (end.Operation == PathPointOperation.Curve)
            {
                float oneMinusT = 1 - t;
                x = oneMinusT * oneMinusT * oneMinusT * start.X +
                    3 * oneMinusT * oneMinusT * t * end.Control0X +
                    3 * oneMinusT * t * t * end.Control1X +
                    t * t * t * end.X;
                y = oneMinusT * oneMinusT * oneMinusT * start.Y +
                    3 * oneMinusT * oneMinusT * t * end.Control0Y +
                    3 * oneMinusT * t * t * end.Control1Y +
                    t * t * t * end.Y;
            }
            else if (end.Operation == PathPointOperation.Line)
            {
                x = start.X + t * (end.X - start.X);
                y = start.Y + t * (end.Y - start.Y);
            }
            else
            {
                x = end.X;
                y = end.Y;
            }
            return(PathPoint.MoveTo(x, y));
        }
예제 #2
0
 /// <summary>
 /// Move from the current path point to the new one
 /// specified by x and y. This will create a discontinuity if this point is
 /// neither the first point in the path nor the same as the previous point
 /// in the path.
 /// </summary>
 public void MoveTo(float x, float y)
 {
     points.Add(PathPoint.MoveTo(x, y));
 }