How to calculate the controls of this Bézier curve?

77 Views Asked by At

How to calculate the controls of this curve if I know three points: start, one on the curve and the end? Here is the curve with the coordinates I know:

The curve with the points

I've never done this kind of calculation before, so please be patient and explain it.

1

There are 1 best solutions below

0
On BEST ANSWER

If you just want some Bézier curve from $A$ to $C$ passing through $B$, you may take a quadratic curve with control point $P$ such that $B=\frac12(\frac{A+P}{2}+\frac{P+C}{2})=\frac{A+2P+C}{4}$, i.e., $P=\frac{4B-A-C}2$.

However, your image looks like a Bézier curve that is at least cubic. As there are (at least) two control points $P,Q$, there are additional degrees of freedom, i.e., there is no unique solution. Recall that a Bézier curve with controls $(A,P,Q,C)$ can be recursively split into two smaller curves $(A,\frac{A+P}2,\frac{A+2P+Q}4,\frac{A+3P+3Q+C}{8})$ and $(\frac{A+3P+3Q+C}{8},\frac{P+2Q+C}{4},\frac{Q+C}{2},C)$, so one of the points on the curve is the new endpoint $\frac{A+3P+3Q+C}{8}$ of the subsegments. Equating this to $B$ allows you to pick $P$ arbitrarily and then compute $Q$. Note that this still does not guarantee an optical match with your given curve as we arbitrarily picked $B$ to be the (parametric) midpoint of the curve. Perhaps split up $(A,\frac{A+P}2,\frac{A+2P+Q}4,\frac{A+3P+3Q+C}{8})$ once again as above into $(A,\frac{3A+P}{3}, \frac{9A+6P+Q}{16},\frac{27A+27P+9Q+C}{64})$ and whatever, and then equate $B$ with $\frac{27A+27P+9Q+C}{64}$, which again allows to pick $P$ arbitrarily and then compute $Q$?