Some formulas in the referenced web site are not correct. Especially the result formula for a

_{1} is wrong.

You must understand that you have the freedom to chose the t

_{1} for your P

_{1}: by varying t

_{1} for your chosen P

_{1}, the shape of the curve will vary too.

Assuming you have three defined points:

- start (t = 0) at P

_{0}
- end (t = 1) at P

_{2}
- a point P

_{1} between start and end where you also decide for a t

_{1} (e.g. 0.5).

Given these four parameters (P

_{0}, P

_{2}, P

_{1}, t

_{1}), the needed curve coefficients are:

a

_{0} = A

a

_{1} = B - t

_{1} C

a

_{2} = C - B

Where

A = P

_{0}
B = (P

_{1} - P

_{0}) / ((1 - t

_{1}) t

_{1})

C = (P

_{2} - P

_{0}) / (1 - t

_{1})

If working in 2D, each coefficient consists of two values, one for each axis - working in 3D, each coefficient consists of 3 values, on per axis.

E.g. for each axis coeficient value, you set the respective axis value of the points P

_{u} plus the parameter t

_{1} value into the formulas above.

Then you sweep the parameter t from 0 to 1 and calculate the curve points P(t) to draw.

pseudo code:

class Formula
{
private Point a0;
private Point a1;
private Point a2;
private Point A(Point p0, Point p1, Point p2, double t1) { return p0; }
private Point B(Point p0, Point p1, Point p2, double t1) { double d = 1/((1-t1)*t1); return (p1-p0)*d; }
private Point C(Point p0, Point p1, Point p2, double t1) { return d = 1/(1-t1); return (p2-p0)*d; }
public Formula(Point p0, Point p1, point p2, double t1)
{
Point a = A(p0, p1, p2, t1);
Point b = B(p0, p1, p2, t1);
Point c = C(p0, p1, p2, t1);
a0 = a;
a1 = b-c*t1;
a2 = c-b;
}
public Point P(double t) { return ((a2*t)+a1)*t+a0; }
}
...
var start = new Point(0,2);
var end = new Point(7,6);
var p1 = new Point(2,3);
double t1 = 0.5;
var Formula curve = new Formula(start, p1, end, t1);
...
int steps = 100;
double step = 1.0/(double)steps;
Point curr = p0;
foreach(int i = 1; i <= steps; ++i)
{
Point next = curve.P(step*(double)i);
Draw(curr, next);
curr = next;
}

Cheers

Andi