isnt you start with a simple curve and make it work and later add 3d transform functions on it,maybe function that bends it to look like its on inside of a sphere?

simplest do circles/sphere

next one,find a curve thats suitable and if x and y matches curves x and y,draw in different color?

y=c1*x^4+c2*x^3+c3*x^2+c4*line ;c1,c2,c3,c4 constants