refine bezier curve function