Converted quad_bezier example to function