Module src.util.bezier_interpolator

Module for interpolating values with two dimensional bezier curves

Classes

class BezierInterpolator (p_1: Tuple[float, float], p_2: Tuple[float, float])

Interpolates values with two dimensional cubic bezier curve

The curve B \colon [0,1] \to \mathbb{R}^2, where B(t)=(x(t), y(t)) is defined by the static control points, p_0=[0,1]^2 and p_3=[0,1]^2, and the itermediate control points p_1 \in [0,1]^2 and p_2 \in [0,1]^2.

By using y(t) and the inverse of x(t) we can interpolate an input value [0, 1] to an output value also on [0, 1] with the interpolate() method.

Args

p_1
The first intermediate control point, P_1.
p_2
The second intermediate control point, P_2.

Methods

def interpolate(self, x: float) ‑> float

Interpolates input with given bezier curve

Takes input value x, and returns the corresponding y value on the bezier curve defined by the control points.

Args

x
the value we want to interpolate [0, 1].

Returns

The interpoalted value, also [0, 1].