[Math] Finding a quadratic Bézier curve of length $l$ between two points

bezier-curvegeometryparametric

I have two points $P_1$ and $P_2$ in the plane. For each of the points, I have two vectors $v_1$ and $v_2$. I want to find a quadratic Bézier curve from $P_1$ to $P_2$ of length $l$ leaving $P_1$ in the direction of $v_1$ and entering $P_2$ in the direction of $v_2$.

Edit: It is not needed that I restrict myself to Bézier curves, it was just my first approach. Other ideas are more than welcome.

Also, as stated in the comments, this is not always possible, but I am only interested in the cases where it is possible.

Best Answer

Let $Q$ be the intersection of the two end tangents defined by $(P_1, v_1)$ and $(P_2, v_2)$.

You can construct a rational quadratic Bezier curve (degree 2) with the required arclength $l$ provided $d(P_1,P_2) \le l < d(P_1,Q) + d(P_2,Q)$, where $d$ denotes the distance between two points. Rational quadratics are just conic section curves.

AFAIK, there is no closed-form solution that lets you construct the curve, for a given $l$, but a simple one-parameter root-finding process will give it to you reliably and quickly.

Unlike cubics, rational quadratics never have inflexions, which might be useful to you. And, for values of $l$ close to $d(P_1,Q) + d(P_2,Q)$, they give a solution that is arguably more "natural".

The basic formulae and some nice pictures can be found on this page.