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.
Inherited Members
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
Declaration
public float3 P1
Field Value
Type | Description |
---|---|
float3 |
P2
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 |
Overrides
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. |
Implements
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. |
Overrides
GetInvertedCurve()
Gets the same BezierCurve but in the opposite direction.
Declaration
public BezierCurve GetInvertedCurve()
Returns
Type | Description |
---|---|
BezierCurve | Returns the BezierCurve struct in the inverse direction. |
Transform(float4x4)
Multiply the curve positions by a matrix.
Declaration
public BezierCurve Transform(float4x4 matrix)
Parameters
Type | Name | Description |
---|---|---|
float4x4 | matrix | The matrix to multiply. |
Returns
Type | Description |
---|---|
BezierCurve | A new BezierCurve multiplied by matrix. |
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. |