One Dimensional Rational Trigonometric Spline

Click and drag control points to change curve. Modify weights in boxes below the curve.

For more information, check out the post on my blog: Bezier Curves.

A = 0.5 B = 0.25 C = 0.75 D = 0.5
f(x): y = 0.5 * (0.5*cos(x)*(cos(x)+1.0)) + 0.25 * (0.5*sin(x)*(sin(x)-1.0)) + 0.75 * (0.5*cos(x)*(cos(x)-1.0)) + 0.5 * (0.5*sin(x)*(sin(x)+1.0))
where x ranges from 0 to pi/2 instead of the usual 0 to 1

Your browser doesn't seem to support the necesary html5 features ):

W1: W2:
W3: W4:

This rational trigonometric spline has 4 control points, a weight per control point (4 total), and total up the values of the 4 functions below to get the final point at time t. t ranges from 0 to pi/2 instead of the usual 0 to 1.
  1. A * W1 * (0.5*cos(x)*(cos(x)+1.0))
  2. B * W2 * (0.5*sin(x)*(sin(x)-1.0))
  3. C * W3 * (0.5*cos(x)*(cos(x)-1.0))
  4. D * W4 * (0.5*sin(x)*(sin(x)+1.0))
It then divides that by the total of these 4 functions.
  1. W1 * (0.5*cos(x)*(cos(x)+1.0))
  2. W2 * (0.5*sin(x)*(sin(x)-1.0))
  3. W3 * (0.5*cos(x)*(cos(x)-1.0))
  4. W4 * (0.5*sin(x)*(sin(x)+1.0))
Parameters:
t - "time", but in our case we are going to use the x axis value for t.
A - The first control point, which is also the value of the function when x = 0.
B - The second control point.
C - The third control point.
D - The fourth control point, which is also the value of the function when x = pi/2.
W1 - The weighting of control point A.
W2 - The weighting of control point B.
W3 - The weighting of control point C.
W4 - The weighting of control point D.

In this particular case, A, B, C and D are scalars, which makes the curve into the function:
y = (A * W1 * (0.5*cos(x)*(cos(x)+1.0)) + B * W2 * (0.5*sin(x)*(sin(x)-1.0)) + C * W3 * (0.5*cos(x)*(cos(x)-1.0)) + D * W4 * (0.5*sin(x)*(sin(x)+1.0))) / (A * (0.5*cos(x)*(cos(x)+1.0)) + B * (0.5*sin(x)*(sin(x)-1.0)) + C * (0.5*cos(x)*(cos(x)-1.0)) + D * (0.5*sin(x)*(sin(x)+1.0)))

Note that this spline is 1 dimensional because A,B,C,D are 1 dimensional, but you could use these same equations in any dimension. Also, these control points range from 0 to pi/2 on the X axis, but you could scale the X axis and/or the Y axis to get a different range of values.