A plane in 3D space can be thought of as a flat surface extending indefinitely in all
directions. It can be described in several different ways. For example by:
● Three points not on a straight line (forming a triangle on the plane)
● A normal and a point on the plane
● A normal and a distance from the origin
In the first case, the three points A, B, and C allow the parametric representation
of the plane P to be given as
For the other two cases, the plane normal is a nonzero vector perpendicular to any
vector in the plane. For a given plane, there are two possible choices of normal,
pointing in opposite directions. When viewing a plane specified by a triangle ABC so
that the three points are ordered counterclockwise, the convention is to define the
plane normal as the one pointing toward the viewer. In this case, the plane normal n
is computed as the cross product n = (B − A) × (C − A). Points on the same side of
the plane as the normal pointing out of the plane are said to be in front of the plane.
The points on the other side are said to be behind the plane.
Given a normal n and a point P on the plane, all points X on the plane can be
categorized by the vector X −P being perpendicular to n, indicated by the dot product
of the two vectors being zero. This perpendicularity gives rise to an implicit equation
for the plane, the point-normal form of the plane:
The dot product is a linear operator, which allows it to be distributed across a subtraction or addition. This expression can therefore be written as n · X = d, where
Planes in arbitrary dimensions are referred to as hyperplanes: planes with one less
dimension than the space they are in. In 2D, hyperplanes correspond to a line; in 3D,
to a plane. Any hyperplane divides the space it is in into two infinite sets of points on
either side of the plane. These two sets are referred to as halfspaces (Figure 3.12). If the
points on the dividing plane are considered included in the halfspace, the halfspace
is closed (otherwise, it is called open). The positive halfspace lies on the side in which
the plane normal points, and the negative halfspace on the opposite side of the plane.
A 2D halfspace is also called a halfplane.
d = n · P, which is the constant-normal form of the plane. When n is unit,
d
equals
the distance of the plane from the origin. If n is not unit,
d
is still the distance, but
now in units of the length of n. When not taking the absolute value, d is interpreted
as a signed distance.
The constant-normal form of the plane equation is also often written componentwise as ax + by + cz − d = 0, where n = (a, b,c) and X = (x, y,z). In this text, the
ax+by+cz−d = 0 form is preferred over its common alternative, ax+by+cz+d = 0,
as the former tends to remove a superfluous negation (for example, when computing
intersections with the plane).
When a plane is precomputed, it is often useful to have the plane normal be a
unit vector. The plane normal is made unit by dividing n (and d, if it has already
been computed) by n = √
a2 + b2 + c2. Having a unit plane normal simplifies
most operations involving the plane. In these cases, the plane equation is said to be
normalized. When a normalized plane equation is evaluated for a given point, the
obtained result is the signed distance of the point from the plane (negative if the
point is behind the plane, otherwise positive).
A plane can also be given in a parameterized form as
where u and v are two independent vectors in the plane and A is a point on the plane. When two planes are not parallel to each other, they intersect in a line. Similarly, three planes — no two parallel to each other — intersect in a single point. The angle between two intersecting planes is referred to as the dihedral angle.
// Returns [a,b,c], representing the line passing through 'point' and having the given 'normal'.
function halfSpace(point, normal) {
console.assert(!isNaN(normal[0]));
return [normal[0], normal[1], -vec2.dot(point, normal)];
}
In addition to the explicit vertex representation, convex polygons can also be
described as the intersection of a finite number of halfspaces. This representation
is convenient for, for example, point containment tests. For the implicit polygon representation, a point lies inside the polygon if it lies inside all halfspaces. Figure 3.16
illustrates a triangle expressed as the intersection of three halfspaces. An alternative
definition for point set convexity is therefore that a point set S is convex if and only if
S is equal to the intersection of all halfspaces that fully contain S. For polygons (and
polyhedra), this is an operative definition in the sense that it can be directly used to
implement a convexity test.
Comentários