cachai.utilities.get_bezier_curve
- cachai.utilities.get_bezier_curve(points, n=20)[source]
Generates a sequence of points along a Bézier curve.
- Parameters
- points
listorarray-like List containing the control points. The control points must me
tupleorarray-likeas (x,y). For quadratic Bézier curve 3 points are needed, for cubic Bézier curve 4 points are needed.- n
int Number of points to generate along the curve (default: 20).
- points
- Returns
numpy.ndarray: 1D array of points (x,y)
Examples
import cachai.utilities as chu curve = chu.get_bezier_curve([(0, 0), (2, 3), (4, 1)], n=10) print(curve)
[[0. 0. ] [0.44444444 0.60493827] [0.88888889 1.08641975] [1.33333333 1.44444444] [1.77777778 1.67901235] [2.22222222 1.79012346] [2.66666667 1.77777778] [3.11111111 1.64197531] [3.55555556 1.38271605] [4. 1. ]]