# Bézier curves off the Diagonal

We all know that we can drag the center point of a diagonal in a plot and then move it around to make beautiful arcs. However, how are they mathematically generated and can they be easily controlled by a single parameter?

Bézier curves for $\alpha$ parameter 0, 0.25, 0.5, 0.75 and 1

The answers to both above questions is yes! The above curves are essentially quadratic Bézier curves with three control points. All of them have a relatively easy to pick start and end point. In the examples above we pick (1, 1) and (100, 100). However for any general row count $N_R$ and column count $N_C$, the end point can $(N_C, N_R)$ — points denoted by $(x, y)$ convention which is columns first.

Now that we have two points, we can talk about the third control point. When this is the mid-point of the space $(0.5 \cdot N_C, 0.5 \cdot N_R)$ the curve is a straight diagonal line as all points are collinear. However add an imbalance and we get deviations from the diagonal. For simplicity, these deviations can be parametrized by a single variable $\alpha$, which makes the third point $(\alpha N_C, (1-\alpha) N_R)$.

The equations of the curves correspond to rational Bézier curves with three points which have the additional property of also representing conic sections

$\mathbf{B}(t) = \frac{\sum_{i=0}^2 {2 \choose i} t^i (1-t)^{2-i}\mathbf{P}_{i} } { \sum_{i=0}^2 {2 \choose i} t^i (1-t)^{2-i} }$

where the value $t$ sweeps from 0 to 1 in small steps to get the $(x, y)$ coordinates at each step.

An application of this curve (my use-case) is to model the number of sentences (space) used to describe a movie / TV episode in a plot synopsis (plotted on the y-axis) corresponding to the shots (plotted on the x-axis). Empirical evidence suggests that authors spend more space describing the latter half of a video as it approaches the climax, thus allowing us to use $\alpha \sim 0.65$ as a model which fits better than the diagonal.

Interesting! Of course the follow up question is now, whether $\alpha$ can be learned from training data (?)