Skip to main content

Bezier

A utility module for working with Bezier curves.

Functions

Lerp

Bezier.Lerp(
StartPointany,--

Starting point

EndPointany,--

End point

AlphaValuenumber--

Interpolation alpha from 0 to 1

) → any

Linearly interpolates between two points.

Evaluate

Bezier.Evaluate(
ControlPoints{any},--

Curve control points, minimum of 2

AlphaValuenumber--

Position on curve from 0 to 1

) → any

Evaluates a Bezier curve at t using De Casteljau's algorithm.

Quadratic

Bezier.Quadratic(
StartPointany,--

Start point

ControlPointany,--

Handle point

EndPointany,--

End point

AlphaValuenumber--

Position on curve from 0 to 1

) → any

Evaluates a quadratic Bezier curve (3 points) at t.

Cubic

Bezier.Cubic(
StartPointany,--

Start point

FirstControlPointany,--

First handle point

SecondControlPointany,--

Second handle point

EndPointany,--

End point

AlphaValuenumber--

Position on curve from 0 to 1

) → any

Evaluates a cubic Bezier curve (4 points) at t.

Tangent

Bezier.Tangent(
ControlPoints{any},--

Curve control points, minimum of 2

AlphaValuenumber--

Position on curve from 0 to 1

) → any

Gets 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

AlphaValuenumber--

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

SegmentCountnumber--

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

SegmentCountnumber--

Number of segments for approximation, minimum 1

) → number

Approximates curve length by sampling line segments.

Show raw api
{
    "functions": [
        {
            "name": "Lerp",
            "desc": "Linearly interpolates between two points.",
            "params": [
                {
                    "name": "StartPoint",
                    "desc": "Starting point",
                    "lua_type": "any"
                },
                {
                    "name": "EndPoint",
                    "desc": "End point",
                    "lua_type": "any"
                },
                {
                    "name": "AlphaValue",
                    "desc": "Interpolation alpha from 0 to 1",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 129,
                "path": "src/Packages/Bezier/init.luau"
            }
        },
        {
            "name": "Evaluate",
            "desc": "Evaluates a Bezier curve at t using De Casteljau's algorithm.",
            "params": [
                {
                    "name": "ControlPoints",
                    "desc": "Curve control points, minimum of 2",
                    "lua_type": "{any}"
                },
                {
                    "name": "AlphaValue",
                    "desc": "Position on curve from 0 to 1",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 159,
                "path": "src/Packages/Bezier/init.luau"
            }
        },
        {
            "name": "Quadratic",
            "desc": "Evaluates a quadratic Bezier curve (3 points) at t.",
            "params": [
                {
                    "name": "StartPoint",
                    "desc": "Start point",
                    "lua_type": "any"
                },
                {
                    "name": "ControlPoint",
                    "desc": "Handle point",
                    "lua_type": "any"
                },
                {
                    "name": "EndPoint",
                    "desc": "End point",
                    "lua_type": "any"
                },
                {
                    "name": "AlphaValue",
                    "desc": "Position on curve from 0 to 1",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 177,
                "path": "src/Packages/Bezier/init.luau"
            }
        },
        {
            "name": "Cubic",
            "desc": "Evaluates a cubic Bezier curve (4 points) at t.",
            "params": [
                {
                    "name": "StartPoint",
                    "desc": "Start point",
                    "lua_type": "any"
                },
                {
                    "name": "FirstControlPoint",
                    "desc": "First handle point",
                    "lua_type": "any"
                },
                {
                    "name": "SecondControlPoint",
                    "desc": "Second handle point",
                    "lua_type": "any"
                },
                {
                    "name": "EndPoint",
                    "desc": "End point",
                    "lua_type": "any"
                },
                {
                    "name": "AlphaValue",
                    "desc": "Position on curve from 0 to 1",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 192,
                "path": "src/Packages/Bezier/init.luau"
            }
        },
        {
            "name": "Tangent",
            "desc": "Gets a tangent direction vector/value at t.\n\nFor Vector2 and Vector3 points, this returns a unit direction when possible.\nFor other supported types, this returns the packed derivative in that same type.",
            "params": [
                {
                    "name": "ControlPoints",
                    "desc": "Curve control points, minimum of 2",
                    "lua_type": "{any}"
                },
                {
                    "name": "AlphaValue",
                    "desc": "Position on curve from 0 to 1",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 207,
                "path": "src/Packages/Bezier/init.luau"
            }
        },
        {
            "name": "Split",
            "desc": "Splits a Bezier curve into left and right curves at t.",
            "params": [
                {
                    "name": "ControlPoints",
                    "desc": "Curve control points, minimum of 2",
                    "lua_type": "{any}"
                },
                {
                    "name": "AlphaValue",
                    "desc": "Position on curve from 0 to 1",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "Left and right control point arrays",
                    "lua_type": "{any}, {any}"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 239,
                "path": "src/Packages/Bezier/init.luau"
            }
        },
        {
            "name": "Sample",
            "desc": "Samples a Bezier curve into evenly spaced t-steps.",
            "params": [
                {
                    "name": "ControlPoints",
                    "desc": "Curve control points, minimum of 2",
                    "lua_type": "{any}"
                },
                {
                    "name": "SegmentCount",
                    "desc": "Number of line segments to generate, minimum 1",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{any}"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 277,
                "path": "src/Packages/Bezier/init.luau"
            }
        },
        {
            "name": "ApproximateLength",
            "desc": "Approximates curve length by sampling line segments.",
            "params": [
                {
                    "name": "ControlPoints",
                    "desc": "Curve control points, minimum of 2",
                    "lua_type": "{any}"
                },
                {
                    "name": "SegmentCount",
                    "desc": "Number of segments for approximation, minimum 1",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 304,
                "path": "src/Packages/Bezier/init.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Bezier",
    "desc": "A utility module for working with Bezier curves.",
    "source": {
        "line": 6,
        "path": "src/Packages/Bezier/init.luau"
    }
}