scispace - formally typeset
Open AccessJournal ArticleDOI

An O ( n log log n )-time algorithm for triangulating a simple polygon

Robert E. Tarjan, +1 more
- 01 Feb 1988 - 
- Vol. 17, Iss: 1, pp 143-178
Reads0
Chats0
TLDR
Improved algorithms for several other computational geometry problems, including testing whether a polygon is simple, follow from the proposed O(n\log \log n)-time algorithm, improving on the previously best bound and showing that triangulation is not as hard as sorting.
Abstract
Given a simple n-vertex polygon, the triangulation problem is to partition the interior of the polygon into $n - 2$ triangles by adding $n - 3$ nonintersecting diagonals. We propose an $O(n\log \log n)$-time algorithm for this problem, improving on the previously best bound of $O(n\log n)$ and showing that triangulation is not as hard as sorting. Improved algorithms for several other computational geometry problems, including testing whether a polygon is simple, follow from our result.

read more

Content maybe subject to copyright    Report

SIAM
J.
COMPUT.
Voi.
17,
No.
I,
February
1988
(C)
1988
Society
tbr
Industrial
and
Applied
Mathematics
010
AN
O(n
log
log
n)-TIME
ALGORITHM
FOR
TRIANGULATING
A
SIMPLE
POLYGON*
ROBERT
E.
TARJANf*
AND
CHRISTOPHER
J.
VAN
WYK"
Abstract.
Given
a
simple
n-vertex
polygon,
the
triangulation
problem
is
to
partition
the
interior
of
the
polygon
into
n-2
triangles
by
adding
n-3
nonintersecting
diagonals.
We
propose
an
O(n
log
logn)-time
algorithm
for
this
problem,
improving
on
the
previously
best
bound
of
O
(n
log
n)
and
showing
that
triangu-
lation
is
not
as
hard
as
sorting.
Improved
algorithms
for
several
other
computational
geometry
problems,
including
testing
whether
a
polygon
is
simple,
follow
from
our
result.
Key
words,
amortized
time,
balanced
divide
and
conquer,
heterogeneous
finger
search
tree,
homogene-
ous
finger
search
tree,
horizontal
visibility
information,
Jordan
sorting
with
error-correction,
simplicity
test-
ing
AMS(MOS)
subject
classifications.
51M15,
68P05,
68Q25
1.
Introduction.
Let
P
be
an
n-vertex
simple
polygon,
defined
by
a
list
Vo,V
vn-
of
its
vertices
in
clockwise
order
around
the
boundary.
(The
interior
of
the
polygon
is
to
the
right
as
one
walks
clockwise
around
the
boundary.)
We
denote
the
boundary
of
P
by
0P.
We
assume
throughout
this
paper
(without
loss
of
generality)
that
the
vertices
of
P
have
distinct
y-coordinates.
For
convenience
we
define
vn
V
o.
The
edges
of
P
are
the
open
line
segments
whose
endpoints
are
vi,vi+l
for
0
<
<
n.
The
diagonals
of
P
are
the
open
line
segments
whose
endpoints
are
vertices
and
that
lie
entirely
in
the
interior
of
P.
The
triangulation
problem
is
to
find
n-3
nonintersecting
diagonals
of
P,
which
partition
the
interior
of
P
into
n-2
trian-
gles.
If
P
is
convex,
any
pair
of
vertices
defines
a
diagonal,
and
it
is
easy
to
triangulate
P
in
O
(n)
time.
If
P
is
not
convex,
not
all
pairs
of
vertices
define
diagonals,
and
even
finding
one
diagonal,
let
alone
triangulating
P,
is
not
a
trivial
problem.
In
1978,
Garey,
Johnson,
Preparata
and
Tarjan
[10]
presented
an
O
(n
log
n)-time
triangulation
algorithm.
Since
then,
work
on
the
problem
has
proceeded
in
two
directions.
Some
authors
have
developed
linear-time
algorithms
for
triangulating
special
classes
of
polygons,
such
as
monotone
polygons
[10]
and
star-shaped
polygons
[31
].
Others
have
devised
triangulation
algorithms
whose
running
time
is
O
(n
log
k)
for
a
parameter
k
that
somehow
quantifies
the
complexity
of
the
polygon,
such
as
the
number
of
reflex
angles
[13]
or
the
"sinuosity"
[5].
Since
these
measures
all
admit
classes
of
polygons
with
k
1
(n),
the
worst
case
running
time
of
these
algorithms
is
only
known
to
be
O(n
log
n).
Determining
whether
triangulation
can
be
done
in
o
(n
log
n)
time,
i.e.
asymptotically
faster
than
sorting,
has
been
one
of
the
foremost
open
problems
in
computational
geometry.
In
this
paper
we
propose
an
O
(n
log
logn)-time
triangulation
algorithm,
thereby
showing
that
triangulation
is
indeed
easier
than
sorting.
The
paper
is
a
revised
and
corrected
version
of
a
conference
paper
[27]
which
erroneously
claimed
an
O
(n)-time
algorithm.
The
goal
of
obtaining
a
linear-time
algorithm
remains
elusive,
but
our
*Received
by
the
editors
September
8,
1986;
accepted
for
publication
(in
revised
form)
April
29,
1987.
Typeset
on
July
28,
1987
at
AT&T
Bell
Laboratories,
Murray
Hill,
New
Jersey.
’AT&T
Bell
Laboratories,
Murray
Hill,
New
Jersey
07974.
*Department
of
Computer
Science,
Princeton
University,
Princeton,
New
Jersey
08544.
The
work
of
this
author
was
partially
supported
by
National
Science
Foundation
grant
DCR-8605962.
143

144
R.
E.
TARJAN
AND
C.
J.
VAN
WYK
approach
suggests
some
directions
in
which
to
look
and
clarifies
the
difficulties
that
must
be
overcome.
The
starting
point
for
our
algorithm
is
a
reduction
of
the
triangulation
problem
to
the
problem
of
computing
visibility
information
along
a
single
direction,
which
we
take
to
be
horizontal.
A
vertex-edge
visible
pair
is
a
vertex
and
an
edge
that
can
be
con-
nected
by
an
open
horizontal
line
segment
that
lies
entirely
inside
P.
Similarly,
an
edge-edge
visible
pair
is
a
pair
of
edges
that
can
be
connected
by
an
open
horizontal
line
segment
that
lies
entirely
inside
P.
Fournier
and
Montuno
[9]
showed
that
tri-
angulating
P
is
linear-time
equivalent
to
computing
all
vertex-edge
visible
pairs.
The
reduction
of
triangulation
to
computing
visible
pairs
was
independently
obtained
by
Chazelle
and
Incerpi
[5].
What
we
shall
actually
produce
is
an
O
(n
log log
n
)
-time
algorithm
for
computing
visible
pairs,
which
by
this
reduction
leads
to
an
O
(n
log
log
n)-time
triangulation
algorithm.
Our
visibility
algorithm
computes
not
only
vertex-edge
visible
pairs
but
also
possi-
bly
some
edge-edge
visible
pairs.
It
is
reassuring
that
the
total
number
of
visible
pairs
of
either
kind
is
linear.
LEMMA
1.
There
are
at
most
2n
vertex-edge
visible
pairs
and
at
most
2n
edge-
edge
visible
pairs.
Proof.
Each
vertex
can
be
in
at
most
two
vertex-edge
visible
pairs,
for
a
total
over
all
vertices
of
at
most
2n.
Partition
P
into
trapezoids
and
triangles
by
drawing
a
horizontal
line
segment
between
each
visible
pair
(of
either
kind)
through
the
interior
of
P.
(See
Figure
1.)
Each
edge-edge
visible
pair
corresponds
to
the
bottom
boun-
dary
of
exactly
one
such
trapezoid
or
triangle,
the
top
boundary
of
which
is
either
one
or
two
line
segments
corresponding
to
vertex-edge
visible
pairs
(in
the
case
of
a
tra-
pezoid)
or
a
vertex
that
is
in
no
visible
pairs
(in
the
case
of
a
triangle).
A
vertex
FIG.
1.
A
simple
polygon
P,
showing
visibility
information:
dashed
horizontal
lines
correspond
to
vertex-edge
visible
pairs;
dotted
horizontal
lines
correspond
to
edge-edge
visible
pairs.

TRIANGULATING
A
SIMPLE
POLYGON
145
gives
rise
to
at
most
two
top
boundary
segments
of
trapezoids
or
to
at
most
one
top
boundary
of
a
triangle.
Thus
there
are
at
most
2n
trapezoids
and
triangles
whose
bot-
tom
boundaries
correspond
to
edge-edge
visible
pairs,
and
hence
at
most
2n
such
pairs.
The
second
cornerstone
of
our
method
is
the
intimate
connection
between
visibil-
ity
computation
and
the
Jordan
sorting
problem.
For
a
simple
polygon
P
and
a
hor-
izontal
line
L,
the
Jordan
sorting
problem
is
to
sort
the
intersection
points
of
OP
and
L
by
x-coordinate,
given
as
input
only
a
list
of
the
intersections
in
the
order
in.
which
they
occur
clockwise
around
t)P.
(The
list
of
vertices
of
P
is
not
part
of
the
input.)
Hoffman,
Mehlhorn,
Rosenstiehl
and
Tarjan
14]
have
presented
a
linear-time
Jordan
sorting
algorithm,
which
actually
works
for
any
simple
curve,
open
or
closed.
This
algorithm,
which
we
call
"the
Jordan
sorting
algorithm,"
requires
that
OP
actually
cross
L
wherever
it
touches
it,
but
the
algorithm
is
easily
modified
to
handle
tangent
points,
provided
that
each
intersection
point
is
labeled
in
the
input
as
being
either
crossing
or
tangent.
Computing
visible
pairs
is
at
least
as
hard
as
Jordan
sorting,
in
the
sense
made
precise
in
the
following
lemma:
LEMMA
2.
Using
an
algorithm
to
compute
vertex-edge
visible
pairs,
one
can
solve
the
Jordan
sorting
problem
for
an
n-vertex
polygon
P
in
0
(n)
additional
time,
given
as
input
the
polygon
and
the
line
L
(and
not
the
intersections).
Proof.
Compute
all
vertex-edge
visible
pairs
for
P.
Next,
turn
P
"inside
out"
by
breaking
P
at
its
lowest
vertex
and
drawing
a
box
around
it
as
shown
in
Figure
2,
forming
a
polygon
Q
with
n+5
vertices.
Compute
the
vertex-edge
visible
pairs
for
Q.
These
pairs
specify
vertex-edge
visibilities
on
the
outside
of
P,
and
indicate
which
ver-
tices
of
P
can
see
arbitrarily
far
left
or
right
on
the
outside.
Partition
the
inside
and
outside
of
P
into
trapezoids,
triangles,
and
.unbounded
trapezoidal
regions
by
drawing
horizontal
line
segments
corresponding
to
each
visible
pair.
Given
a
line
L,
the
inter-
section
points
of
OP
and
L
can
be
read
off
in
increasing
x-order
by
moving
left
to
right
through
the
regions
that
intersect
L.
The
total
time
for
this
algorithm,
not
including
the
two
visibility
computations,
is
O
(n).
rn
Since
any
visibility
computation
does
Jordan
sorting
implicitly,
it
is
natural
to
try
using
Jordan
sorting
explicitly
to
compute
visible
pairs.
This
leads
to
the
following
divide-and-conquer
visibility
algorithm
(see
Figure
3)"
Step
1.
Given
P,
choose
a
vertex
v
of
P
that
does
not
have
maximum
or
minimum
y-coordinate.
If
no
such
v
exists,
stop:
there
are
no
visible
pairs
to
compute.
Otherwise,
let
L
be
the
horizontal
line
through
v.
Step
2.
Determine
the
intersection
points
of
0P
and
L
in
the
order
in
which
they
occur
along
the
boundary
of
P.
Step
3.
Jordan
sort
the
intersection
points
and
report
the
visible
pairs
that
correspond
to
consecutive
intersection
points
along
L.
Step
4.
Slice
P
along
L,
dividing
P
into
a
collection
of
subpolygons.
Step
5.
Apply
the
algorithm
recursively
to
each
subpolygon
computed
in
Step
4.
The
Jordan
sorting
algorithm
has
the
fortuitous
side
effect
of
computing
enough
extra
information
so
that
Step
4
is
easy.
The
hard
part
of
the
computation
is
Step
2.
There
are
two
major
bottlenecks
in
the
algorithm,
either
of
which
will
make
a
naive
implementation
run
in
quadratic
time.
First,
it
is
possible
for
the
algorithm
to
report
redundant
visibility
pairs;
indeed,
the
example
in
Figure
4
shows
that
it
can
report
fl
(n
2)
nondistinct
pairs.
We
eliminate
this
bottleneck
by
modifying
Step
2
to
compute
only
some
of
the
intersections
of
0P
with
L.
This
can
cause
the
Jordan
sorting
algorithm
used
in
Step

146
R.
E.
TARJAN
AND
C.
J.
VAN
WYK
FIG.
2.
Polygon
P
of
Figure
turned
"’inside
out,"
and
showing
exterior
vertex-edge
visible
pairs.
3
to
detect
an
error,
since
the
sequence
to
be
sorted
need
no
longer
consist
of
all
inter-
sections
of
a
simple
polygon
with
a
line.
Fortunately
the
sorting
algorithm
is
incre-
mental,
and
when
it
detects
an
error,
we
can
restart
it
in
a
correct
state
by
computing
a
few
additional
intersections
and
making
local
changes
in
its
data
structure.
We
call
this
augmented
sorting
method
Jordan
sorting
with
error-correction.
By
computing
only
some
of
the
intersections
of
3P
and
L
and
using
Jordan
sort-
ing
with
error-correction,
we
obtain
a
visibility
algorithm
that
reports
only
O
(n)
visi-
ble
pairs
and
runs
in
O
(n)
time
not
counting
the
time
needed
to
find
intersections.
This
approach
requires
the
use
of
a
two-level
data
structure
to
represent
polygon
boundaries,
but
imposes
no
further
constraints
on
the
details
of
the
data
structure.
The
second,
far
more
serious
bottleneck
is
the
problem
of
actually
finding
the
intersections.
The
line
L
divides
0P
into
pieces.
If
each
of
these
pieces
ended
up
in
a
different
subpolygon
boundary,
then
we
could
obtain
(with
a
little
work)
an
overall
O
(n)
time
bound
for
the
visibility
algorithm
by
using
finger
search
trees
in
the
boun-
dary
data
structure
and
appealing
to
the
linearity
of
the
following
recurrence
[20,
p.
185]:
]O(1)
if
n--
1;
T
(n)
/
max
{T(k)
+
T(n-k)+O(1
+logmin{k,
n-k})}
I,l<k
<n
ifn>l.
Unfortunately
the
pieces
of
the
original
boundary
do
not
stay
apart
but
are
regrouped
to
form
the
subpolygon
boundaries.
To
beat
the
O
(n
log
n)
time
bound
of
previous
triangulation
algorithms,
we
need
another
idea,
that
of
balanced
divide
and
conquer.
We
refine
the
visibility
algorithm
to
choose
L
judiciously,
so
that
each
of
the
subpolygon
boundaries
contains
a
relatively
small
number
of
pieces
of
the
original

TRIANGULATING
A
SIMPLE
POLYGON
147
STEP
FIG.
3.
Illustrating
Steps
and
4
of
the
visibility
algorithm.
boundary.
Balanced
divide
and
conquer
combined
with
the
use
of
finger
search
trees
in
the
boundary
data
structure
produces
a
visibility
algorithm
that
runs
in
O
(n
log log
n)
time.
The
remainder
of
this
paper
consists
of
five
sections
and
an
appendix.
In
Section
2
we
review
the
Jordan
sorting
algorithm
and
modify
it
to
do
error-correction.
In
Sec-
tion
3
we
present
a
generic
visibility
algorithm,
based
on
Jordan
sorting
with
error-
correction,
that
reports
O(n)
visible
pairs.
In
Section
4
we
refine
the
algorithm
so
that
it
uses
balanced
divide
and
conquer.
In
Section
5
we
propose
a
data
structure
for
representing
the
polygon
boundary
that
consists
of
two
levels
of
finger
search
trees.
We
show
that
with
this
data
structure
the
visibility
algorithm
of
Section
4
runs
in
O
(n
log
log
n)
time.
We
close
in
Section
6
with
some
remarks,
applications,
and
open
problems.
The
appendix
contains
a
discussion
of
finger
search
trees,
which
are
needed
not
only
in
the
visibility
algorithm
itself
but
also
in
the
Jordan
sorting
algorithm.
2.
Jordan
sorting
with
error-correction.
Let
P
be
a
simple
polygon
and
let
v
be
a
vertex
of
P.
Let
L
be
the
horizontal
line
through
v,
and
let
Xo
v,
x,...
,Xm-
be
the
intersection
points
of
igP
and
L
in
clockwise
order
around
igP.
(Since
throughout
this
paper
we
are
assuming
that
the
vertices
of
P
have
distinct
y-coordinates,
igP
and

Citations
More filters
Proceedings ArticleDOI

Applications of random sampling in computational geometry, II

TL;DR: Asymptotically tight bounds for a combinatorial quantity of interest in discrete and computational geometry, related to halfspace partitions of point sets, are given.
Journal Article

Triangulating a simple polygon in linear time

TL;DR: A deterministic algorithm for triangulating a simple polygon in linear time is given, using the polygon-cutting theorem and the planar separator theorem, whose role is essential in the discovery of new diagonals.
Journal ArticleDOI

Triangulating a simple polygon in linear time

TL;DR: In this paper, a deterministic algorithm for triangulating a simple polygon in linear time is presented. But the main tools used are the polygon-cutting theorem, which provides us with a balancing scheme, and the planar separator theorem, whose role is essential in the discovery of new diagonals.
Book ChapterDOI

Art Gallery and Illumination Problems

TL;DR: Since Victor Klee's question, numerous variations on the art gallery problem have been studied, including mobile guards, guards with limited visibility or mobility, illumination of families of convex sets on the plane, guarding of rectilinear polygons, and others.
Journal ArticleDOI

Finding Minimum-Cost Circulations by Successive Approximation

TL;DR: This work develops a new approach to solving minimum-cost circulation problems that combines methods for solving the maximum flow problem with successive approximation techniques based on cost scaling and shows that a minimum- cost circulation can be computed by solving a sequence of On lognC blocking flow problems.
References
More filters
Book

Data Structures and Network Algorithms

TL;DR: This paper presents a meta-trees tree model that automates the very labor-intensive and therefore time-heavy and therefore expensive process of manually selecting trees to grow in a graph.
Book

Topology; a first course

TL;DR: Topology: a first course, Topology:A first course , کتابخانه دیجیتال و اطلاعات امام صادق(ع)
Journal ArticleDOI

Self-adjusting binary search trees

TL;DR: The splay tree, a self-adjusting form of binary search tree, is developed and analyzed and is found to be as efficient as balanced trees when total running time is the measure of interest.
Journal ArticleDOI

Optimal point location in a monotone subdivision

TL;DR: A substantial refinement of the technique of Lee and Preparata for locating a point in $\mathcal{S}$ based on separating chains is exhibited, which can be implemented in a simple and practical way, and is extensible to subdivisions with edges more general than straight-line segments.
Related Papers (5)