Correction: you would need to add PI, not 2pi, to transform an interval ranging from from -pi..pi, to the range of 0..2pi. In general to convert from a signed -n..n, range to an unsigned 0..2n range add 1/2 the range, 1n in this case, or 1pi in the situation above.The transform I mentioned is not linear: With atan2 giving you angles in the range [+pi,-pi) where [+pi,0] is as desired, but (0,-pi) should be (2pi,pi) instead, you have to add 2pi for all resulting angles less than 0. As pseudo code:

result := angle < 0 ? 2pi+angle : angle w/ angle := atan2(-x, z)

Some day I'll learn not to spout my mouth off before coffee time Thanks for the correction on my correction.