Plane Equations

Most of these demos will be presented in 2D, in order to make them easier to interact with, and hopefully a bit easier to understand. Where it's relevant, we'll present the important differences you need to keep in mind in order to adapt these techniques to 3D. Sometimes, these will come with 3D visualizations as well. Even when working in 2D, it makes sense to use some terminology that's more common in 3D settings. For instance, we'll be frequently referring to the edges of a convex polygon as "planes". This is technically correct, since in 2D you can use the same kinds of "plane equations" to define lines as you can for conventional planes in 3D space, and keeping these kinds of analogies in mind can be helpful for working with this yourself.

Planes can be represented in multiple ways. A very convenient form for editing them is by providing points on the plane. If you have a 3D plane, you need 3 points to uniquely define a plane. In 2D, you need two points to uniquely define your plane.

Planes have orientations, a front and a back side. When defining your plane by a set of points, you usually define the orientation of that plane by the ordering of the points. With these two points here, we decide that as you travel from the first point to the second, the area to the right of the line is the "front" side, and the area to the left is the "back". (In 3D, this convention would be in terms of whether points are presented clockwise or counter-clockwise).

A more convenient form for representing planes for geometric computations is the "plane equation". A plane is a shape defined by a point and a normal vector, they are all of the points perpindicular to the normal vector.

The traditional plane equation:(xp)n^=0A plane evaluation function:f(x)=(xp)n^ \begin{align*} \text{The traditional plane equation:} && (x - p) &\cdot \hat n = 0 \ \text{A plane evaluation function:} && f(x) = (x - p) &\cdot \hat n \end{align*}

We have two points p0p_0 and p1p_1 as our input to construct this plane.
The plane’s origin,p=p0We have a displacement vector,d=p1p0And can compute a tangent of the plane,t^=normalize(d)And finally the normal of the plane,n^=(t^.y,t^.x) \begin{align*} \text{The plane's origin,} && p &= \textcolor{grey}{p_0} \ \text{We have a displacement vector,} && \textcolor{8800ff}{d} &= \textcolor{grey}{p_1} - \textcolor{grey}{p_0} \ \text{And can compute a tangent of the plane,} && \textcolor{00aa00}{\hat t} &= \mathrm{normalize}(\textcolor{8800ff}{d}) \ \text{And finally the normal of the plane,} && \textcolor{ff8800}{\hat n} &= (\textcolor{00aa00}{\hat t}.y, -\textcolor{00aa00}{\hat t}.x) \end{align*}

f(x)=(xp)n^ \newcommand\purp[1]{\textcolor{8800ff}{ #1}} \renewcommand\orange[1]{\textcolor{ff8800}{ #1}} \renewcommand\green[1]{\textcolor{00aa00}{ #1}} % \purp{f}(x) = \green{(x - p)} \purp{\cdot} \orange{\hat n}

Every plane divides space in half, and so every plane also corresponds to "half-spaces", all of the area on one side of that plane.

  • If this function is positive, you're in front of the plane, in the front half-space.
  • If this function is negative, you're behind the plane, in the back half-space.
  • If it's zero, you're exactly on the plane.

For computational purposes, we consider a narrow region around the plane. In this demo, it's 0.1 units to either side of the plane.