Bezier
A utility module for working with Bezier curves.
Functions
Lerp
Bezier.Lerp(StartPoint: any,--
Starting point
EndPoint: any,--
End point
AlphaValue: number--
Interpolation alpha from 0 to 1
) → anyLinearly interpolates between two points.
Evaluate
Bezier.Evaluate(ControlPoints: {any},--
Curve control points, minimum of 2
AlphaValue: number--
Position on curve from 0 to 1
) → anyEvaluates a Bezier curve at t using De Casteljau's algorithm.
Quadratic
Bezier.Quadratic(StartPoint: any,--
Start point
ControlPoint: any,--
Handle point
EndPoint: any,--
End point
AlphaValue: number--
Position on curve from 0 to 1
) → anyEvaluates a quadratic Bezier curve (3 points) at t.
Cubic
Bezier.Cubic(StartPoint: any,--
Start point
FirstControlPoint: any,--
First handle point
SecondControlPoint: any,--
Second handle point
EndPoint: any,--
End point
AlphaValue: number--
Position on curve from 0 to 1
) → anyEvaluates a cubic Bezier curve (4 points) at t.
Tangent
Bezier.Tangent(ControlPoints: {any},--
Curve control points, minimum of 2
AlphaValue: number--
Position on curve from 0 to 1
) → anyGets a tangent direction vector/value at t.
For Vector2 and Vector3 points, this returns a unit direction when possible. For other supported types, this returns the packed derivative in that same type.
Split
Bezier.Split(ControlPoints: {any},--
Curve control points, minimum of 2
AlphaValue: number--
Position on curve from 0 to 1
) → {any},{any}--
Left and right control point arrays
Splits a Bezier curve into left and right curves at t.
Sample
Bezier.Sample(ControlPoints: {any},--
Curve control points, minimum of 2
SegmentCount: number--
Number of line segments to generate, minimum 1
) → {any}Samples a Bezier curve into evenly spaced t-steps.
ApproximateLength
Bezier.ApproximateLength(ControlPoints: {any},--
Curve control points, minimum of 2
SegmentCount: number--
Number of segments for approximation, minimum 1
) → numberApproximates curve length by sampling line segments.