(x0, y0, x1, y1, x2, y2, x3, y3, n=40)
return list(zip(*pts))
Return n points along cubiz bezier with given control points.
Return n points along cubiz bezier with given control points.
Return n points along cubiz bezier with given control points .
def _cubicbezier(x0, y0, x1, y1, x2, y2, x3, y3, n=40):
  """Return n points along cubiz bezier with given control points."""
  # from http://rosettacode.org/wiki/Bitmap/B%C3%A9zier_curves/Cubic
  pts = []
  for i in range(n+1):
    t = float(i) / float(n)
    a = (1. - t)**3
    b = 3. * t * (1. - t)**2
    c = 3.0 * t**2 * (1.0 - t)
    d = t**3

    x = float(a * x0 + b * x1 + c * x2 + d * x3)
    y = float(a * y0 + b * y1 + c * y2 + d * y3)
    pts.append((x, y))
  return list(zip(*pts))
def _cubicbezier ( x0 , y0 , x1 , y1 , x2 , y2 , x3 , y3 , n = 40 ) : # from http://rosettacode.org/wiki/Bitmap/B%C3%A9zier_curves/Cubic pts = [ ] for i in range ( n + 1 ) : t = float ( i ) / float ( n ) a = ( 1. - t ) ** 3 b = 3. * t * ( 1. - t ) ** 2 c = 3.0 * t ** 2 * ( 1.0 - t ) d = t ** 3 x = float ( a * x0 + b * x1 + c * x2 + d * x3 ) y = float ( a * y0 + b * y1 + c * y2 + d * y3 ) pts . append ( ( x , y ) ) return list ( zip ( * pts ) )