docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class SplineHelpers

    A collection of utilities relating to Bezier splines

    Inheritance
    object
    SplineHelpers
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Cinemachine.Utility
    Assembly: Cinemachine.dll
    Syntax
    public static class SplineHelpers

    Methods

    Bezier1(float, float, float, float, float)

    Compute the value of a 4-point 1-dimensional bezier spline

    Declaration
    public static float Bezier1(float t, float p0, float p1, float p2, float p3)
    Parameters
    Type Name Description
    float t

    How far along the spline (0...1)

    float p0

    First point

    float p1

    First tangent

    float p2

    Second point

    float p3

    Second tangent

    Returns
    Type Description
    float

    The spline value at t

    Bezier3(float, Vector3, Vector3, Vector3, Vector3)

    Compute the value of a 4-point 3-dimensional bezier spline

    Declaration
    public static Vector3 Bezier3(float t, Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3)
    Parameters
    Type Name Description
    float t

    How far along the spline (0...1)

    Vector3 p0

    First point

    Vector3 p1

    First tangent

    Vector3 p2

    Second point

    Vector3 p3

    Second tangent

    Returns
    Type Description
    Vector3

    The spline value at t

    BezierTangent1(float, float, float, float, float)

    Compute the tangent of a 4-point 1-dimensional bezier spline

    Declaration
    public static float BezierTangent1(float t, float p0, float p1, float p2, float p3)
    Parameters
    Type Name Description
    float t

    How far along the spline (0...1)

    float p0

    First point

    float p1

    First tangent

    float p2

    Second point

    float p3

    Second tangent

    Returns
    Type Description
    float

    The spline tangent at t

    BezierTangent3(float, Vector3, Vector3, Vector3, Vector3)

    Compute the tangent of a 4-point 3-dimensional bezier spline

    Declaration
    public static Vector3 BezierTangent3(float t, Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3)
    Parameters
    Type Name Description
    float t

    How far along the spline (0...1)

    Vector3 p0

    First point

    Vector3 p1

    First tangent

    Vector3 p2

    Second point

    Vector3 p3

    Second tangent

    Returns
    Type Description
    Vector3

    The spline tangent at t

    BezierTangentWeights3(Vector3, Vector3, Vector3, Vector3, out Vector3, out Vector3, out Vector3)

    Compute the weights for the tangent of a 4-point 3-dimensional bezier spline

    Declaration
    public static void BezierTangentWeights3(Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3, out Vector3 w0, out Vector3 w1, out Vector3 w2)
    Parameters
    Type Name Description
    Vector3 p0

    First point

    Vector3 p1

    First tangent

    Vector3 p2

    Second point

    Vector3 p3

    Second tangent

    Vector3 w0

    First output weight

    Vector3 w1

    Second output weight

    Vector3 w2

    Third output weight

    ComputeSmoothControlPoints(ref Vector4[], ref Vector4[], ref Vector4[])

    Use the Thomas algorithm to compute smooth tangent values for a spline.
    Resultant tangents guarantee second-order smoothness of the curve.

    Declaration
    public static void ComputeSmoothControlPoints(ref Vector4[] knot, ref Vector4[] ctrl1, ref Vector4[] ctrl2)
    Parameters
    Type Name Description
    Vector4[] knot

    The knots defining the curve

    Vector4[] ctrl1

    Output buffer for the first control points (1 per knot)

    Vector4[] ctrl2

    Output buffer for the second control points (1 per knot)

    ComputeSmoothControlPointsLooped(ref Vector4[], ref Vector4[], ref Vector4[])

    Use the Thomas algorithm to compute smooth tangent values for a spline.
    This method will assume that the spline is looped (i.e. that the last knot is followed by the first). Resultant tangents guarantee second-order smoothness of the curve.

    Declaration
    public static void ComputeSmoothControlPointsLooped(ref Vector4[] knot, ref Vector4[] ctrl1, ref Vector4[] ctrl2)
    Parameters
    Type Name Description
    Vector4[] knot

    The knots defining the curve

    Vector4[] ctrl1

    Output buffer for the first control points (1 per knot)

    Vector4[] ctrl2

    Output buffer for the second control points (1 per knot)

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)