[Math] Equation for control point distance for fixed-length cubic Bézier path (with specific constraints)

bezier-curvecalculusgeometryparametric

A particular Stack Overflow question asks how to construct a specific cubic Bézier path of constant length. I have experimentally determined the ideal distances of the control points from the nearest on-path handle and plotted them as seen here:

Graph showing actual points compared to ellipse

The graph in blue is the equation I am after. (The $y$ intercept appears to be at $\cos(30°)$.) The graph in red is an ellipse (not the right equation).

Does anyone have either a guess or (better yet) a derivation of what the actual formula ought to be that predicts the distance of a control point oriented $90°$ to the path end points to achieve a constant-length path?

Edit: Here's a diagram showing the constraints on the path:

S Curve showing four points in a 'stair-step' arrangement

  1. The arrangement of the control points $P_1$ and $P_2$ is always orthogonal to the line connecting the end points $P_0$ and $P_3$.

  2. The distance $h$ of each control point from the associated end point is the same for both control points. $|P_1-P_0| = |P_3-P_2|$

  3. The two control points are always on opposite sides of line connecting the end points (they're always in a stair-step, producing a curve looking like an 's').

  4. The goal is to find an equation for $h$ in terms of $d$ (the distance between the two end points).

Edit 2: I can simplify these parametric equations for cubic Bézier curves for my constraints and arrive at:

$$\begin{align*}
x(t) &= -6ht^3 + 9ht^2 -3ht\\
y(t)& = -2dt^3 + 3dt^2
\end{align*}$$

How do I integrate from $t=0\ldots1$ to get the length of the curve and then express $h$ in terms of $d$?

Best Answer

It's (probably) impossible to obtain a formula that gives h as a function of d. But, as you can see from the graph you drew, the function is nicely-behaved, so it should be easy to approximate it by some simple function.

If you're interested in a practical approximation, rather than a theoretically correct closed-form solution, let us know, and the details of some approximation can be elaborated.

This might help: http://steve.hollasch.net/cgindex/curves/cbezarclen.html