Topology and complex analysis for the unsuspecting game dev
gamedevnotesblog.wordpress.com
gamedevnotesblog.wordpress.com
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.
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).
Which is only possible because storing a number in [-1, 1] in a float is wasting a bit of space, but everyone does it.
Which has an additional benefit, namely that the unit quaternions q and -q represent the same rotation, so there's no need to store the sign bit.
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
https://onlinelibrary.wiley.com/doi/full/10.1111/j.1467-8659...
It can't be a homeomorphism as one space is Hausdorff and the other very much isn't.