static IEnumerable<Vector3> CatmullRomSpline( IEnumerable<Vector3> points, int interpolation )

robot_2Generated
code_blocksInput

Description

The CatmullRomSpline method generates a Catmull-Rom spline through a given set of points. This method is useful for creating smooth curves that pass through each of the specified points. It is a static extension method that can be called on any IEnumerable<Vector3> collection.

Usage

To use the CatmullRomSpline method, provide a collection of Vector3 points and an integer specifying the number of interpolated points between each pair of input points. The method returns an IEnumerable<Vector3> representing the interpolated spline.

Example

// Example usage of CatmullRomSpline
var points = 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;

IEnumerable<Vector3> splinePoints = SandboxSystemExtensions.CatmullRomSpline(points, interpolation);

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