Tweak polyline position direction. Move function to convert from spherical to cartesian coordinates to built-in functions.