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

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:

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:

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$?

-
So if I understand correctly: given two points and a length, you want to find a Bezier curve made of three control points, with the prescribed endpoints and arc length? –  user7530 Nov 23 '11 at 20:13
@user7530 Yes, with the added constraint that the control points are always at right angles to the line connecting the two end points. I'll edit the question with a diagram for clarity. –  Phrogz Nov 23 '11 at 21:04
The particularly nasty thing about your problem is that one requires the services of elliptic integrals to express the arclength of a cubic Bézier curve (see this for instance). Inverting that elliptic integral is an even hairier deal. –  Ｊ. Ｍ. Nov 24 '11 at 8:44
See also this demonstration. –  Ｊ. Ｍ. Nov 24 '11 at 8:52
@J.M. Thanks for the details. That's unfortunate; I had hoped that the constraints on the points would sufficiently restrict the solution to something with a simple closed form. –  Phrogz Nov 24 '11 at 16:27