Constructing Bezier curves
Bezier curves, or B-splines, are a family of curves that are extremely useful in vector graphics – for instance, they are commonly used in high-quality font packages. This is because they are defined by a small number of points that can then be used to inexpensively calculate a large number of points along the curve. This allows detail to be scaled according to the needs of the user.
In this recipe, we’ll learn how to create a simple class representing a Bezier curve and compute a number of points along it.
Getting ready
In this recipe, we will use the NumPy package imported as np
, the Matplotlib pyplot
module imported as plt
, and the comb
routine from the Python Standard Library math
module, imported under the binom
alias:
from math import comb as binom import matplotlib.pyplot as plt import numpy as np
How to do it...
Follow these steps to define a class that represents a Bezier curve that can be used to compute points along...