Anonymous user
Bitmap/Bézier curves/Cubic: Difference between revisions
→{{header|Python}}
Line 309:
{{works with|Python|3.1}}
Extending the example given [[Bresenham
<lang python>def cubicbezier(self, x0, y0, x1, y1, x2, y2, x3, y3, n=20):
pts = [
for i in range(n+1):
t = i / n
a =
b = 3. * t *
c = 3.0 *
d =
x = int(a * x0 + b * x1 + c * x2 + d * x3)
y = int(a * y0 + b * y1 + c * y2 + d * y3)
pts
for i in range(n):
Bitmap.cubicbezier = cubicbezier
|