using cos curve for z value calculation from spline on sketching