**Edit: Added Translate function, fixed parameters**

Hey, I'm trying to implement the cubic bezier curve for an animation, I found the definition below from wikipedia, can someone validate this for me?

public float CubicBezier(float t, PointF p0, PointF p1, PointF p2, PointF p3) { if (t < 0 || t > 1) throw new ArgumentException(); PointF b = Translate( Scale(Power(1 - t, 3), p0), Scale(3 * Power(1 - t, 2) * t, p1), Scale(3 * (1 - t) * Power(t, 2), p2), Scale(Power(t, 3), p3) ); return b.Y; } public float Power(float n, float p) { double v = Math.Pow((double) n, (double) p); return Convert.ToSingle(v); } public PointF Scale(float f, PointF p) { PointF ps = new PointF(); ps.X = p.X * f; ps.Y = p.Y * f; return ps; } public PointF Translate(params PointF[] ps) { PointF pt = new PointF(); foreach (PointF p in ps) { pt.X = pt.X + p.X; pt.Y = pt.Y + p.Y; } return pt; }

## Thread Closed

This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,

or Contact Us and let us know.