2D Trigonometric Spline
Click and drag control points to change curve.
For more information, check out the post on my blog: Bezier Curves.
This trigonometric spline has 4 control points 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.
- A * (0.5*cos(t)*(cos(t)+1.0))
- B * (0.5*sin(t)*(sin(t)-1.0))
- C * (0.5*cos(t)*(cos(t)-1.0))
- D * (0.5*sin(t)*(sin(t)+1.0))
Parameters:
t - "Time", this value goes from 0 to pi/2 to generate each point on the curve
A - The first control point, also the starting point of the curve.
B - The second control point.
C - The third control point.
D - The fourth control point, also the ending point of the curve.
In other words, if you have 4 control points A,B,C and D, and a time t:
CurvePoint = A*(0.5*cos(t)*(cos(t)+1.0)) + B*(0.5*sin(t)*(sin(t)-1.0)) + C*(0.5*cos(t)*(cos(t)-1.0)) + D*(0.5*sin(t)*(sin(t)+1.0))
Note that this spline is 2 dimensional because A,B,C,D are 2 dimensional, but you could use these same equations in any dimenion!