Graphics Reference
In-Depth Information
the distance of a point
P
from
L
is given by
(
P
v
. This expression relates to
the test for collinearity of points, where three or more points are said to be
collinear
when they all lie on a line. The three points
A
,
B
, and
C
are collinear if and only if
the area of the triangle
ABC
is zero. Letting
m
−
A
)
×
=
(
B
−
A
)
×
(
C
−
A
), collinearity
can be tested by checking if
m
is zero.
Alternatively, if (
m
x
,
m
y
,
m
z
) are the components of
m
the points are collinear if and
only if
m
=
0, or to avoid a square root if
m
·
m
x
| +
m
y
+ |
|
m
z
|
is zero.
3.6
Planes and Halfspaces
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
P
(
u
,
v
)
=
A
+
u
(
B
−
A
)
+
v
(
C
−
A
).
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
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
=
(
B
−
A
)
×
(
C
−
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:
−
n
·
(
X
−
P
)
=
0.
The dot product is a
linear
operator, which allows it to be distributed across a sub-
traction or addition. This expression can therefore be written as
n
·
=
X
d
, where