Can it be that your surface is folded back on it self because you use an atan function instead of atan2?

I don’t know if atan2 is available now, but it wasn’t before, so I used to calculate it myself with a Calculator filter:

if(coordsX>0,atan(coordsY/coordsX), if(coordsX<0, if(coordsY<0,atan(coordsY/coordsX)-4*atan(1),atan(coordsY/coordsX) +4 *atan(1)), if(coordsY>0, 2 *atan(1), if(coordsY<0, -2 *atan(1),0))))

Then apply a [-pi, pi] threshold on the resulting angle (which I called theta).

Finally I apply this Calculator (which you may have already found here):

Coords_flat = sqrt(coordsX^2+coordsZ^2) * theta * iHat+coordsY * jHat+0 * kHat

You will need to change your coordsX,Y,Z to fit your cylinder orientation of course.