# Planes

To get a good understanding of planes, we need to have a grasp on the way in which we typically represent lines.

Usually we would represent a line like this with the form:

But we can also represent the same line in terms of too:

In fact, you do not have to represent the function in terms of either or . It is perfectly valid to move both over to one side and pose the relationship as their difference or sum. This is called an implicit function:

So that is four ways to represent the same function! This becomes even more important when we start moving into three dimensions. Consider the function:

This is just another way of saying that the is defined as three times the co-ordinate plus two times the co-ordinate, where the and co-ordinates sit on a flat plane vertically in space.

In this guide, I am going to use a slightly different convention than what most other mathematics visualisations may use, where the axis appears to go up and down. Instead, the axis here extends "inwards" and "outwards", just like it does in OpenGL.

Considering the dependencies that are at play here, also note that we can legitimately represent this function in terms of or as well.

In fact, we can represent the whole thing as three different implicit functions too.

What I have said up to this point carried an important assumption, which was that had a dependency on in the form of . If we relax that restriction and allow any for any co-ordinate, then what you end up with is a plane.

Notice that this plane is really just what we would get if it we took our existing line and then drew it starting from every possible point on the axis.

Note also that in order for the lines to appear to be "on" the plane, we had to shift their co-ordinates too - it would not work if we just applied an translation to the same line. The requisite shift here was to ensure that the lines continued to satisfy the equation defining the plane itself:

The line coming out from the origin was defined by the same equation, starting at the point , which satisfies the equality because .

However, if we want a line to start from , notice what happens in the equation:

In order to make the equality "work", we have to adjust either the co-ordinate or the co-ordinate such that . In this case, we can just tweak the co-ordinate and make that , eg:

As we explored earlier, there are lots of different ways that we could write the equation for this particular plane. However, the equation is sort of a "standard form" for writing equations for planes, generalizable as . As it turns out, this notation has some very useful properties.

The first is what happens when and we treat the remaining coefficients as a vector from the origin.

Notice anything interesting about that vector? The vector that you see appears to point directly outward in the direction that the plane is "facing". That vector has a special name, the normal vector.

In computer graphics, the normal vector is used for all sorts of things.

Importantly, it can tell us pretty easily whether or not a surface is facing towards the camera or away from it. Just take the dot product between the direction that the camera is facing and the normal vector itself. Recall that if two surfaces are perpendicular, then their dot product will be zero. Similarly, if we were to say that for arguments sake a surface was not facing in any or direction and was facing towards the camera in the direction and the camera was likewise only looking straight-on in the, then the dot product will be negative.

If the surface is facing away from the camera, then the dot product will be positive.

You can see that as we rotate a surface around, say around the axis, that eventually the dot product flips around.

Another very handy thing about this notation is what would happen if we tried to find the rate of change of this plane. If we rearrange the form a little we can make some trivial statements aobut how this plane is changing:

Without going into the calculus of it, we can say that changes by a factor of 3 for every change in the . It also changes by a factor of 2 for every change in the direction. With those two facts we can come up with a gradient vector which shows the tangent that the surface is tracing out: . These are the coefficients that we had earlier!

Planes can be a little tough the visualize, so it helps to have a good graps of the three unit planes and their corresponding normal vectors.