# Galaxy-brain math: part 4, projective geometry

# Recap

In Part 1 we saw how reframing concepts in math can lead to new and interesting ways of seeing the world. In Part 2 we applied the reframing idea to familiar ideas from geometry and found a deep connection between lines and planes and vectors. Part 3 showed us how we can take this reframing idea a step further and how it can be a powerful tool.

Now, it’s time for us to put the cherry on top.

# Seeing infinity

The tricky part about projecting images onto an projective plane is that it can be hard to figure out how far away something is. Sometimes it can be hard to tell how far away something is in a photograph.

*If you want to search for more photos like these, the magic keywords are “forced perspective”*

Although we can give 2 numbers as the coordinates for where something is in a plane, when it comes to projection we need a third number to help us capture the concept of distance. The math folks call it homogeneous coordinates. Instead of (x, y) as your coordinates, we have (x, y, w). And that works great, because now we have more information about the real world from our image. The w coordinate has to do with distance; if w is 5, and your camera goes from 5 meters away from the projective plane to 1 meter away, then your new coordinates look like (x / w, y / w, 1). For normal objects, w is not zero.

So what happens if w *is* zero?

Hold that thought for a second, and let’s consider a seemingly unrelated idea.

In geometry class, you might remember hearing that two parallel lines never intersect. Well, that’s true for the type of geometry you learned in secondary school, called *Euclidean geometry*. Unfortunately for artists and photographers, it’s pretty obvious that parallel lines *look* like they intersect in the distance.

The geometry we learned from secondary school won’t help us here. We need a different understanding, *projective geometry*, to make things work. And to know what that geometry means, we need to think carefully about *where* the parallel lines seem to intersect. If you look closely, you’ll notice they seem to intersect at a point off in the distance, far from where we are. To be precise, they seem to intersect *infinitely* far away from us. The vanishing point looks like it’s infinitely far away.

Remember how we talked about lines in the projective plane, and how we could represent those lines with vectors? And how you could figure out where two lines in the projective plane intersect if you take their vectors’ cross-products?

Turns out this idea works even if the lines in the projective plane are *parallel*. You figure out where their vectors are, find the cross-product of these vectors, and you end up with a vector that is of the form (x, y, 0). x and y might be nonzero, but the last coordinate w is zero. You get a point somewhere on your image, but it looks infinitely far away.

Points like these are called *points at infinity* because they appear infinitely far away from us. These are not the points you learned about in geometry class, because all the points there have coordinates with finite numbers. Points at infinity are *beyond* the infinite number of points that the Euclidean plane already has. They’re beyond the geometry that we’re used to.

Connect two points at infinity and you get a *line at infinity*. Two points determine a line.

The magical part of homogeneous coordinates is that we can still represent a point that looks infinitely far away without needing to use infinity in our coordinates. That’s why we can still see the vanishing point even though it looks infinitely far away in pictures.

And *that*, my friend, is why vanishing points work the way they do.