Quasimondo
Quasimondo

Reputation: 2545

Using a Cubic Bezier Curve as a straight Line: where do the control points have to be located to get equidistant spacing for t

When the two control points of a cubic bezier curve are both located on the line between the two end points of the curve the resulting curve will be line. The issue in my case is that the actual spacing of the points on the curve that I get for different t's varies based on where the control points are located on that line.

If I calculate the locations of the two control points using a lerp between p1 and p2 like this:

controlPoint1 = endPoint1.lerp(endPoint2,a);
controlPoint2 = endPoint1.lerp(endPoint2,b);

there must be one configuration of a,b where the spacing will actually be equidistant. I tried 0.25/0.75, 0.3333/0.6666, 0.5/0.5 but none of these seem to cut it.

Upvotes: 7

Views: 3797

Answers (1)

Aki Suihkonen
Aki Suihkonen

Reputation: 20027

I believe the [0, 1/3, 2/3, 1] =[a, b, c, d] is the correct answer.

At least with these values the recursive bisection

e = a*(1-t)+b*t, f=b*(1-t)+c*t, g=c*(1-t)+d*t,  
h = e*(1-t)+f*t, i=f*(1-t)+g*t,  
j = h*(1-t)+i*t,  

Gives j=t for all values.

Upvotes: 10

Related Questions