# Of Planes and Triangles

## Planes

A plane is a flat two-dimensional surface that extends infinitely in both directions. The well known standard plane is
the Cartesian product *points* of the plane, or its elements, are of
the form

## Two-Dimensional Subspaces

Now consider the standard three-dimensional Euclidean vector space

### Linear Independence

Two vectors

or, in other words, if the only representation of the zero vector is trivial.

Obviously, an analogous definition is valid in arbitrary dimensions.

Geometrically speaking, *east* and *north* are linearly independent, thus completely sufficient to describe the position of every
element in the entire plane. Such vectors are also called a generating system for the vector space, or a basis of the
vector space.

The three vectors

### Orthogonality

Two vectors

## Space Representations

### Parametric Description

As two-dimensional subspaces of the three-dimensional Euclidean space, a plane *point* and two vectors: *point*

### Normal Form

The preferred way to define a plane

Let

The following figure is once again taken from Wikipedia:

#### Computing the normal vector of a plane

If a plane is given by its parametric form,

Or, if you don’t like tensors, you can *cheat* a little bit:

#### The Normal Vector of Triangles

Now why is this so important in games? Well, especially in a 3D engine, which we will eventually elaborate on later in these tutorials, most game objects are rendered using plenty of triangles. Modern GPUs love drawing triangles, and thus polygons are triangulated into triangles (sic!). What do triangles have to do with planes, however? Well, the three points defining a triangle are always in the same plane, i.e., a triangle is always guaranteed to lie on a single plane — at least in standard Euclidean geometry. Thus, knowing the vertices of a triangle, it is easily possible to compute the plane the triangle lies in, which then in return allows for an easy decision whether a given vector lies in the same plane as the triangle, or not.

Another significant application of the above theory becomes apparent when trying to approximate real-world physics by a discrete model, for example when trying to model how light is reflected from a surface. When attempting to reflect light from a surface, the normal vector of that surface must be known. Thus, knowing that game objects can be rendered using triangles, it is essentially important to be able to compute the normal vector of a triangle? Alas, since the three vertices of a triangle define a plane, the same technique as above can be used.

Let *lives* in, all that is left to do is to compute the distance of the plane to the origin of the three-dimensional space,

##### Example

As an example of the above theory, let

The normal vector is the normalized outer product of those two vectors:

To compute the distance to the origin of the three-dimensional space, any one of the three vertices of the triangle can
be used:

Finally, the normal-form equation of the plane the triangle lives in can be written as

## References

- Game Programming Algorithms and Techniques, by Sanjay Madhav
- Lineare Algebra, by Prof. Dr. R. Scharlau
- Tricks of the Windows Game Programming Gurus, by André LaMothe
- Wikipedia