def curve3_bezier(p1, p2, p3):
 (x1, y1) = p1
 (x2, y2) = p2
 (x3, y3) = p3
 points = []
 _curve3_recursive_bezier(points, x1, y1, x2, y2, x3, y3)
 (dx, dy) = ((points[0][0] - x1), (points[0][1] - y1))
 if (((dx * dx) + (dy * dy)) > 1e-10):
  points.insert(0, (x1, y1))
 (dx, dy) = ((points[(-1)][0] - x3), (points[(-1)][1] - y3))
 if (((dx * dx) + (dy * dy)) > 1e-10):
  points.append((x3, y3))
 return np.array(points).reshape(len(points), 2)

def curve3_bezier ( p1 , p2 , p3 ) : ( x1 , y1 ) = p1 ( x2 , y2 ) = p2 ( x3 , y3 ) = p3 points = [ ] _curve3_recursive_bezier ( points , x1 , y1 , x2 , y2 , x3 , y3 ) ( dx , dy ) = ( ( points [ 0 ] [ 0 ] - x1 ) , ( points [ 0 ] [ 1 ] - y1 ) ) if ( ( ( dx * dx ) + ( dy * dy ) ) > 1e-10 ) : points . insert ( 0 , ( x1 , y1 ) ) ( dx , dy ) = ( ( points [ ( - 1 ) ] [ 0 ] - x3 ) , ( points [ ( - 1 ) ] [ 1 ] - y3 ) ) if ( ( ( dx * dx ) + ( dy * dy ) ) > 1e-10 ) : points . append ( ( x3 , y3 ) ) return np . array ( points ) . reshape ( len ( points ) , 2 )
generate the vertices for a quadratic bezier curve .