docs.unity3d.com
    Show / Hide Table of Contents

    Struct BezierCurve

    Control points for a cubic bezier curve.

    Points P0 through P3 are in sequential order, describing the starting point, second, third, and ending controls for a cubic bezier curve.

    Namespace: UnityEngine.Splines
    Syntax
    public struct BezierCurve : IEquatable<BezierCurve>

    Constructors

    BezierCurve(float3, float3)

    Construct a cubic bezier curve from a linear curve. A linear curve is simply a straight line.

    Declaration
    public BezierCurve(float3 p0, float3 p1)
    Parameters
    Type Name Description
    float3 p0

    The first control point. This is the start point of the curve.

    float3 p1

    The second control point. This is the end point of the curve.

    BezierCurve(float3, float3, float3)

    Construct a cubic bezier curve by elevating a quadratic curve.

    Declaration
    public BezierCurve(float3 p0, float3 p1, float3 p2)
    Parameters
    Type Name Description
    float3 p0

    The first control point. This is the start point of the curve.

    float3 p1

    The second control point.

    float3 p2

    The third control point. This is the end point of the curve.

    BezierCurve(float3, float3, float3, float3)

    Construct a cubic bezier curve from a series of control points.

    Declaration
    public BezierCurve(float3 p0, float3 p1, float3 p2, float3 p3)
    Parameters
    Type Name Description
    float3 p0

    The first control point. This is the start point of the curve.

    float3 p1

    The second control point.

    float3 p2

    The third control point.

    float3 p3

    The fourth control point. This is the end point of the curve.

    BezierCurve(BezierKnot, BezierKnot)

    Construct a cubic bezier curve from a start and end BezierKnot.

    Declaration
    public BezierCurve(BezierKnot a, BezierKnot b)
    Parameters
    Type Name Description
    BezierKnot a

    The knot to use as the first and second control points. The first control point is equal to Position, and the second control point is equal to (Position + TangentOut that's rotated by Rotation).

    BezierKnot b

    The knot to use as the third and fourth control points. The third control point is equal to (Position + TangentIn that's rotated by Rotation), and the fourth control point is equal to Position.

    Fields

    P0

    First control point.

    Declaration
    public float3 P0
    Field Value
    Type Description
    float3

    P1

    Second control point. Subtract P0 from P1 to derive the first tangent for a curve.

    Declaration
    public float3 P1
    Field Value
    Type Description
    float3

    P2

    Third control point. Subtract P3 from P2 to derive the second tangent for a curve.

    Declaration
    public float3 P2
    Field Value
    Type Description
    float3

    P3

    Fourth control point.

    Declaration
    public float3 P3
    Field Value
    Type Description
    float3

    Properties

    Tangent0

    The direction and magnitude of the first tangent in a cubic curve.

    Declaration
    public float3 Tangent0 { get; set; }
    Property Value
    Type Description
    float3

    Tangent1

    The direction and magnitude of the second tangent in a cubic curve.

    Declaration
    public float3 Tangent1 { get; set; }
    Property Value
    Type Description
    float3

    Methods

    Equals(Object)

    Compare against an object for equality.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    Object obj

    The object to compare against.

    Returns
    Type Description
    Boolean

    Returns true when obj is a BezierCurve and the control points of each curve are identical.

    Equals(BezierCurve)

    Compare two curves for equality.

    Declaration
    public bool Equals(BezierCurve other)
    Parameters
    Type Name Description
    BezierCurve other

    The curve to compare against.

    Returns
    Type Description
    Boolean

    Returns true when the control points of each curve are identical.

    FromTangent(float3, float3, float3, float3)

    Create a BezierCurve from a start and end point plus tangent directions.

    Declaration
    public static BezierCurve FromTangent(float3 pointA, float3 tangentOutA, float3 pointB, float3 tangentInB)
    Parameters
    Type Name Description
    float3 pointA

    Starting position of the curve.

    float3 tangentOutA

    The direction and magnitude to the second control point.

    float3 pointB

    Ending position of the curve.

    float3 tangentInB

    The direction and magnitude to the third control point.

    Returns
    Type Description
    BezierCurve

    A new BezierCurve from the derived control points.

    GetHashCode()

    Calculate a hash code for this curve.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32

    A hash code for the curve.

    Operators

    Equality(BezierCurve, BezierCurve)

    Compare two curves for equality.

    Declaration
    public static bool operator ==(BezierCurve left, BezierCurve right)
    Parameters
    Type Name Description
    BezierCurve left

    The first curve.

    BezierCurve right

    The second curve.

    Returns
    Type Description
    Boolean

    Returns true when the control points of each curve are identical.

    Inequality(BezierCurve, BezierCurve)

    Compare two curves for inequality.

    Declaration
    public static bool operator !=(BezierCurve left, BezierCurve right)
    Parameters
    Type Name Description
    BezierCurve left

    The first curve.

    BezierCurve right

    The second curve.

    Returns
    Type Description
    Boolean

    Returns false when the control points of each curve are identical.

    In This Article
    • Constructors
      • BezierCurve(float3, float3)
      • BezierCurve(float3, float3, float3)
      • BezierCurve(float3, float3, float3, float3)
      • BezierCurve(BezierKnot, BezierKnot)
    • Fields
      • P0
      • P1
      • P2
      • P3
    • Properties
      • Tangent0
      • Tangent1
    • Methods
      • Equals(Object)
      • Equals(BezierCurve)
      • FromTangent(float3, float3, float3, float3)
      • GetHashCode()
    • Operators
      • Equality(BezierCurve, BezierCurve)
      • Inequality(BezierCurve, BezierCurve)
    Back to top
    Terms of use
    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