What is a good computer method for deciding whether
a point
in
R
is in the interior of a
triangle, or more generally, any convex polygon?
If the polygon has
vertices, call them
and
let
. Then the sides are
for
. Here is a method:
(*)
is in the interior of the polygon
for each
,
is to the right of
as seen from
, or
else for each
,
is to the
left of
as seen from
. Computationally:
(**)
is in the interior of the polygon
all determinants
have the same sign.
The reason why (*) is equivalent to (**) is contained in
Proposition 1 of §4. Of course, if any determinant
is zero,
is on the boundary.