C# Class BezierCurves.BezierCurve3D

Inheritance: UnityEngine.MonoBehaviour
Show file Open project: dbrizov/Unity-BezierCurves Class Usage Examples

Public Methods

Method Description
AddKeyPoint ( ) : BezierPoint3D

Adds a key point at the end of the curve

AddKeyPointAt ( int index ) : BezierPoint3D

Add a key point at a specified index

GetApproximateLength ( ) : float
GetApproximateLengthOfCubicCurve ( BezierPoint3D startPoint, BezierPoint3D endPoint, int sampling ) : float
GetApproximateLengthOfCubicCurve ( Vector3 startPosition, Vector3 endPosition, Vector3 startTangent, Vector3 endTangent, int sampling ) : float
GetBinormal ( float time, Vector3 up ) : Vector3
GetBinormalOnCubicCurve ( float time, Vector3 up, BezierPoint3D startPoint, BezierPoint3D endPoint ) : Vector3
GetBinormalOnCubicCurve ( float time, Vector3 up, Vector3 startPosition, Vector3 endPosition, Vector3 startTangent, Vector3 endTangent ) : Vector3
GetCubicSegment ( float time, BezierPoint3D &startPoint, BezierPoint3D &endPoint, float &timeRelativeToSegment ) : void
GetNormal ( float time, Vector3 up ) : Vector3
GetNormalOnCubicCurve ( float time, Vector3 up, BezierPoint3D startPoint, BezierPoint3D endPoint ) : Vector3
GetNormalOnCubicCurve ( float time, Vector3 up, Vector3 startPosition, Vector3 endPosition, Vector3 startTangent, Vector3 endTangent ) : Vector3
GetPoint ( float time ) : Vector3

Evaluates a position along the curve at a specified normalized time [0, 1]

GetPointOnCubicCurve ( float time, BezierPoint3D startPoint, BezierPoint3D endPoint ) : Vector3
GetPointOnCubicCurve ( float time, Vector3 startPosition, Vector3 endPosition, Vector3 startTangent, Vector3 endTangent ) : Vector3
GetRotation ( float time, Vector3 up ) : Quaternion
GetRotationOnCubicCurve ( float time, Vector3 up, BezierPoint3D startPoint, BezierPoint3D endPoint ) : Quaternion
GetRotationOnCubicCurve ( float time, Vector3 up, Vector3 startPosition, Vector3 endPosition, Vector3 startTangent, Vector3 endTangent ) : Quaternion
GetTangent ( float time ) : Vector3
GetTangentOnCubicCurve ( float time, BezierPoint3D startPoint, BezierPoint3D endPoint ) : Vector3
GetTangentOnCubicCurve ( float time, Vector3 startPosition, Vector3 endPosition, Vector3 startTangent, Vector3 endTangent ) : Vector3
RemoveKeyPointAt ( int index ) : bool

Removes a key point at a specified index

Protected Methods

Method Description
OnDrawGizmos ( ) : void

Method Details

AddKeyPoint() public method

Adds a key point at the end of the curve
public AddKeyPoint ( ) : BezierPoint3D
return BezierPoint3D

AddKeyPointAt() public method

Add a key point at a specified index
public AddKeyPointAt ( int index ) : BezierPoint3D
index int The index at which the key point will be added
return BezierPoint3D

GetApproximateLength() public method

public GetApproximateLength ( ) : float
return float

GetApproximateLengthOfCubicCurve() public static method

public static GetApproximateLengthOfCubicCurve ( BezierPoint3D startPoint, BezierPoint3D endPoint, int sampling ) : float
startPoint BezierPoint3D
endPoint BezierPoint3D
sampling int
return float

GetApproximateLengthOfCubicCurve() public static method

public static GetApproximateLengthOfCubicCurve ( Vector3 startPosition, Vector3 endPosition, Vector3 startTangent, Vector3 endTangent, int sampling ) : float
startPosition UnityEngine.Vector3
endPosition UnityEngine.Vector3
startTangent UnityEngine.Vector3
endTangent UnityEngine.Vector3
sampling int
return float

GetBinormal() public method

public GetBinormal ( float time, Vector3 up ) : Vector3
time float
up UnityEngine.Vector3
return UnityEngine.Vector3

GetBinormalOnCubicCurve() public static method

public static GetBinormalOnCubicCurve ( float time, Vector3 up, BezierPoint3D startPoint, BezierPoint3D endPoint ) : Vector3
time float
up UnityEngine.Vector3
startPoint BezierPoint3D
endPoint BezierPoint3D
return UnityEngine.Vector3

GetBinormalOnCubicCurve() public static method

public static GetBinormalOnCubicCurve ( float time, Vector3 up, Vector3 startPosition, Vector3 endPosition, Vector3 startTangent, Vector3 endTangent ) : Vector3
time float
up UnityEngine.Vector3
startPosition UnityEngine.Vector3
endPosition UnityEngine.Vector3
startTangent UnityEngine.Vector3
endTangent UnityEngine.Vector3
return UnityEngine.Vector3

GetCubicSegment() public method

public GetCubicSegment ( float time, BezierPoint3D &startPoint, BezierPoint3D &endPoint, float &timeRelativeToSegment ) : void
time float
startPoint BezierPoint3D
endPoint BezierPoint3D
timeRelativeToSegment float
return void

GetNormal() public method

public GetNormal ( float time, Vector3 up ) : Vector3
time float
up UnityEngine.Vector3
return UnityEngine.Vector3

GetNormalOnCubicCurve() public static method

public static GetNormalOnCubicCurve ( float time, Vector3 up, BezierPoint3D startPoint, BezierPoint3D endPoint ) : Vector3
time float
up UnityEngine.Vector3
startPoint BezierPoint3D
endPoint BezierPoint3D
return UnityEngine.Vector3

GetNormalOnCubicCurve() public static method

public static GetNormalOnCubicCurve ( float time, Vector3 up, Vector3 startPosition, Vector3 endPosition, Vector3 startTangent, Vector3 endTangent ) : Vector3
time float
up UnityEngine.Vector3
startPosition UnityEngine.Vector3
endPosition UnityEngine.Vector3
startTangent UnityEngine.Vector3
endTangent UnityEngine.Vector3
return UnityEngine.Vector3

GetPoint() public method

Evaluates a position along the curve at a specified normalized time [0, 1]
public GetPoint ( float time ) : Vector3
time float The normalized length at which we want to get a position [0, 1]
return UnityEngine.Vector3

GetPointOnCubicCurve() public static method

public static GetPointOnCubicCurve ( float time, BezierPoint3D startPoint, BezierPoint3D endPoint ) : Vector3
time float
startPoint BezierPoint3D
endPoint BezierPoint3D
return UnityEngine.Vector3

GetPointOnCubicCurve() public static method

public static GetPointOnCubicCurve ( float time, Vector3 startPosition, Vector3 endPosition, Vector3 startTangent, Vector3 endTangent ) : Vector3
time float
startPosition UnityEngine.Vector3
endPosition UnityEngine.Vector3
startTangent UnityEngine.Vector3
endTangent UnityEngine.Vector3
return UnityEngine.Vector3

GetRotation() public method

public GetRotation ( float time, Vector3 up ) : Quaternion
time float
up UnityEngine.Vector3
return UnityEngine.Quaternion

GetRotationOnCubicCurve() public static method

public static GetRotationOnCubicCurve ( float time, Vector3 up, BezierPoint3D startPoint, BezierPoint3D endPoint ) : Quaternion
time float
up UnityEngine.Vector3
startPoint BezierPoint3D
endPoint BezierPoint3D
return UnityEngine.Quaternion

GetRotationOnCubicCurve() public static method

public static GetRotationOnCubicCurve ( float time, Vector3 up, Vector3 startPosition, Vector3 endPosition, Vector3 startTangent, Vector3 endTangent ) : Quaternion
time float
up UnityEngine.Vector3
startPosition UnityEngine.Vector3
endPosition UnityEngine.Vector3
startTangent UnityEngine.Vector3
endTangent UnityEngine.Vector3
return UnityEngine.Quaternion

GetTangent() public method

public GetTangent ( float time ) : Vector3
time float
return UnityEngine.Vector3

GetTangentOnCubicCurve() public static method

public static GetTangentOnCubicCurve ( float time, BezierPoint3D startPoint, BezierPoint3D endPoint ) : Vector3
time float
startPoint BezierPoint3D
endPoint BezierPoint3D
return UnityEngine.Vector3

GetTangentOnCubicCurve() public static method

public static GetTangentOnCubicCurve ( float time, Vector3 startPosition, Vector3 endPosition, Vector3 startTangent, Vector3 endTangent ) : Vector3
time float
startPosition UnityEngine.Vector3
endPosition UnityEngine.Vector3
startTangent UnityEngine.Vector3
endTangent UnityEngine.Vector3
return UnityEngine.Vector3

OnDrawGizmos() protected method

protected OnDrawGizmos ( ) : void
return void

RemoveKeyPointAt() public method

Removes a key point at a specified index
public RemoveKeyPointAt ( int index ) : bool
index int The index of the key point that will be removed
return bool