/Bezier

Bezier curves for the discerning Python user.

Primary LanguagePython

This is a simple implementation of creating 
Bezier curves from a list a control points
in Python. 

from matplotlib import pyplot as plt
from Bezier import bezier_curve

nPoints = 4
points = np.random.rand(nPoints,2)*200
xpoints = [p[0] for p in points]
ypoints = [p[1] for p in points]

xvals, yvals = bezier_curve(points, nTimes=1000)
plt.plot(xvals, yvals)
plt.plot(xpoints, ypoints, "ro")
for nr in range(len(points)):
    plt.text(points[nr][0], points[nr][1], nr)


plt.show()