docs.unity3d.com
    Show / Hide Table of Contents

    Class SplineHelpers

    A collection of utilities relating to Bezier splines

    Inheritance
    Object
    SplineHelpers
    Namespace: Cinemachine.Utility
    Syntax
    public static class SplineHelpers

    Methods

    Bezier1(Single, Single, Single, Single, Single)

    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
    Single t

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

    Single p0

    First point

    Single p1

    First tangent

    Single p2

    Second point

    Single p3

    Second tangent

    Returns
    Type Description
    Single

    The spline value at t

    Bezier3(Single, 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
    Single 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(Single, Single, Single, Single, Single)

    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
    Single t

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

    Single p0

    First point

    Single p1

    First tangent

    Single p2

    Second point

    Single p3

    Second tangent

    Returns
    Type Description
    Single

    The spline tangent at t

    BezierTangent3(Single, 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
    Single 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)

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023