Calculate bezier curves using bernstein polynomials