Added drawCurve api from stackoverflow