Struct BezierKnot
This struct contains position and tangent data for a knot. The position is a scalar point and the tangents are vectors. The Spline class stores a collection of BezierKnot that form a series of connected BezierCurve. Each knot contains a Position, Tangent In, and Tangent Out. When a spline is not closed, the first and last knots will contain an extraneous tangent (in and out, respectively).
Inherited Members
Namespace: UnityEngine.Splines
Assembly: Unity.Splines.dll
Syntax
[Serializable]
public struct BezierKnot : ISerializationCallbackReceiver, IEquatable<BezierKnot>
Constructors
BezierKnot(float3)
Create a new BezierKnot struct.
Declaration
public BezierKnot(float3 position)
Parameters
Type | Name | Description |
---|---|---|
float3 | position | The position of the knot relative to the spline. |
BezierKnot(float3, float3, float3)
Creates a new BezierKnot struct.
Declaration
public BezierKnot(float3 position, float3 tangentIn, float3 tangentOut)
Parameters
Type | Name | Description |
---|---|---|
float3 | position | The position of the knot relative to the spline. |
float3 | tangentIn | The leading tangent to this knot. |
float3 | tangentOut | The following tangent to this knot. |
BezierKnot(float3, float3, float3, quaternion)
Create a new BezierKnot struct.
Declaration
public BezierKnot(float3 position, float3 tangentIn, float3 tangentOut, quaternion rotation)
Parameters
Type | Name | Description |
---|---|---|
float3 | position | The position of the knot relative to the spline. |
float3 | tangentIn | The leading tangent to this knot. |
float3 | tangentOut | The following tangent to this knot. |
quaternion | rotation | The rotation of the knot relative to the spline. |
Fields
Position
The position of the knot. On a cubic Bezier curve, this is equivalent to P0 or P3, depending on whether this knot is forming the first or second control point of the curve.
Declaration
public float3 Position
Field Value
Type | Description |
---|---|
float3 |
Rotation
Rotation of the knot.
Declaration
public quaternion Rotation
Field Value
Type | Description |
---|---|
quaternion |
TangentIn
The tangent vector that leads into this knot. On a cubic Bezier curve, this value is used to calculate P2 when used as the second knot in a curve.
Declaration
public float3 TangentIn
Field Value
Type | Description |
---|---|
float3 |
TangentOut
The tangent vector that follows this knot. On a cubic Bezier curve, this value is used to calculate P1 when used as the first knot in a curve.
Declaration
public float3 TangentOut
Field 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 |
---|---|
bool | Returns true when |
Overrides
Equals(BezierKnot)
Compare two knots for equality.
Declaration
public bool Equals(BezierKnot other)
Parameters
Type | Name | Description |
---|---|---|
BezierKnot | other | The knot to compare against. |
Returns
Type | Description |
---|---|
bool | Returns true when the position, tangents, and rotation of each knot are identical. |
GetHashCode()
Calculate a hash code for this knot.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for the knot. |
Overrides
OnAfterDeserialize()
See ISerializationCallbackReceiver.
Declaration
public void OnAfterDeserialize()
OnBeforeSerialize()
See ISerializationCallbackReceiver.
Declaration
public void OnBeforeSerialize()
ToString()
Create a string with the values of this knot.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A summary of the values contained by this knot. |
Overrides
Transform(float4x4)
Multiply the position and tangents by a matrix.
Declaration
public BezierKnot Transform(float4x4 matrix)
Parameters
Type | Name | Description |
---|---|---|
float4x4 | matrix | The matrix to multiply. |
Returns
Type | Description |
---|---|
BezierKnot | A new BezierKnot multiplied by matrix. |
Operators
operator +(BezierKnot, float3)
Knot position addition. This operation only applies to the position, tangents and rotation are unmodified.
Declaration
public static BezierKnot operator +(BezierKnot knot, float3 rhs)
Parameters
Type | Name | Description |
---|---|---|
BezierKnot | knot | The target knot. |
float3 | rhs | The value to add. |
Returns
Type | Description |
---|---|
BezierKnot | A new BezierKnot where position is the sum of knot.position and rhs. |
operator -(BezierKnot, float3)
Knot position subtraction. This operation only applies to the position, tangents and rotation are unmodified.
Declaration
public static BezierKnot operator -(BezierKnot knot, float3 rhs)
Parameters
Type | Name | Description |
---|---|---|
BezierKnot | knot | The target knot. |
float3 | rhs | The value to subtract. |
Returns
Type | Description |
---|---|
BezierKnot | A new BezierKnot where position is the sum of knot.position minus rhs. |