That's an awfully complicated explanation for what seems a simple process.
The idea here is that you have a unit vector represented by three numbers, and you want to represent it as two numbers to save space.
Since it's a unit vector, it obeys
x^2 + y^2 + z^2 = 1
so if you have any two of x,y,z, you can get the third, except you need to store its sign somewhere. Their scheme for storing the sign loses some precision, since it maps the sphere into half the disk, costing one bit of precision. This isn't lossless. So you could do equally well with some other encoding to store that one sign bit.
I've seen this done for quaternions, where you have a 4-value unit vector. Same idea.
I mean, the point was probably to teach some complex analysis and topology along the way.
You could just x += 2*sgn(x) if z < 0, sacrificing the least significant bit of x in a way that doesn't require any bit hacks (so on restoration, z < 0 iff abs(x) >= 2, and the excess +/-2 is easy to remove from x since the real x <= 1).
If we are using floats, couldn't we just store the sign of z in the sign bit of the exponent of x with no loss of precision since it should always be negative for a number in [-1, 1].
Which is only possible because storing a number in [-1, 1] in a float is wasting a bit of space, but everyone does it.
complex analysis means to me ... analysis. cauchy-riemann, laurent series, residue theorem, etc. i only skimmed but this looks like just complex numbers.
on the other hand here's a cool use of holomorphic maps (analytic in the plane or entire or differentiable at every point) to construct barycentric coordinates
Having done a lot of real analysis as an undergrad, my one complex analysis course was fairly different. We spent most of the semester proving stuff that didn’t have any analogue in real analysis. But sure the basics are the same and a lot of tricks from real analysis still apply.
I enjoyed my complex analysis course quite a bit, but I was lacking motivation a bit because the applications in CS were not as obvious to me, compared to real analysis. Maybe I lacked imagination however :D
The idea here is that you have a unit vector represented by three numbers, and you want to represent it as two numbers to save space. Since it's a unit vector, it obeys
so if you have any two of x,y,z, you can get the third, except you need to store its sign somewhere. Their scheme for storing the sign loses some precision, since it maps the sphere into half the disk, costing one bit of precision. This isn't lossless. So you could do equally well with some other encoding to store that one sign bit.I've seen this done for quaternions, where you have a 4-value unit vector. Same idea.