This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: FoC S ~ 31 A Theorem on Polygon Cutting with Applications Bernard (halelle. Department ofCornputer Science
CarnegieMellon University
Pittsburgh. Pennsylvania 15213 Abstract Let I' be a simple polygon with .‘V vertices. each being assigned a
weight 5 {0.1}. and let C. the weight of I’. be the added weight of all
\Cl'llCCS. We proie that it is poSsible. in 0(.\') time. to find [“0 \ertices
{1.15 in I’. such that the segment ab lies entirely inside the polygon Pand
partitions it into two polygons, each with a weight not exceeding 2C/3.
This computation assumes that all the vertices have been sorted along
some axis. which can be done in 0(Nlog N) time. We use this result to derive a number of efficient divideandconquer algorithms for:
1. Triangulating an Ngon in b(Mog N) time. 2. Decomposing an Ngon into (few) convex pieces in
O(Nlog N) time. 3. Given an 0(Mog N) preprocessing. computing the shortest
distance between two arbitrary points inside an Ngon (i.c..
the internal distance). in 0(N) time. 4. Computing the longest internal path in an Ngon in 0(N2)
time. in all cases, the algorithms achieve signiﬁcant improvements over
previously known methods. either by displaying better performance or
by gaining in simplicity. in particular, the best algorithms for Problems 2.3.4. known so far, performed respectively in 0(N2). 0(N2). and 0(N‘)
time. Llnhoducﬁon l.iptoii and 'l'arjten‘s planar separator theorem l.T77.l.77] is a
notable example of a systematic lechnique for introducing a
computational tool. i.c.. divideam]cunquer. into a \i\ iiole class of related
problems. i.c.. planar graph prob/ems. Drawing its inspiration from this
philosophy, this paper presents a theoretical result on polygon
decomposition which can be applied to derive a number of eilicient
algorithms for geometric problems. in particular. problems of convex decompositions, triangulation. visibility. and internal distance. _‘ The author's present address is Department of Computer Science.
lirovin Univ" l’roiideiice. R.l. 03912. 'lhis research was supported by
DARPA. Order No. 3597. Contract l‘33615‘81K1539. 0272—5428/82/0000l0339$m.75 © 1982 [BE 339 2. The Polygoncutting Theorem Let P be a simple (i.c.. not self~intcrsecting) polygon with vertices
vl ..... "N in clockwise order. Let OXY be an orthogonal system of
reference. Wlog. we can always assume that no two vertices have the
wnw Xcoonﬁnmc. We define a (vertical) relation bet—
ween edges of P as follows: two edges of P are said
to be vertically related iff there exists a line seg—
ment parallel to the Y—axis which intersects both
edges without intersecting any other edge of P (fig.1)
Note that it is easy to set up the list LV of all
pairs of related.edges in 0(Nlog N) time, using a
method developed in [SH76]. Sweep a vertical line L
from left to right, maintaining the vertical order
of the edges L currently intersects in a dynamic
balanced search tree (e.g., AVL—tree). The line L
starts at the leftmost vertex and proceeds to visit
all of them in ascending Xorder. If the current
vertex is the left endpoint of an edge, this edge is
inserted into the tree, otherwise it is deleted. We may omit the details.
Throughout this paper. we will assume that along with a description of the boundary of I’, provided by a doublylinked list LP,
a doublylinked list U! of all the
vertices sorted by Xcoordinates [KN73]. The preprocessing involved
in setting up these lists requires 0(Nlog N) time and 0(N) space. The decomposition algorithm which we will describe lat. ' on runs in linear we have available time. with this preprocessing in hand. Note that it is legitimate to
separate both tasks. since in the applications which we will mention. the
decomposition algorithm will be called rmrrsively several times. while
the preprocessing will be needed initially. once and for all. The goal of this section is to prove the following theorem: Theorem I: The Polygonculling Theorem. Let I’ be a
simple polygon with N vertieet; v] ..... VA. CilCh assigned a
weight ci (c=0.l). let‘Ctl’) denote the total weight of I’.
defined as the sum (i+"'+‘A* and assume that C(I’)>2.
With the lists l.l’.l.h’./.l' in hand. it is possible to find. in
0(N) time. a pair of vertices ‘.‘“ such that the segment Viv]
lies entirely inside the polygon I" and partitions it into two simple polygons I'lJ'2 satisfying: Ci Pl) 5 Cl ('2) s 2C(l’)/3 'lhe weights of the \ertices in I’l and I’2 are the same as in P. except
for "i and r‘J. for which VlC will assume that in both I" and P2. these
weights become 0. 'lhis assumption is made only for the sake of
simplicity. and other conventions (cg. keeping the same weights err]. in
both PI and P2) are indeed acceptable. if we are ready to add a term
+2 to 2C(P)/3 in the inequality of'lheorem 1. To facilitate our task. in
a ﬁrst stage. we will prove the theorem with slightly relaxed requirements. 2.1. An existence theorem
To begin with, we prove the existence. not of two vertices. but of two
pomis on the boundary of I’, satisfying the inequalities of Theorem 1. Theorem 2: Same assumptions as Theorem 1. There
exists a pair of points A,B on the boundary of P. such that
the segment AB is parallel to the Yaxis, lies entirely in the
polygon P. and partitions it into two simple polygons PPP2
satisfying: C(l’l) 5 C(Pz) 5 2C(P)/3 If A and B are not vertices of P. for consistency. we assign them a
0weight We introduce a distance ﬁanction d(A.B). deﬁned between
two points A]? on the boundary of P as the minimum path weight between A and B. More precisely. let Vivi +1 (resp. viyi+ 1) be the edge of
Peontaining A (resp. B). If A (resp. I?) is a vertex of I’. it is assumed to
be vl (resp. v1). We introduce the function h. deﬁned as follows:
(arilhmeli‘c on flldfCPS done mod N)
h(A,/}) = (”14w1+2
from which we can deﬁne d(A.B):
dMJi) = min [ h(A,/i). C(I’) — NIL/3)) + +Ci. Starting at the edge ”1"2‘ we label each edge of l' recursively. as
follows: }\(vlvz)=c1
levi r1) = MVHVI) + ti Note that this labeling gives us an alternate way ofdeﬁning the distance between two boundary points Alf: di 1 It): min [Mufﬁn—Ali?“ l” . C(I’HMrli'H ‘)}\(rjvj+])l] We are now in a position ﬁrst to prove the existence of the segment
xlli'. as deﬁned in Theorem 2. then to describe an efﬁcient method for
ﬁnding it. As we will see. the ﬁrst step is not superﬂuous; it is an
essential ingredient in ensuring the correctness of the algorithm.
Choose the leftmost point of l’ as the starting point of the lefttoright sweep of a vertical segment S: AB (A below [1). S will always stretch vertically so as to keep its endpoints Al? in permanent contact with the boundary of P. It will thus be able to move continuously to the righL
until it must either expand (ﬁg.2 )orsplit(ﬁg. 3 ). Atany time during
the course of the motion, S will be assigned a value A=h(A.B) to
indicate how close it is to being the desired segment We observe that
initially. A=C(P). and that as long as S moves continuously. A
decreases monotonously by unit steps. When either situation depicted
in Figure: 2,3 arises. we can allways write (1) A: h(A,B)=
h(.4.(7)+h(C.B), from which we can derive a decision procedure for
redeﬁning S. Starting from the leftmost vertex of P. move 5 from left to
right. stretching or shrinking this segment so that it entirely
lies in I’, and its endpoints always lie on the boundary of P.
As long as the motion of S is continuous. check whether
A>2C(l’)/3, in which case continue, else stop. When falling
in either case of ﬁgQgreset S to AC if h(A.(')>h(C.B). or to
CB otherwise. Note that if S is reset to C8 in the case of
ﬁg). . the motion must reverse its direction. Relation (1) shows that every discontinuity causes A to decrease by at
most half, while otherwise A decreases at most by unit steps. since we
have assumed that no two vertices may lie on the same vertical line.
Since A eventually vanishes and C(I’)>2. it must take on some value in
the interval [C(l’)/3 . 2C(I’)/3]. at which point the procedure will stop
and return the desired segment Ail}. This completes the proof of Theorem 2. D 2.2. A relaxed version of the polygoncutting theorem
Unlortunatcly. theorem 2 falls short of providing an efﬁcient
algorithm for computing .il/i. We can. howexer. graft to it a binary
searchlike structure to irnprmc the performance of a naive
implementation. The purpose of this section is thus to prove the following result: Theorem 3: Same assumptions as 'lheorem 1. It is
possible, in OH) time. to ﬁnd a pair of points AB on the
boundary of P. such that the segment AB lies entirely in the
polygon P. and partitions it into two simple polygons P1.P2
satisfying: CW) 5 GP) 5 2mm Since the edges supporting A and B must be vertically
related, we can try out all pairs of LV, checking for
the inequalities to hold and for the proper orienta—
tion of the edges relative to the interior of P.
Theorem 2 ensures that we will thus find the desired
pair of edges, hence AB. 2.3. Completing the proof of the polygoncutting theorem We may now turn our attention back to 'lheorem 1. let vlle and "ﬂu be the edges of P that contain the points A and I} ofThcorem 3.
rcspccthcly. To prove the desired result. onemay be tempted to slide A
and B towards the endpoints of "ivm and vjij respectively, until one 1' l‘» V 01’ V of the conﬁgurations vlvl. 1 1+1‘ vHI y IHVH 1 has been reached.
Unfortunately. obstacles may prevent this from ever happening (ligA),
so our next step will be to take a closer look at these possible obstacles.
Since the quadrilateral vivi+lvj€+lvi contains the segment AB. it is a
simple polygon, and AB partitions it into
Q1: AlevJBA and Q2: ABlele. As a corollary of the Jordan Curve Theorem. which states that a closed curve in the plane partitions two polygons the plane into two connected regions [H555]. it appears that the only
obstacles encountered in Q1 (resp. IQZ) are verticcs in the set
{vi+1'vi+2""‘vj} (resp. {vj+l.vj+2,....vi}). Moreover. the segment
S=AB can encounter only vertices on the convex hull h'l (resp. H2) of
the vertices of 1’ lying inside Q1 (resp. Q2) (fig.4), as is shown in following result Lemma 4: The segment AB intersects any edge of 1’
(outside of A or B) if and only if it intersects the boundary
ofeither H1 or ”2' Proof: Since H1 (resp. H2) lies entirely inside Qt (resp.
02). AB intersects any edge of P lying in Q iff the inﬁnite
line passing through AB does. hence iff AB lies outside of
H1 and H2. D The next task is to compute the convex hulls H1 and H2. We only
give the details of the algorithm for H], the other case being strictly
similar. Since we cannot afford to use a standard 0(Mog N) algorithm
to simply compute the convex hull of the verticcs of I’ in Q], we must
exploit the fact that these vertices lie on a polygonal line in order to
achieve linear time. To begin with. let “S give an informal description
of the algorithm, The goal is. in a first stage. to produce a polygon Kl
which lies entirely in Q]. and whose convex hull is exactly II]. Let a
polygonal chain be a nonintersecting connected sequence of segments. kt consists essentially ofpolygoiial chains I.l made ol’coiiscctitiic edges from the set:
L : { vt+lvi+2 ‘ “1+2vir3‘m" [inch chain has the property that it lies in 01 and intersects V” l'} in
two points Uk and Vt' Moreover. no two segments Ukl’k overlap
(fig.5.l). To compute these chains. we must distinguish between two types of edges in L. An edge v l’ is said to be entering (resp. exiting) k k+1
if it intersects V1+1Vy and VH1 lies instde (resp. outSIde) Q]. The algorithm proceeds as follows: 34l Wlog. assume that there is at least one vertex vi+2 from vi +1 to vj in
clockwise order. Traverse L from Vi+tvt+2 to vi vj, stopping at
entering and exiting edges and taking the following actions. If the
current edge is entering, it may be the endpoint Ux of a new chain Lk.
To decide on this. look at the next exiting edge in L; if it intersects
“+th in a point Vt on the segment Uka. we have indeed a new chain
I.k from Ut to Vk. Otherwise. not only don't we have a new chain ’1’
but the chain just visited may enclose previously computed chains,
which must then be deleted. For that purpose. we use a stack to hold
the pairs (Uk Vk . Ll), so that deletions may be done efficiently. The algorithm is straightforward. so we omit the details Initially. the stack is empty. and the cun‘ent edge e is the ﬁrst
entering edge of L lbcgin lletfbc the next exiting edge in 1. following e. and let U. Vbe
respectively the intersections ofe and fwith levj. if Vlies on Uv,
1
then
Let I.“ be the chain between eandfin L.
Push (UV. 1.”) onto stack.
Go to next entering edge c' in l.. whose intersection
With "in", lies on ht)“, then iterate. else Go to next entering edge i" whose intersection U‘ with vi+ ‘ "J lies on vi+1 V. Pop all pairs (Uk l'k) off the stack as long as Vt lies on U‘vj. ltcratc.
end To prove the correctness ofthc algorithm. we begin by observing uiat the intersection of I with Q] consists of chains whose endpoints lie on
v] + 1v). and that Kl consists of exactly all the IllXmItla/Chuins. A chain is
said to he maximal if it does not lie in the enclosure of any other chain
with vl+ tvj' A maximal chain is also characterized by the fact that the
segment formed by its endpoints does not lie inside any other such segments. From the Jordan Curve Theorem [H555]. it follows that a maximal
chain from Uto V. in clockwise order. has its endpoint Vlying above U
(i.e.. on the segment Uvj). In consequence. only the chains which move
towards v). are candidates for being part of K1, which justiﬁes the
selection criterion of the algorithm. On the other hand. we can also
show that a nonmaximal chain which tnoves towards v} is necessarily
enclosed by another chain moving away from v]. This explains the
deletion rule. Finally. the last observation to make is that a chain from
U to V which moves away from VJ (i.e.. U lies on VvJ) must be enclosed
by a subsequent maximal chain. therefore since maximal chains are
computed "towards" vj. we may skip directly to the next entering edge
in L that intersects levj at a point U‘ below V(i.e.. U lies on viHV)  sec illustration of the various cases in fig.5.1. This completes the proof of correctness. and shows that all the chains Lk may be computed in
sorted order along the segment vi+ 1v]. all these computations requiring
0(N) time. The ﬁnal step in computing Itl is to connect all the chains
Lk together in the order in which they appear in the stack. To do so we borrow segments from v v as shown in ﬁg. 5. 2 We may now apply lj+l
any standard linear convex hull algorithm for simple polygons [LFBO] in order to obtain H1 in 0(N) time. Assuming that both HI and H2 are available. we are now in a
position to give an algorithm for ﬁnding the two veniccs ofTheorcm l.
The idea is to connect the vertices of HI with those of H2. so as to
triangulate the polygon Ir" deﬁned as the area between H1 and H2
containing AB. We claim that at least one of the edges of the
triangulation will provide the desired pair of vertices. with the property of’lheorcm l. the algorithm proceeds as follows: l.ct h1 ..... hp and It]....,l<q be the vertices of HI and H2 . respectively. as we traverse thent from levI to vii)“. I.e.. hl=l i+1' k1=vi.
kq— — v I“. We maintain two pointers. h on H1 and k on H2. moving
them from hl to II and k to k.
r 1 q triangulation on the ﬂy. Note that at all times. the segment hk h =l'j.
I
respectively. and computing the intersects H1 and H2 only at its endpoints (fig.6.1). The simplest way of describing the algorithm is recursively. initially.
hk is vi+l
Let "t: the algorithm terminates with hk = v v. 1 j+l hk h It“. and consider the quadrilateral
hhl+ 1k“ 1kh. For consistency. we deﬁne h 1and k 1 and v] respectively We will show In fiemma 5 at at
least one of its diagonals hku 1m thl. connects ”1 and
H2 without intersecting these polygons outside of its
endpoints i..e. lies entirely in H Moreover. this diagonal
can be found In constant time. We may then determine that diagonal. add it to the triangulation. set hk to it. and iterate. The algorithm clearly runs in linear time. Also. the assurance that it
effectively produces a triangulation of H. comes from the fact that it
keeps only edges which lie entirely in H‘. and that the pointers h and k
pass a vertex only after a diagonal has been assigned to it. Thus there
only remains to prove the following lemma: Lemma 5: If the segment h ku connects H and H2 and
lies entirely inside H. so does one of the diagonals h 2k”
or k h u I+_l'
constant time +1
Moreover this diagonal can be found"I in Proof: Consider the line passing through hk. oriented
from h to k. lfa point lies to the right (rcsp. left) of this line.
we will say th It it hes below (rcsp. above) hk. Since H and
H are convex at least one of the vertices v or v I lies
above hk. therefore it is impossible that both h: l arid ku+
m below hk. indeed this would involve the existence out ai
least three intersection points between a line and a convex
boundary. leading to a contradiction. lfonly one segment.
my h“H lies above hk it can be easily determined in
constant time. and since in that case all of II, lies below hk
the diagonal IIH It does not intersect H2 (nor II either)
outside of' Its endpoints. and may thus be chosen as the next segment of the triangulation (ﬁgtvli, If on the other hand. a” and k1”] lie above hit. the quadrilateral I+l ' “Hit is a simple polygon. tlIeItfoIe it totttatns at
It ast one oi its diagonals entirely (ﬁg. 6 3). and this di tgonal
can be found in constant time. Note that. htcutsc of its
convexity. IIl (resp. Hz) lies. totally on one side of the line
passing through hhM (resp kku I). therefore the whole
quadrilateral. hence the chosen udiagonal. lies inside the polygon H which completes the proof Cl ’lltc purpose of triangulating the polygon H will become apparent with the following result .342 Lemma 6. "[here exists an edge uv in the triangulation of
H which satisﬁes the relation. C(I’)/3 < htu. v)_ < 2C(P)/3. Proof: From lheorem 3. we know that AB partitions .P
into two polygons with weights between C(P)/3 and
2C(l’)/3. which gives the relations C(P)/3_ < min ( h(A B) h(B A) )_ <: max( h(A. B) h(B. A) ) < 2C(P')/3 As a result any pair of vertices ab on H (resp. H 2.) with b
following (resp. preceding) a in the list {h ..... hp} (resp.
{k.. ..k q}) satisﬁes the relation (1) htb a)<2C(P)/3 On the
other hand. each triangle abc of the triangulation has one
side ab on the boundary of either H1 or Hz. with the two
others ac be constructed by the triangulation algorithm.
Wlog let ac be the segment of the triangle constructed ﬁrst
(i.e.. ac lies below be). We always have
(2) h(c.a)= h(b.a) + htc,b). Now we can show that a simple
upward scan through the faces of the triangulation. i.e..
starting at the triangle adjacent to v v H and ending at the
tiiangle adjacent to v v . will inevitably lead to the desired
J 1+1 .
segment of Theorem 1. To see that we may obvtously
assume that none of the edges ab of H or H2 satisﬁes the
relations: C(l’)/3 3 MM) 5 2C(1’)/3 . otherwise we have achieved our goal. in that case Relation
(I) shows that for any triangle abc visited the edge on the
boundary of H. say ab. satisﬁes the stronger inequality
h(li a)<C(I’)/3. which. combined with Relation (2). leads to h(t‘.b) > h(c.o) — C(I’)/3. Since h(v.v l)= C(I’)— CH1 and hva.v}.)=cj+1. it
follows that ifa b .2t1 [i . is the sequence ofintcritir edges
visited in the traversal of the triangulation with the points
am (resp. bm) on Hl (rcsp. H 2). the sequence
h(a.bl).h(a,.b,).... is monotonously2 decreasing from H by jumps of at most C(l’)/3. in C(l’)—cHlto (J
consequence. it must take on at least one value in the intcival L'tl')/.i . l(.‘(l')/3]. which can then be chosen as tin...
View
Full Document
 Fall '08
 Staff

Click to edit the document details