Description
The Vector3.TcbSpline
method computes a point on a Tension-Continuity-Bias (TCB) spline, which is a type of Hermite spline. This method is useful for creating smooth curves that pass through a series of points, with additional control over the shape of the curve through tension, continuity, and bias parameters.
Usage
To use the Vector3.TcbSpline
method, provide four control points p0
, p1
, p2
, and p3
, along with the tension, continuity, and bias parameters. The parameter u
specifies the position along the spline, where 0 represents the start and 1 represents the end of the segment between p1
and p2
.
The method returns a Vector3
representing the interpolated point on the spline.
Example
Vector3 p0 = new Vector3(0, 0, 0);
Vector3 p1 = new Vector3(1, 1, 0);
Vector3 p2 = new Vector3(2, 1, 0);
Vector3 p3 = new Vector3(3, 0, 0);
float tension = 0.5f;
float continuity = 0.0f;
float bias = 0.0f;
float u = 0.5f;
Vector3 pointOnSpline = Vector3.TcbSpline(ref p0, ref p1, ref p2, ref p3, tension, continuity, bias, u);
// pointOnSpline now holds the interpolated point on the TCB spline.