static IEnumerable<Vector3> TcbSpline( IEnumerable<Vector3> points, int interpolation, float tension, float continuity, float bias )

robot_2Generated
code_blocksInput

Description

The TcbSpline method generates a Tension-Continuity-Bias (TCB) spline from a given set of control points. 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 TcbSpline method, provide a collection of Vector3 points that define the control points of the spline. Specify the number of interpolations between each pair of points, and adjust the tension, continuity, and bias parameters to control the shape of the spline.

Parameters:

  • points: An IEnumerable<Vector3> representing the control points of the spline.
  • interpolation: An int specifying the number of interpolated points between each pair of control points.
  • tension: A float that controls the tension of the spline. A value of 0 results in a Catmull-Rom spline, while higher values tighten the curve.
  • continuity: A float that controls the continuity of the spline. Adjusting this value affects the smoothness of the transitions between segments.
  • bias: A float that controls the bias of the spline. This parameter affects the direction of the curve as it passes through each control point.

Example

// Example usage of TcbSpline
var controlPoints = new List<Vector3>
{
    new Vector3(0, 0, 0),
    new Vector3(1, 2, 0),
    new Vector3(3, 3, 0),
    new Vector3(4, 0, 0)
};

int interpolation = 10;
float tension = 0.5f;
float continuity = 0.0f;
float bias = 0.0f;

var splinePoints = SandboxSystemExtensions.TcbSpline(controlPoints, interpolation, tension, continuity, bias);

foreach (var point in splinePoints)
{
    // Use the interpolated points
}