Let us consider a convex polyhedron and a projection of
it on some viewplane.
If the projection is perspective, let be the viewpoint.
In this case, we assume of course that
is not a point of
.
If the projection is parallel (e.g., orthographic), let
v be a vector giving the direction of the viewpoint. In
the past, we have considered
v and
v to be
equivalent; now, though, we should not, because the question of
which faces are hidden depends on the direction from which we
are looking. See Figure
.
Observation. Because is convex, each face is (a) entirely
visible, (b) entirely hidden, or (c) seen edgewise.
Here (c) means that the plane of the face contains
or is parallel to
v.
For a given face
, here is a
method for computing which among (a), (b), (c) holds. Let's assume
that no three of these vertices are in a straight line and that
no other vertices of the polyhedron are in the plane of this face.
Step 0. If the projection is perspective, let
v
. Thus whether the projection is perspective or
parallel, we have a ``line-of-sight'' vector
v that, if drawn
at
, points away from the polyhedron.
Step 1. Find a normal
N to the face. One way is simply
to let
N
.
Step 2. Choose another vertex of the polyhedron, not
on the given face, and let
w
, a vector that
definitely points inward. Check the sign of the dot product
w
N. If
w
N
, then
N is an inward normal;
define a new normal
N
N. If
w
N
,
then
N is an outward normal already; let
N
N.
Step 3. Check the dot product
v N
.
(a) If
v N
, then the face is visible.
(b) If
v N
, then the face is hidden.
(c) If
v N
, then the face is seen edgewise.
Observe that the viewplane itself is irrelevant for this method
(Figure ).
To make a picture of a convex polyhedron with hidden faces removed, simply plot the image of each visible face. If you have a pen plotter, for example, just compute the images of the vertices of visible faces and plot line segments between them corresponding to the edges of the those faces.
Remark. If three consecutive vertices of a face are allowed to
be collinear, then Step 1 may fail, because the cross product may
be the zero vector. In this case, either try different choices
of three vertices until three are found that are not collinear,
or else let
be the average of all the vertices of
the face and let
N
. (
will automatically be in the
interior of the face.) Similarly, if two different faces are
allowed to lie in one plane, then in Step 2,
may be in the
plane of the given face and not tell you anything about
N;
in this case, instead let
be the average of all the
vertices of the polyhedron (a point definitely not on the given
face).