bezier
Functionbezier(
control_points: List[Point2D]
) -> Callable[[Point2D, Point2D, float], Point2D]
Create a bezier curve path function with given control points
Supports quadratic (1 control point), cubic (2 control points), or higher-order bezier curves (3+ control points).
Parameters
-
control_points - List of intermediate control points (absolute coordinates) - 1 point: quadratic bezier (p1 → cp → p2) - 2 points: cubic bezier (p1 → cp1 → cp2 → p2) - 3+ points: higher-order bezier curves
Returns
Path function that interpolates along the bezier curve
Examples
# Cubic bezier with curve bulging upward
path_func = bezier([Point2D(50, 200), Point2D(150, 200)])
path_func(Point2D(0, 0), Point2D(200, 0), 0.5)
Point2D(100.0, 150.0) # Point on curve at t=0.5