Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 7

ABSTRACT

A polygon P is called weakly visible if it contains a convex set U such that for every point p
in P there exists a point u in U such that the segment pu lies entirely in P. If U is an edge of P then
P is called edge visible.
To the author's knowledge the problem to triangulate a weakly visible polygon in time linear
with its size, is still an open problem The same is true for an edge visible polygon whose visibility
edge is not known. We present here an algorithm which solves both and ... something more.

Throughout this paper we assume that the cyclic order of the vertices of a polygon P is
defined clockwise. By P[x,y] we denote the part of P's boundary which is included between points
x,y in the cyclic order; a parenthesis instead of a bracket in this notation means that the
corresponding endpoint is not included. We also assume w.l.o.g. that the polygons we deal with are
non-degenerate, i.e. no three vertices are collinear.

A simple polygon P is called weakly visible if it contains a convex set U such that for every
point p in P there is a point u in U such that the segment pu lies entirely in P. We refer to U as a
nucleus of P. In particular, if U coincides with one edge of P then P is called edge visible, and if U
is a single point then P is called starshaped. Both, starshaped and edge visible polygons whose
visibility edge is known, can be triangulated in linear time [ ]. The purpose of this paper is to prove
that

Theorem : A weakly visible polygon can be triangulated in linear time.

We do it by presenting a linear triangulation algorithm. In this algorithm, except for the convexity of
the nucleus no other assumption is made. So, it also triangulates edge visible polygons whose
visibility edge is not known.
The iterested reader may verify that by relaxing the convexity property (of the nucleus) to
monotonicity with respect to a given direction, all the arguments presented here still hold true.
Therefore our algorithm triangulates a wider -than the weakly visible- class of polygons. It
triangulates the simple polygons whose nucleus is monotonous with respect to a given direction.
Let P be a weakly visible polygon and let s be a point inside P. We call visibility set of s the
largest subset of P which is visible by s; clearly this set is a starshaped polygon . As it was proven
in [3], even in the case where P is a simple polygon,

The visibility set of s, in P, can be found in time O( P ) (1)

Let us call shadows those parts of P which are not visible by s (see fig.1) and let us
distinguish between left shadows and right shadows depending on whether in a clockwise scan
they lie on the left or on the right side of the boundary of the visibility polygon of s. Finally we call
fixed polygon a weakly visible polygon whose nucleus intersects with an edge of the polygon.

fig 1
Observe that each shadow of P is either a fixed polygon if it contains nucleus' points in its
interior, or it is an edge visible polygon if it does not. (In fact it is easy to see that at most two
shadows of P may be fixed polygons: if more than two were containing nucleus' points, then at
least two of them would be both left or both right shadows, and this would contradict the convexity
of nucleus.) Since the class of edge visible polygons is a subset of the class of fixed polygons, any
triangulation algorithm for fixed polygons would triangulate edge visible polygons as well.

The visibility polygon of s contains some special edges: the boundaries between this polygon and
the shadows, (edges ht in fig 1). Those edges are neither original edges nor diagonals of P since t
may be a Steiner point (i.e. an interior point of an edge). To triangulate such a polygon we rely on
the following lemma.
Lemma 1 : Let p be a vertex of P which is visible by s. If q is the next vertex of P which is
visible by s, then either p,q are adjacent or pq is a diagonal.
PROOF : Clearly no other vertex of P lies in the triangle which defined by s,p,q for otherwise this
vertex lies either before p or after q on P, and then either s does not see p or it does not see q, a
contradiction. Therefore p sees q , and the lemma holds true.

As soon as we compute the visibility polygon of s by using the algorithm in [3], we may scan
this polygon and, by virtue of lemma 1, we may draw a diagonal between those pairs of vertices
which are consequtive P-vertices in the scanning order of this polygon, but they are not adjacent
vertices of P. Those diagonals along with the original P-edges of the visibility polygon of s form a
starshaped polygon, say S (fig 1, part of unshaded region bounded by thick diagonals), which can
be triangulated in time O( S ). Consider whatever is left out of P by discarding the polygon S: a
collection of disjoint polygons. Each such polygon ,say Q, consists of a part of P's boundary and
one diagonal as by lemma 1. It also contains one or two shadows depending on whether an edge of
it contains one or two Steiner points (figures 2a, 2b respectively).

fig. 2a fig. 2b

Clearly our problem to triangulate P in time O( P ) reduces to the problem of triangulating each
polygon Q in time O( Q ). We shall solve the later in two steps:

step 1. Triangulate the shaded area of Q without drawing any diagonal which has as endpoint the
corresponding Steiner point of this area.

step 2. Triangulate the shaded area of Q which was left non-triangulated by step1, along with its
unshaded area (which is bounded by a diagonal as by lemma 1).

Assume for the moment that for each such polygon Q we can do step1 in time O( Q ).
(How to do it will follow next). To show how to implement step2, let F be a shadow of Q and assume
w.l.o.g. that it is a left shadow. Let also t be its Steiner point, let lr be the P-edge where t belongs,
and let p,q be the first and last vertex of Q respectively. Clearly, if t is the only Steiner point lying
on lr then q=r. Consider a triangulation of F as by step1. Observe that not all of F was triangulated
because the point t ,which was a vertex of F, was ommited. However, this triangulation connects
vertex p with vertex r through a path, say C, which either consists of a single diagonal (the diagonal
pl in the case where p sees l), or it consists of a concave sequence of P-edges and diagonals in the
case where p does not see l (fig 2a). In either case the figure which is delimited by C, by the edge lr,
and by the diagonal pr, is a sail polygon and, as shown by G. Toussaint in [2], it can be
triangulated in time linear with its size.
Possibly Q contains two shadows, F and F'. In this case F is a left shadow, F' is a right
shadow, the edge lr contains two Steiner points t and t' (one for each shadow respectively), and pq
is a diagonal as by lemma 1. In such a case we triangulate F and F' separately, without ever
considering t and t' for possible diagonals. Those triangulations connect p with l and r with q through
paths C and C' respectively, each of which either it consists of a single diagonal or it consists of a
concave path of P-edges and diagonals. Now, the figure delimited by the path C, the edge lr, the
path C', and the diagonal pq, is a sail polygon and it can be triangulated in linear time (fig. 2b).
Note here that the technique we just described (i.e. how to merge the triangulations of two
polygonal parts which lie beside a separating line of a polygon, by making use of the emerging sail
polygon) may be used in other contexts as well. Since no special assumtion was made about the
shape of the polygonal parts, it follows that given the triangulations of each of the polygonal parts,
we can join them together by means of the triangulation of the sail polygon , and so we obtain a
triangulation of the whole polygon. This joining operation is linear with the size of the sail polygon.
(In fact we can further strengthen the technique by dropping the assumption that the separating line
passes from a vertex of the polygon. In such a case the emmerging polygon looks like a mast rather
than a sail, and it is easy to see that it can be triangulated in time linear with its size as well.)

By virtue of the previous discussion to complete the proof of Main Theorem it remains to
prove that

A fixed polygon F can be triangulated in time O( F ) (2)

For this purpose we first introduce a variation of monotone polygons, the broom polygons, along
with a linear triangulation algorithm for them. Then we show how to decompose F into a broom
polygon and a number of edge visible polygons in time O( F ). Finally, to merge the triangulations
of those polygons in order to obtain a triangulation of F, it becomes a routine matter: Based on the
previous discussion, we merge the triangulations of any two adjacent polygonal constituents of F by
making use of the corresponding sail polygon.

Let M = m 1,m2,....,m n be a polygonal line, let l be a straight line not intersecting M, and
let s be a point on l. We denote by qi the angle which is defined by the lines l and sm i. We shall
say that M is monotone ,with respect to s, if there is some vertex m j such that :
qi < qi+1 for i=1,2,....,j-1 and qi > qi+1 for i=j,j+1,....,n .
Note that if m 1=m n then M induces a monotone polygon with respect to s (fig 3a) : the distance

function with respect to which monotonicity is defined, is the angular distance between the lines l
and smi. (Instead of the Euclidean distance from some axis of coordinates which is usually used in

the definition of monotone polygons.)


We define a polygon B to be a broom, with respect to s, if it consists of polygonal chains
M1, M2, ... , Mk such that :
(i) For i=1,2, ,k Mi is monotone w.r. to s.
(ii) For i=1,2,...,k-1 the last vertex of M i coincides with the first vertex of M i+1 and it

corresponds to a left turn in the direction of scanning.


(iii) The first vertex of M1 coincides with the last vertex of M k (fig 3b).

When we scan the boundary of a polygon we can decide in constant time if a certain vertex
corresponds to a left-turn or a right turn in the direction of the scanning. For vertices whose angle q
takes local extremum value we will use the abreviations min-lt, min-rt, max-lt, max-rt, to stand for
local minimum with left turn, local minimum with right turn, e.t.c. Clearly from the above definition
follows that
Except for its first vertex all local minima of a broom are min-lt,
and all its local maxima are max-rt. (3)

LEMMA 1 Let B = { b 1, b2, ... , bn } be a broom polygon w.r. to s, and let m be a min-lt of B. Let

ab and cd, in this order, be the edges where the ray sm intersects the boundary just before and just
after m respectively (fig 2).
(i) If qa < qd then md is a diagonal of B
(ii) If qa > qd then ma is a diagonal of B

PROOF of (i)
By choice of the edges ab and cd, the line segment md cannot intersect neither with B[b,m]
nor with B[m,c]. Also md cannot intersect with B(d,b n], for otherwise some max-lt would exist in the
part of B(d,bn] which lies above this intersection, contradicting (3). Similarly md cannot intersect
with ab since this would contradict our assumption that qa < qd. Hence (i) holds true.

The proof of (ii) is similar.

Observe that by drawing a diagonal as by lemma1, the broom B gets split in two polygons
which are brooms also, and their number of min-lt's altogether is one less than the number of min-
lt's of B. Observe also that a monotone w.r. to s polygon is a broom with no min-lt's. Therefore, by
drawing such a diagonal for each min-lt of B, this gets decomposed into monotone polygons: their
number equals the number of B's max-rt's. These observations lead directly to a triangulation
algorithm for broom polygons.
TRIANGULATE BROOM POLYGON B

Step 1 Scan B and find all min-lt's m i allong with the corresponding vertices a i ,di as by lemma 1.
(Let m i, ai, di i=1,2,...,k be those vertices)

Step 2 For i=1,2,...,k do if qai< qdi then draw diagonal m idi else draw diagonal m iai .
(Let Mi i=1,2,...,k+1 be the monotone polygons delivered by this step)

Step 3 For i=1,2,...,k+1 do TRIANGULATE MONOTONE Mi .

From (3) follows that min-lt's and max-rt's alternate in the scanning order. Thus step1
consists of a single scan of B by making use of a stack as following (see algorithm FIND MIN-LT's):
As long as the angle qr is increasing we push r in the stack (line 2).
As long as qr is decreasing (line 8) , for each r we first manage to establish the relation
qtop > qr > qnext to top (4)

(where "next to top" is the vertex which follows vertex top in the scanning order) by popping from
the stack (lines 3 to 7). If during this process a prior min-lt appears at the top of the stack then
validity of (4) implies that the current vertex r is a d-vertex of that min-lt (as by lemma 1), and so
we record it (line 4). Finally if qr becoms min-lt ,i.e. it fails the test in line 8, the validity of (3)

implies that the top of the stack the a-vertex of the current r : we record it, we mark r, and we switch
to the state of the scanning where q is increasing (line 9). Termination is reached when the last
vertex of B is processed (line 7)
FIND MIN-LT'S IN A BROOM POLYGON B
line
1 {Initialize} r:=1;

2 1 {qr increasing} push(r); r:=r+1; if qr > qr-1 then goto 1 ;

3 2 {establish (3) } while qr < qtop do

4 if top is marked
then top := r;

5 pop;
6 endwhile

7 {termination} if r = ½B½ then terminate ;

8 {qr decreasing} if qr > qr+1 then r:=r+1; goto 2 endif

9 {min-lt encountered} a r:=top; mark r; goto 1 ;

Since each vertex is pushed in the stack at most once, this algorithm is linear. Also steps 2 and 3 of
the algorithm TRIANGULATE BROOM POLYGON B are also linear. We conclude that we can
triangulate a broom polygon B in time O(½B½).

Next we shall show how to decompose a fixed polygon F into a broom polygon B and a
number of edge visible polygons E 1, E2,.... in time O(½F½) (algorithm DECOMPOSE FIXED F

bellow).
Assume that the nucleus of F intersects with the edge f 1f n . The idea is to scan F and eliminate

those parts of it which prevent it from being a broom polygon. Those parts , let us call them
pockets , are due to vertices of F which violate (3), i.e. to vertices that are max-lt's or min-rt's
(see fig. 3).
fig 3
Observe that

In particular, when qr is increasing and we encounter a max-lt ,say h, then the corresponding

pocket extends from h up to the first point t which lies on a subsequent edge uv such that
qu < qh = qt < qv
When qr is is decreasing and we encounter a min-rt

You might also like