Utility functions related to Bézier curves.
Functions
bezier
(points)[source]¶Classic implementation of a bezier curve.
points (np.ndarray) – points defining the desired bezier curve.
function describing the bezier curve.
typing.Callable[[float], typing.Union[int, typing.Iterable]]
diag_to_matrix
(l_and_u, diag)[source]¶Converts array whose rows represent diagonal entries of a matrix into the matrix itself. See scipy.linalg.solve_banded
l_and_u (Tuple[int, int]) –
diag (numpy.ndarray) –
numpy.ndarray
get_smooth_handle_points
(points)[source]¶Given some anchors (points), compute handles so the resulting bezier curve is smooth.
points (np.ndarray) – Anchors.
Computed handles.
typing.Tuple[np.ndarray, np.ndarray]
integer_interpolate
(start, end, alpha)[source]¶alpha is a float between 0 and 1. This returns an integer between start and end (inclusive) representing appropriate interpolation between them, along with a “residue” representing a new proportion between the returned integer and the next one of the list.
For example, if start=0, end=10, alpha=0.46, This would return (4, 0.6).
start (float) –
end (float) –
alpha (float) –
int
interpolate
(start, end, alpha)[source]¶start (int) –
end (int) –
alpha (float) –
float
inverse_interpolate
(start, end, value)[source]¶start (float) –
end (float) –
value (float) –
numpy.ndarray
is_closed
(points)[source]¶points (Tuple[numpy.ndarray, numpy.ndarray]) –
bool
match_interpolate
(new_start, new_end, old_start, old_end, old_value)[source]¶new_start (float) –
new_end (float) –
old_start (float) –
old_end (float) –
old_value (float) –
numpy.ndarray
partial_bezier_points
(points, a, b)[source]¶Given an array of points which define bezier curve, and two numbers 0<=a<b<=1, return an array of the same size, which describes the portion of the original bezier curve on the interval [a, b].
This algorithm is pretty nifty, and pretty dense.
points (np.ndarray) – set of points defining the bezier curve.
a (float) – lower bound of the desired partial bezier curve.
b (float) – upper bound of the desired partial bezier curve.
Set of points defining the partial bezier curve.
np.ndarray