Homogeneous coordinates

Did you know about homogeneous coordinates? I had to use them while programming something and it turns out they're pretty interesting, at least for nerds. They are a mathematical concept for dealing with spaces that contain points at infinity, and have other useful properties. In fact, Euclidean spaces are a subset of homogeneous space.

Parallel rails.

Parallel rails: clearly separate close to the observer, but do they cross each other at infinite distance? (Let's ignore for the moment that there's a bend in the track further down the line!)

Source: Tomasz Sienicki [CC-BY-SA-3.0], via Wikimedia Commons

The train track above has parallel rails, but if you look along the track you see the rails converging. How far away do they converge? If you got an impossible (non-diffraction-limited) telescope and looked further and further down the line, you would find that they never cross, but seem to be getting closer and closer together from the perspective of the observer. In normal Euclidean space (points represented by coordinates x, y, z, whatever) the parallel tracks appear to cross at infinity (∞).

Points at infinity are pretty useless for calculations. If you were to take the space on which the tracks were defined and stretch it uniformly in all directions, the point at (∞, ∞) would not change: 2∞ is still just ∞. The relationship between the non-infinity and infinity points in your space would warp.

Homogeneous coordinate systems get around this problem by introducing an additional coordinate. Instead of the Euclidean (x, y) coordinates, you have (x', y', w). Here, x is related to x' by x = x' / w (and y = y' / w). Now the infinities are gone, because you can represent infinity in homogeneous coordinates by using w = 0 (because anything divided by 0 approaches infinity).

So what? Well, it turns out that homogeneous coordinates have a useful property. The homogeneous coordinate (1, 2, 3) in Euclidean space is (1 / 3, 2 / 3). Doubling the homogeneous coordinate to (2, 4, 6), the equivalent Euclidean point is still (1 / 3, 2 / 3). Homogeneous coordinates are scale invariant, meaning that stretching or squeezing the space in a uniform way does nothing to the relationship between points defined on that space. This is useful for CAD applications and other types of 3D modelling where you might try to fit some projection of a 3D surface (e.g. a sphere) onto a 2D plane (e.g. a computer screen).

At some point you will still have to display your space in Euclidean coordinates so your eyes or your computer monitor can see/display it, and then the infinities come back and you see again the effects of perspective. But homogeneous coordinates allow you to scale and rotate sets of points without losing the relationship between those points.

Update: I discovered a similar inverse coordinate system used for representing linear, time invariant continuous time systems: descriptor state space (contrast to standard ABCD matrices).