# Bezier curves

These curves are defined by

**control points** P

_{i}, 0≤i≤n

The current point is then parametered as

P(t) = ∑ P_{i}C_{n}^{i} t^{i}(1-t)^{n-i}
with C

_{n}^{i} being the binomial coefficients (n! / i!(n-i)!) and parameter 0 ≤ t ≤ 1

The curve defined by these n+1 points is then of degree n.

An important property is that this curve is tangent to the end segments P

_{0}P

_{1} (in P

_{0}) and
P

_{n-1}P

_{n} (in P

_{n}).

Unfortunately, each intermediate control point changes the whole curve.

It is then difficult to choose the control points to get a curve through given points for instance.

We can then define the whole curve by parts, each part being defined by 3 or 4 points.

#### Casteljau construction

Note that

∑C

_{n}^{i} t

^{i}(1-t)

^{n-i} = (t + (1-t))

^{n} = 1

P(t) is then the centroid of points P

_{i} with corresponding weights.

Associative properties of centroids allow to recursively reduce the number of points.

With 3 control points A, B, C, we get :

Let M the centroid of A(t), B(1-t) and N the centroid of B(t), C(1-t).

that is AM/AB = BN/BC = t

We then calculate that P is the centroid of M(t), N(1-t) : MP/MN = t

The curve being of degree 2, it is an arc of conic sections, precisely an arc of parabola.

We may then continue with next control points D, E to get a second
Bezier curve CDE "in the following" of the first.

If we state (as in the above applet) that BCD are in line,
the whole curve has only one tangent in C and is "smooth".

If B and D are on the same side from C, we get a cusp point.

If we disconnect the directions of BC and CD, we get an angular point at C.

In the applet, you can drag the control points A,B,C,D,E,

D being restricted to be on line BC.

The draggable points M (M') define the parameter t of the current point P (P') for each of the two curves.

The above method can be used with 4 control points :

The Casteljau construction requires then one more iterate.

1st step : AM_{1}/AB = BN_{1}/BC = CP_{1}/CD = t

2nd step : M_{1}M_{2}/M_{1}N_{1} = N_{1}N_{2}/N_{1}P_{1} = t

and finally M_{2}P/M_{2}N_{2} = t

The curve is a cubic (degree 3). It is the curve generated by the object CubicCurve2D in Java awt.geom,
used for instance in the "loops game applet".