Upload
amitava-datta
View
212
Download
0
Embed Size (px)
Citation preview
Information Sciences 164 (2004) 65–88
www.elsevier.com/locate/ins
An optimal algorithm for one-separationof a set of isothetic polygons
Amitava Datta a,*, Kamala Krithivasan b,Thomas Ottmann c
a School of Computer Science and Software Engineering, University of Western Australia,
Perth, WA 6009, Australiab Department of Computer Science and Engineering, Indian Institute of Technology, Madras 600 036,
Indiac Institut f€ur Informatik, Universit€at Freiburg, Georges-K€ohler-Allee, Geb€aude 51,
79110 Freiburg, Germany
Received 23 February 2002; received in revised form 17 March 2003; accepted 20 June 2003
Abstract
We consider the problem of separating a collection of isothetic polygons in the plane
by translating one polygon at a time to infinity. The directions of translation are the
four isothetic (parallel to the axes) directions, but a particular polygon can be translated
only in one of these four directions. Our algorithm detects whether a scene is separable
in this sense and computes a translational ordering of the polygons. The time and space
complexities of our algorithm are Oðn log nÞ and OðnÞ respectively, where n is the total
number of vertices of the polygons in the scene. The best previous algorithm in the plane
for this problem has complexities of Oðn log2 nÞ time and Oðn log nÞ space.� 2003 Elsevier Inc. All rights reserved.
Keywords: Isothetic polygons; One-separation; Motion planning; Computational
geometry; Optimal algorithm
* Corresponding author.
E-mail address: [email protected] (A. Datta).
0020-0255/$ - see front matter � 2003 Elsevier Inc. All rights reserved.
doi:10.1016/j.ins.2003.06.007
66 A. Datta et al. / Information Sciences 164 (2004) 65–88
1. Introduction
The problem of collision-free motion of objects in the presence of obstacles
has many applications in computer graphics, CAD-CAM systems and robotics.The objects to be moved varies from one application to another. There has
been considerable work on moving line segments, polygons and polyhedra in
two and three dimensional spaces in the presence of obstacles. These problems
are collectively called motion planning problems.
In this paper, we are interested in a different kind of motion planning
problem called separability problem. This class of problems is interesting from
the point of view of two potential application areas. In the first case, we have a
collection of objects and we are interested in finding out whether the objectscan be separated one by one from the collection by collision free motion. In the
second case, the problem arises in machine assembly. A robot has to assemble
or disassemble a composite machine part by moving elementary machine parts
through collision free motion [1,7]. The problem can be stated in the following
form: Suppose CP is a composite part having M simple components
P1; P2; . . . ; PM and each of the simple components is a polygon with n vertices. Isit possible to disassemble CP by moving one simple part at a time? Reif [12] has
proved that this problem is PSPACE-hard in its most general form. However,when only translational motion is allowed, this problem is tractable and has
been studied extensively in recent years [2,4,6,8,10,13].
Guibas and Yao [6] have shown that a disassembly sequence for a set of Mrectangles (resp. convex n-gons) can be computed in OðM logMÞ (resp.
OðMnþM logMÞ) time. Ottmann and Widmayer [10] gave an algorithm for
translating a set of line segments. They also gave an alternate and simple
solution for the problem studied in [6]. It is clear that for convex composite
parts, a disassembly sequence exists for any fixed direction. However, in case ofnon-convex parts, there may not exist any direction of disassembly. This
happens if a subset of the parts are interlocked. Nurmi and Sack [8] have
shown that both the detection and determination problems for a composite
part with non-convex components can be solved in OðMn logðMnÞÞ time.
Toussaint [13] also gave alternate solutions for the disassembly problem.
Nussbaum and Sack [9] have presented matching lower and upper bounds for
detecting and determining a disassembly sequence in a single direction. Their
algorithm runs in HðMnþM logMÞ time.In the isothetic domain, i.e., when the polygons have sides parallel to the
axes, the first work on separation is due to Guibas and Yao [6]. Chazelle et al.
[3] considered two classes of problems. The first is the problem of disassem-
bling a set of isothetic polygons and is called the iso-separability problem. In
this case, the direction of translation is unique. Chazelle et al. [3] presented an
optimal Oðn log nÞ time and OðnÞ space algorithm for the iso-separability
problem. Here, n is the total number of vertices of the polygons.
A. Datta et al. / Information Sciences 164 (2004) 65–88 67
In the more general one separability problem, all the four isothetic directions
of translation are allowed. However, a particular polygon can be translated
only once in one of these four directions. Chazelle et al. presented an
Oðn log2 nÞ time and Oðn log nÞ space algorithm for deciding whether a col-lection of isothetic polygons is one-separable. They could also compute a
separating sequence within the same complexity. Recently, Devine and Wood
[5] have investigated this one-separability problem in 3 and higher dimensions.
In three dimensions, the algorithm of Devine and Wood [5] works in
Oðn ffiffiffi
np
log3 nÞ time and Oðn ffiffiffi
np
log nÞ space. In dimensions dP 4, their algo-
rithm runs in Oðdnd=2 log3 nÞ time and Oðdnd=2 log nÞ space.In this paper, we present the first optimal algorithm for deciding one-
separability and computing a separation order of the polygons in twodimensions. Our algorithm runs in Hðn log nÞ time and HðnÞ space. Though the
basic strategy of our algorithm is similar to that in Chazelle et al. [3], our data
structure is completely different and we expect that this data structure will be
useful in other applications. If the input scene is not one-separable, our algo-
rithm finds a maximum subset of the polygons which is one-separable.
The rest of this paper is organized as follows. In Section 2, we give an informal
description of our algorithm.We describe our data structure in details in Section
3. The algorithm for one-separability in two dimensions is presented in Section4. Finally, we conclude in Section 5 with some comments and open problems.
2. Preliminaries
We consider m isothetic polygons P1; P2; . . . ; Pm and let e1; e2; . . . ; en be the
total number of n edges. The x and y coordinates of an edge ei are representedby xðeiÞ and yðeiÞ respectively. The left and right end points of a horizontaledge ei are represented by lðeiÞ and rðeiÞ respectively. Similarly, the top and
bottom end points of a vertical edge ej are represented by tðejÞ and bðejÞrespectively. We represent a horizontal (resp. vertical) edge ei by the interval
½li; ri� (resp. ½ti; bi�).We set up a data structure called separation tree for each of the four isothetic
directions. These four trees are called the eastern, western, northern and
southern trees. We use the abbreviations E tree, W tree, N tree and S tree for
these four trees.
• If an edge ei is not blocked by any other edge in a fixed direction, we say that
ei is unblocked in that direction. We call the edge ei as free edge in that direc-
tion (refer Fig. 1).
• The E tree (resp. W tree) keeps the freedom information of vertical edges of
the polygons in the þx (resp. �x) direction. In other words, if an edge is free
in the þx direction, it will be free in the E tree.
1e
2e
e4
P3 +x
P2
P3
P1
P4
e3
P4
P2x
1P
+y
y
Fig. 1. The edges e1, e2, e3 and e4 are respectively free in the directions þy, �x, þx and �y.
68 A. Datta et al. / Information Sciences 164 (2004) 65–88
• The N tree (resp. S tree) keeps freedom information of horizontal edges of
the polygons in the þy (resp. �y) direction.• For the N tree (resp. S tree), a horizontal edge ei blocks another horizontal
edge ej in the þy (resp. �y) direction, if ei and ej overlap and yi > yj (resp.yi < yj). Similarly, for the E tree (resp. W tree), a vertical edge ei blocks an-other vertical edge ej in the þx (resp. �x) direction if ei and ej overlap and
xi > xj (resp. xi < xj).• We keep four free sets EFS, NFS, WFS and SFS for the four isothetic direc-
tions. Note that EFS stores all the vertical edges of all the polygons free in
the eastern direction. Further, the vertical edges in EFS cannot have any
overlap, since all of them are free in the x direction.
• For every polygon Pi, we keep four freedom counters called eastern, western,
northern and southern counters and denote them by EFCi, WFCi, NFCi and
SFCi. EFCi stores the number of free edges in the eastern (þx) direction (refer
Fig. 2). The meanings of the other counters are similar.
P2
e7 e5
e6
e2
e1e4
e3
P1
Fig. 2. The vertical edges are indicated by e1 to e7. EFC1 ¼ 2 since e1 and e2 are free in the þxdirection. EFC2 ¼ 1, since e5 is free in the þx (also þy) direction. EFS ¼ fe1; e2; e5g.
A. Datta et al. / Information Sciences 164 (2004) 65–88 69
2.1. An informal description
We discuss our algorithm briefly and informally in this section. The details
of the algorithm are given in Section 4. First, we construct four balancedbinary trees in the four isothetic directions and then try to peel these trees, i.e.,
try to free the polygons by deleting free edges from these four trees. We call this
process peeling. A high level description of the algorithm is as follows:
Step 1: Sort the vertical (resp. horizontal) edges of all the polygons in ascend-
ing and descending order according to x (resp. y) coordinates.Step 2: Construct the four separation trees. The E tree (resp. W tree) is set up
by sweeping the vertical edges of the polygon in the decreasing (resp.
increasing) x direction. Similarly, the N tree (resp. S tree) is con-structed by sweeping the horizontal edges of the polygons in the
decreasing (resp. increasing) y direction.
Step 3: We try to peel the trees by starting with one of the four trees. Suppose
we start with the E tree. For each polygon Pj, we check whether any
edge is free in the eastern (þx) direction. If we find an edge ei 2 Pj,we increase EFCj by 1. This way, if EFCj becomes equal to the number
of edges of the polygon Pj, then Pj is free in the eastern (þx) direction.We delete all the edges of Pj from all the four trees and continue ourpeeling process with the E tree. If we are stuck with the E tree, i.e.,there is no free polygon in the þx direction, we go to one of the other
trees and repeat the same process. If the scene is one-separable, all the
trees will become empty at the end of this process. Otherwise, we will
not be able to free any polygon from any of the trees at some stage and
we can infer that the scene is not one-separable.
3. Separation tree
We discuss the construction of the separation trees E tree, W tree, N treeand S tree in this section. Our algorithm is based on manipulations of these
four trees in the four directions. Note that the four trees are used to detectfreedom of each polygon in the þx, �x, þy and �y directions. The data
structure for each direction is a balanced binary tree augmented with addi-
tional fields in their internal nodes. In our discussion, we assume that the
polygons are in general position, i.e., no two vertical (resp. horizontal) sides
have the same x (resp. y) coordinate. Our algorithm can be modified easily in
the degenerate case.
Now, we discuss the fields in the E tree and its construction. Our discussion
holds for the other three trees as well. In the E tree, the y coordinates of the endpoints of the vertical intervals are stored in the leaves in sorted order from left
70 A. Datta et al. / Information Sciences 164 (2004) 65–88
to right. The left-most (resp. right-most) leaf stores the minimum (resp. max-
imum) y coordinate. Under the general position assumption, each leaf stores
only two end points. We keep some additional fields at each node of E tree.
3.1. Fields in the internal nodes
We will refer to the E tree as T to simplify the notation. Let ni be an internal
node of T and T ðniÞ be the subtree of T rooted at ni. The two children of ni aredenoted as leftðniÞ and rightðniÞ. We denote the parent of ni by parentðniÞ.
Definition 3.1. We say that an edge ek is blocked in the eastern direction in the
subtree rooted at ni, if there is an edge ej such that ej has at least one end point
in T ðniÞ, ej and ek overlap and xðejÞ > xðekÞ. If there is no such edge ej, we saythat ek is unblocked in T ðniÞ.
The additional fields at ni are the following and the definitions of the fields in
an internal node are illustrated in Fig. 3.
minðniÞ: A field which stores the coordinate of the left-most (the least ycoordinate) leaf in T ðniÞ.
maxðniÞ: A field which stores the coordinate of the right-most (the highest ycoordinate) leaf of T ðniÞ.
L highðniÞ: A field which stores an edge that is (i) completely contained and
(ii) unblocked in the left subtree of ni. If there is no such edge ei, then
L highðniÞ ¼ null. Otherwise, let ek be the edge with the highest x coordinate
among all the edges satisfying the two conditions (i) and (ii). Then
L highðniÞ ¼ ek.
in
ni( )LR_cross
ni( )LL_crossni( )L_high
ni( )RL_cross
ni( )R_high
ni( )RR_cross
ni( )maxni( )min
Fig. 3. Illustration of the fields at an internal node ni. If an end point of an edge crosses the base of
a triangle denoting a subtree, it is assumed that the end point is outside the subtree. Also, it is
assumed that at a time only one of the edges is present and it is unblocked.
A. Datta et al. / Information Sciences 164 (2004) 65–88 71
R highðniÞ: A field which stores an edge that is (i) completely contained and
(ii) unblocked in the right subtree of ni. If there is no such edge ei, then
R highðniÞ ¼ null. Otherwise, let ek be the edge with the highest x coordinate
among all the edges satisfying the two conditions (i) and (ii). ThenR highðniÞ ¼ ek.
LL crossðniÞ: A field which stores an edge ei whose left end point lðeiÞ is inthe left subtree of ni, but right end point is not in the left subtree of ni, i.e.,minðleftðniÞÞ6 lðeiÞ6maxðleftðniÞÞ < rðliÞ. Also, the part of ei in the left sub-
tree of ni is unblocked. If there is no such edge ei, then LL crossðniÞ ¼ null.Note that only one edge can satisfy the above conditions.
LR crossðniÞ: A field which stores an edge ei whose right end point is in the
left subtree of ni, but whose left end point is not in that subtree, i.e.,lðeiÞ < minðleftðniÞÞ and minðleftðniÞÞ6 rðeiÞ6maxðleftðniÞÞ. Also, the part of
ei in the left subtree of ni is unblocked. If there is no such edge ei, then
LR crossðniÞ ¼ null. Again, only one edge can satisfy the above conditions.
RL crossðniÞ: A field which stores an edge ei whose left end point is in the
right subtree of ni, but whose right end point is not in that subtree, i.e.,
minðrightðniÞÞ6 lðeiÞ6maxðrightðniÞÞ and rðeiÞ > maxðrightðniÞÞ. Also, the part
of ei in the right subtree of ni is unblocked. If there is no such edge ei,RL crossðniÞ ¼ null. Only one edge can satisfy the above conditions.
RR crossðniÞ: A field which stores an edge ei whose right end point is in the
right subtree of ni, but whose left end point is not in that subtree, i.e.,
lðeiÞ < minðrightðniÞÞ and minðrightðniÞÞ6 rðeiÞ6maxðrightðniÞÞ. Also, the part
of ei which is in the right subtree of ni is unblocked. If there is no such edge ei,then RR crossðniÞ ¼ null. Only one edge can satisfy the above conditions.
3.2. Fields in the leaf nodes
In our data structure, each leaf contains two end points from two edges ejand ek. This is because, the vertical and horizontal edges appear alternately
along the polygon boundary. Note that, due to the general position assump-
tion, no leaf can contain more than two end points. Further, the fields L highand R high are undefined in the leaf nodes since no leaf node can contain a
complete edge. For determining the fields in the leaf nodes, we have the fol-
lowing cases:
Case 1. The leaf node ni has the left end points of two vertical edges ej and ek.Let these two end points be lðejÞ and lðekÞ.
If xðejÞ > xðekÞ then LL crossðniÞ :¼ RL crossðniÞ :¼ ejelse
LL crossðniÞ :¼ RL crossðniÞ :¼ ek;LR crossðniÞ :¼ RR crossðniÞ :¼ null;
72 A. Datta et al. / Information Sciences 164 (2004) 65–88
Case 2. The leaf node ni has two right end points, i.e., rðejÞ and rðekÞ.
If xðejÞ > xðekÞ then LR crossðniÞ :¼ RR crossðniÞ :¼ ejelseLR crossðniÞ :¼ RR crossðniÞ :¼ ek;LL crossðniÞ :¼ RL crossðniÞ :¼ null;
Case 3. The leaf node ni has one left end point lðejÞ and one right end point
rðekÞ.
LL crossðniÞ :¼ RL crossðniÞ :¼ ej;LR crossðniÞ :¼ RR crossðniÞ :¼ ek.
3.3. Construction of the trees
We discuss only the construction of the E tree in detail and the other treescan be constructed in a similar way. First, we sort the vertical edges of the
polygons in order of decreasing x coordinates and sweep the set of polygons
from right to left (i.e., from higher x coordinate to lower x coordinate). The ycoordinates of the end points of the edges are inserted in T .
• In a first sweep, we construct a skeletal structure for the E tree. In other
words, we construct the binary tree with its internal nodes and leaves, but
without any of the vertical edges inserted in it. However, we set up the fieldsmaxðniÞ and minðniÞ at every internal node ni. This can be easily done by
knowing the coordinates of the two extreme leaves of the subtree rooted
at such a node ni.• In a second sweep, we insert the vertical edges in a right to left sorted order.
We also establish the fields in all the nodes. This can be easily done from the
information of maxðniÞ, minðniÞ and the max and min fields of the two chil-
dren of ni. We only discuss how the field LL crossðniÞ can be set up at an
internal node ni, since the computation of the other fields is similar. As men-tioned earlier, LL crossðniÞ is an edge whose left end point is contained in the
subtree rooted at leftðniÞ, but the right end point is not in the subtree rooted
at leftðniÞ. Further, such an edge is unblocked in the subtree rooted at leftðniÞin the eastern (þx) direction.
While performing the second sweep, if an edge has its left end point in the
subtree rooted at ni, but its right end point is not in this subtree, we update the
field LL crossðniÞ only if this field is currently empty. Since we are sweepingfrom higher x to lower x direction, once we find such an edge, we need not
: RR_cross(n0 ) = n0 e2
: RR_cross(n4) = e3n4n1 : LL_cross( n1) = e2
n2: LR_cross( )n2 = e2 : LR_cross(5n 5n ) = e2
: RL_cross(n3) = e2n3 : LL_cross(n6) = e1n6
n4
e1n6
e8
e5
e3
e2
e1
e4e7
n3
n4n1
e2e3e
7
e5e6
e8n2
n5
e6e4
n0
Fig. 4. A simple scene of isothetic polygons and the initial N tree. The non-empty fields at the
internal nodes are shown.
A. Datta et al. / Information Sciences 164 (2004) 65–88 73
update this field again. This update can be done for all the nodes along the
insertion path in Oðlog nÞ time, since the end points of the edges are stored in
the leaves. Hence, at the end of the second sweep, we have inserted all the
vertical edges of the polygons in E tree. We have also established all the fields
in the internal nodes as well as in the leaves. While inserting an edge in E tree,all the fields along the insertion path can be updated in Oðlog nÞ time. Hence,the complete construction of T takes Oðn log nÞ time. A simple scene of iso-
thetic polygons and the initial N tree is shown in Fig. 4.
3.4. Deletion of an edge and updating of the fields
In this section, we discuss the deletion of an edge. We also describe how to
update the fields in the internal nodes and leaves of the tree during this dele-
tion.
3.4.1. Deletion of an edge
As discussed before, the two end points of an edge ei are denoted by lðeiÞand rðeiÞ. To delete an edge ei, we delete the two leaves containing lðeiÞ and
rðeiÞ. If these two leaves are occupied by other end points from some other
edges, we keep the two leaves but delete the information regarding ei. It isensured during the construction of the four trees that the maximum path length
74 A. Datta et al. / Information Sciences 164 (2004) 65–88
is Oðlog nÞ. Hence, during the deletion, no path-length can exceed this bound.
We assume without loss of generality that, for ei, we first delete lðeiÞ and then
rðeiÞ. While deleting lðeiÞ (resp. rðeiÞ), we update the internal fields along the
path from the leaf containing lðeiÞ (resp. rðeiÞ) to the root.
3.4.2. Updating of the fields at the internal nodes
We discuss the updating of the fields in an internal node in a generic way.
Suppose we are deleting lðejÞ for an edge ej and ni is a node along this deletion
path from bottom to top. We assume that the fields up to the node ni havealready been updated. We discuss the updating of the fields in parentðniÞ. LetHighðem; . . . ; enÞ be a function which returns the edge with highest x coordinateamong em; . . . ; en. There are several cases in the updating of the fieldsin parentðniÞ when lðejÞ is deleted. The updatings are similar when rðejÞ is
deleted.
Case (I). ni is the left child of parentðniÞ(a) L highðparentðniÞÞIf ðLL crossðniÞ ¼ RR crossðniÞÞ thenL highðparentðniÞÞ :¼ HighðL highðniÞ; LL crossðniÞ;R highðniÞÞ
elseL highðparentðniÞ :¼ HighðL highðniÞ;R highðniÞÞ;
(b) R highðparentðniÞÞ: Remains unchanged.
(c) LL crossðparentðniÞÞIf RðLL crossðniÞÞ > maxðniÞ thenLL crossðparentðniÞÞ :¼ HighðLL crossðniÞ;RL crossðniÞÞ
else
LL crossðparentðniÞÞ :¼ RL crossðniÞ(d) LR crossðparentðniÞÞIf LðRR crossðniÞÞ < minðniÞ thenLR crossðparentðniÞÞ :¼ HighðLR crossðniÞ;RR crossðniÞÞ
else
LR crossðparentðniÞÞ :¼ LR crossðniÞ(e) RL crossðparentðniÞÞ: Remains unchanged.
(g) RR crossðparentðniÞÞ: Remains unchanged.
(g) maxðparentðniÞÞ: Remains unchanged.
(h) minðparentðniÞÞ :¼ minðniÞ.
Case (II). ni is the right child of parentðniÞ(a) L highðparentðniÞÞ: Remains unchanged.
(b) R highðparentðniÞÞ:If LL crossðniÞ ¼ RR crossðniÞ thenR highðparentðniÞÞ :¼ HighðL highðniÞ; LL crossðniÞ;R highðniÞÞ
A. Datta et al. / Information Sciences 164 (2004) 65–88 75
else
R highðparentðniÞÞ :¼ HighðL highðniÞ;R highðniÞÞ(c) LL crossðparentðniÞÞ: Remains unchanged.
(d) LR crossðparentðniÞÞ: Remains unchanged.(e) RL crossðparentðniÞÞ:If RðLL crossðniÞÞ > maxðniÞ thenRL crossðparentðniÞÞ :¼ HighðLL crossðniÞ;RL crossðniÞÞ
else
RL crossðparentðniÞÞ :¼ RL crossðniÞ(f) RR crossðparentðniÞÞIf LðRR crossðniÞÞ < minðniÞ thenRR crossðparentðniÞÞ :¼ HighðRR crossðniÞ; LR crossðniÞÞ
else
RR crossðparentðniÞÞ :¼ LR crossðniÞ(g) maxðparentðniÞÞ :¼ maxðniÞ(h) minðparentðniÞÞ: Remains unchanged.
3.4.3. Updating at the leaf nodes
Under the general position assumption, each leaf nk contains at most two
end points of two edges ei and ej. There are several cases depending on thecombination of the end points present at nk.
Case (i). nk has two left end points, i.e., lðeiÞ and lðejÞ; and lðeiÞ is
deleted
LL crossðnkÞ :¼ RL crossðnkÞ :¼ ej;
LR crossðniÞ and RR crossðniÞ remain unchanged, i.e., null.
Case (ii). nk has two right end points, i.e., rðeiÞ and rðejÞ; and rðeiÞ is
deleted
LR crossðniÞ :¼ RR crossðniÞ :¼ ej;LL crossðniÞ and RL crossðniÞ remain unchanged, i.e., null.
Case (iii). nk has one left and one right end point
(a) nk has lðeiÞ and rðejÞ; and lðeiÞ is deletedLL crossðniÞ :¼ RL crossðniÞ :¼ null;LR crossðniÞ and RR crossðniÞ remain unchanged.
(b) nk has lðejÞ and rðeiÞ; and rðeiÞ is deletedLR crossðniÞ :¼ RR crossðniÞ :¼ null;LL crossðniÞ and RL crossðniÞ remain unchanged.
76 A. Datta et al. / Information Sciences 164 (2004) 65–88
3.4.4. Correctness of the updatings
Lemma 3.2. The updatings discussed in Sections 3.4.2 and 3.4.3 correctlymaintains the fields in T after the deletion of an edge.
Proof. We prove the correctness of updating at an internal node by induction
and the correctness of the updating at the leaf nodes is straightforward. We
assume that the updating is correct at an internal node ni and then show that
the updating is correct in parentðniÞ according to the description given in
Section 3.4.2.
We consider Case (I) (i.e., when ni is the left child of its parent) in Section
3.4.2. We prove the correctness of the updating for this case following the caseanalysis in Section 3.4.2. We can prove in an analogous way, when ni is the
right child of its parent.
(a) L highðparentðniÞÞ: There are two possibilities.
(i) If the fields LL crossðniÞ and RR crossðniÞ contain the same edge ej,then this edge is free in both the left and right subtrees of ni and hence
ej is a candidate for L highðparentðniÞÞ. Since we always store the highestx coordinate edge in L highðparentðniÞÞ, we have to choose the highest xcoordinate edge among L highðniÞ, R highðniÞ and the edge ej describedabove.
(ii) If the two fields LL crossðniÞ and RR crossðniÞ do not store the same
interval, there are again two cases to be considered.
In the first case, both of these fields are empty. In the second case, either
the right end point of LL crossðniÞ or the left end point of RR crossðniÞextends beyond the subtree rooted at ni. We need not consider such an
edge for a candidate for L highðparentðniÞÞ since it is not contained in the
left subtree of parentðniÞ. Hence, in this case the only candidates forL highðparentðniÞÞ are the intervals L highðniÞ and R highðniÞ.(c) LL crossðparentðniÞÞ: Note that the only two edges in the fields of niwhose right end point may extend beyond maxðniÞ are LL crossðniÞand RL crossðniÞ. Hence, LL crossðparentðniÞÞ will be the edge with higher
x coordinate among these two edges. If the edge in LL crossðniÞ does
not extend beyond maxðniÞ, then the only candidate for this field is
RL crossðniÞ.(d) LR crossðniÞ: In this case also, the only fields in ni whose left endpoints may extend beyond minðniÞ are RR crossðniÞ and LR crossðniÞ.Hence, the correctness of the updating is similar to the previous case.
(h) minðniÞ: It is clear that minðparentðniÞ is always minðniÞ (since ni is theleft child of its parent) and hence it should be updated if minðniÞ has chan-ged due to the deletion.
A. Datta et al. / Information Sciences 164 (2004) 65–88 77
(b), (e), (f), (g) All these fields remain unchanged since these are contributed
by the right subtree of parentðniÞ. h
3.5. Determination of freedom of the edges
In our algorithm, we need freedom information for edges in several different
cases. We first consider how to get the complete freedom information at a
particular instance of the execution of the algorithm. In other words, we want
to find all the edges which are unblocked in the eastern direction at a particular
time of the execution of the algorithm.
Lemma 3.3. If two edges ei and ej (rðeiÞ < lðejÞ) are unblocked in the easterndirection, in Oðlog nÞ time we can find a free edge ek (if it exists) such thatrðeiÞ < lðekÞ < rðekÞ < lðejÞ.
Proof. Consider the path from the leaf containing rðeiÞ to the root and denote it
by P. We store the possible candidate for a free edge in a variable free edge.While traversing P, at every internal node ni 2 P (including rootðT Þ), thefollowing computation is performed. There are two different cases, depend-
ing on whether the path P has come upto ni from the left or the right subtree
of ni. We consider only the case when P has come to ni from its left
subtree. The other case is similar. Suppose ni has an edge em which has the
highest x coordinate among the following fields, (i) L highðniÞ, (ii) LL crossðniÞand RR crossðniÞ (i.e., both these fields contain the same edge) and (iii)
R highðniÞ, such that em is unblocked and completely contained in the subtree
rooted at ni.First, we check whether the edge currently present in free_edge, is blocked in
the eastern direction by the edges present in the fields at ni. Let us assume that
free edge currently contains an edge en.
(a) If en is blocked, we assign null to free edge.(b) Suppose the edge en is unblocked and completely contained in the subtree
rooted at left sonðniÞ as well as in the subtree rooted at ni.• If em is different from ej, we delete the edge en from free edge and include
em instead. The reason is that if em is blocked by some other larger edge el,the end points of el are outside the subtree rooted at ni. In that case, el willalso block the edge en in the eastern direction. Hence, if en is a free edge,
em has to be a free edge in the eastern direction.
• If em is same as ej, we keep free edge unchanged.
We claim that if the variable free edge contains an edge ek after we reach
rootðT Þ along P, this edge ek is unblocked in the eastern direction. Further, eksatisfies the scondition in the statement of the lemma.
78 A. Datta et al. / Information Sciences 164 (2004) 65–88
Suppose ek is not unblocked. Then there is some other edge el which partly
or completely blocks ek in the eastern direction. If el completely blocks ek, thenrðelÞ > rðekÞ. Since el has a higher x coordinate, it must be present in at least at
the root or in some node on P below rootðT Þ as one of the fields. Hence,free edge will be set to null after encountering such a field which contains el. Ifel partially blocks ek, ek cannot be picked up in free edge during the traversal
of P. In this case, ek can be present neither as R high nor as LL cross and
RR cross (simultaneously) in any internal node along P.
The complete computation takes Oðlog nÞ time, since the length of P is
Oðlog nÞ and we perform a constant number of comparisons at every node
along P. h
Corollary 3.4. We can find all edges which are free in the eastern direction at aparticular stage of the E tree in Oðk log nÞ time, where k is the number of verticaledges currently free in the eastern direction.
Proof. Initially, at most three edges may be free in the root of E tree. Theseare the edges present in the fields L highðrootÞ, R highðrootÞ and in the
fields LL crossðrootÞ, RR crossðrootÞ (if these two fields contain the same edge).
Suppose we have two free edges ei and ej such that lðeiÞ < rðeiÞ <lðejÞ < rðejÞ. We search with the end point lðeiÞ to see whether there is a free edgeek such that rðekÞ < lðeiÞ. This can be done in Oðlog nÞ time by a method exactly
similar to that in Lemma 3.3. Similarly, any free edge in between ei and ej can be
found in Oðlog nÞ time. For every such new free edge found, we search again with
their end points. Once we have searched with one end point, we do not search
again with it. Therefore, for every end point of a newly found free edge, we spendOðlog nÞ time. Hence, within Oðk log nÞ time we can find all the k free edges. h
Now, we discuss how to update the freedom information when an edge ei isdeleted. We refer to an edge which has got freedom due to the deletion of ei asan unblocked edge. The unblocked edges fall into several categories.
1. An unblocked edge ej has a partial overlap with the deleted edge ei.2. An unblocked edge ej completely covers the deleted edge ei.3. An unblocked edge ej is completely covered by the deleted edge ei.
Note that after the deletion of an edge ei, it is sufficient to find out just one
edge ej which is freed due to the deletion of ei. After such an edge ej is found,we can apply the method of Lemma 3.3 to detect other edges which are freed
due to the deletion of ei.
Lemma 3.5. If an edge ei is deleted from the eastern tree, in Oðlog nÞ time we canfind at least one edge (if it exists) which is freed due to the deletion of ei.
A. Datta et al. / Information Sciences 164 (2004) 65–88 79
Proof. We prove the lemma for the three cases mentioned above. In all the
three cases we first delete the edge ei (i.e., the leaves containing the end points)
and update the fields in all the internal nodes along the deletion paths. Then we
traverse the deletion paths again from the leaf to the root.
Case 1. First, we consider the case when the deleted edge ei has partial overlapwith the unblocked edge ej. We assume w.l.o.g. that lðeiÞ < lðejÞ <rðeiÞ < rðejÞ, i.e., the left end point of ej falls inside ei. In the following, by
lcaðni; njÞ we mean the least common ancestor of two nodes ni and nj. Supposethe leaves containing rðeiÞ and rðejÞ are ni and nj respectively. Let nk be the
node lcaðni; njÞ. Then ni and nj are respectively in the left and the right subtree
of nk.If ej is free in the right subtree of nk, it will be present in the field
RR crossðnkÞ, since the fields in the internal nodes have been already updated
after the deletion of ei. Similarly, if ej is free in the left subtree of nk, it will bepresent in the field LL crossðnkÞ.
While traversing the path from ni to root, we check at every internal node nlalong this path whether LL crossðnlÞ and RR crossðnlÞ stores the same edge or
not. If we find such an edge, we store this as a candidate for ej. Note that ejcannot be blocked by some edge em either completely contained in ej or havingpartial overlap with ej. Since in both of these cases, at least one end point of emwill be present in the subtree rooted at lcaðni; njÞ and therefore ej cannot bepresent in the LL cross and RR cross fields of lcaðni; njÞ. It may happen that
such an edge ej is blocked by some larger edge en whose end points are outside
the subtree rooted at lcaðni; njÞ. In this case, en will be present in the fields of
some node along the path from lcaðni; njÞ to root. We can easily check this
while traversing the path from ni to root.
Case 2. Next, we consider the case when the deleted edge ei is completely
covered by an edge ej which has been freed due to the deletion of ei. This case issimilar to the previous case. If we traverse one of the deletion paths, we will
encounter such an edge ej in an internal node nk in both the fields LL crossðnkÞand RR crossðnkÞ.
Case 3. In the third case, the deleted edge ei completely covers an edge ej whichhas been freed due to the deletion of ei. Note that many small edges may getunblocked due to the deletion of ei. If we can find at least one such edge, we can
find the rest of the unblocked edges by repeated application of the method
discussed in Lemma 3.3. We discuss below how to find one such unblocked
edge ej.
We traverse a path P from the leaf containing lðeiÞ upto the root. Since ej iscompletely contained in ei, there exists a node nk on P with the following
80 A. Datta et al. / Information Sciences 164 (2004) 65–88
property. P reaches nk from left sonðnkÞ and ej is completely or partially
contained in the subtree rooted at right sonðnkÞ. If ej is really free after the
deletion of ei, ej must be present either in R highðnkÞ or in RL crossðnkÞ. Thisfollows from the definition of R high and RL cross fields and the correctness ofthe updatings discussed in Lemma 3.2. Hence, at every internal node along P,
we check for such an edge ej according to the above observation. There is a
possibility that such an edge is blocked by some other edge el. Note that such
an edge el cannot have a partial overlap with ej, since in that case ej cannot bepresent in R highðnkÞ or RL crossðnkÞ. This is because, one end point of el willbe present in the subtree rooted at right sonðnkÞ. Therefore, if such an edge elexists, it will have both its end points outside the subtree rooted at
right sonðnkÞ. Hence, we will encounter el in the part ofP from nk upto rootðT Þ.Further, el will be present in one of the fields of a node in this part of P. We
can check this while we continue traversing P. At the end of traversal of P, we
can find such an unblocked edge ej, if it exists. h
4. Algorithm for one-separation
We now describe our algorithm for deciding one separability and computing
a translational sequence if the input scene is separable in two dimensions. Ouralgorithm is based on the data structure discussed in Section 3. As mentioned
earlier, the basic strategy of our algorithm is similar to that in Chazelle et al. [3]
We elaborate on the informal description of the algorithm given in Section 2.1.
Since the scene is completely known, we first sort the vertical (resp. hori-
zontal) edges of the polygons according to increasing and decreasing x (resp. y)coordinates. Then we store the vertical edges of the polygons according to
decreasing and increasing x coordinates in the E tree and W tree respectively.
Similarly, the horizontal edges are stored in N tree and S tree according todecreasing and increasing y coordinates. We have already described in Section
3 how to construct these four trees in Oðn log nÞ time. In this section, we discuss
only Step 3.
Definition 1. In E tree, if the �x side of an edge ei 2 Pj is inside (resp. outside)the polygon Pj, we call ei as an inside (resp. outside) edge. Similarly, inside andoutside edges are defined for the other three trees. For example, in Fig. 5, e1 isan inside edge and e3 is an outside edge in the eastern tree.
4.1. Peeling process
In the peeling process, we try to free the polygons by deleting free edges from
the four directions and explain this process through some examples. The fol-lowing are the two important issues in the peeling process.
e4
e8
e11
e12
e13
e14
e15
e16
e9
e10
e7
e6e3
e2
e1e5
+y
-y
-x +x
Fig. 5. The vertical edges e1 and e3 are free in the þx direction. They are deleted and substituted by
their span which is e1.
A. Datta et al. / Information Sciences 164 (2004) 65–88 81
(a) While deleting the free edges from one of the trees, we should not wrongly
give freedom to some polygon which is not free in that direction.
(b) We should spend only Oðlog nÞ time per deleted edge to achieve the overalltime complexity of Oðn log nÞ.
We first explain how we maintain the correct freedom information in each
tree. Assume that we start the peeling process in E tree. Initially, at most three
edges may be free at rootðE treeÞ. These are the edges present in the fields
L high, LL cross and RR cross (if these two fields contain the same edge) and
R high. These are the starting members of EFS. After this, we can find all the
other free edges (we assume this number is k) initially present in E inOðk log nÞ time by the method in Lemma 3.3 and Corollary 3.4. We include all
these edges in EFS. While adding the free edges in EFS, we ensure that they
are in a bottom to top order in terms of the y coordinates of their bottom end
points.
Definition 2. Let ei; eiþ1; eiþ2; . . . ; ej be a set of contiguous vertical edges of the
polygon Pk in EFS such that bðeiÞ < tðeiÞ ¼ bðeiþ1Þ < tðeiþ1Þ ¼ bðeiþ2Þ <tðeiþ2Þ ¼ � � � < tðejÞ where tðejÞ and bðejÞ (16 j6 n) are resp. the top andbottom end points of ej. We call a set of such edges as a group (refer Fig. 6). We
denote the jth group for polygon Pi by Pij. The vertical interval ½bi; tj� is calledthe span of the set of edges ei; eiþ1; eiþ2; . . . ; ej (refer Fig. 5).
Example 4.1. In Fig. 6, inside edges e1, e3, e4 and e5 of polygon P2 are free in the
þx direction, but e2 is not free. Since we add the free edges in the increasing
order of y coordinates, the edges e3, e4 and e5 will appear in EFS in the fol-
lowing order: e5; e4; e3. There are two groups of contiguous edges namelyP21 ¼ fe1g and P22 ¼ fe3; e4; e5g.
e1
e2
e3
e4
e5
e6
e7
P
P
1
2
Fig. 6. Illustration for Definition 2, Examples 4.1 and 4.2.
82 A. Datta et al. / Information Sciences 164 (2004) 65–88
All contiguous free edges in EFS are grouped together. When we find a new
free edge by the method in Lemma 3.3, we insert that edge in EFS by doing a
binary search in additional Oðlog nÞ time. We delete the edges in EFS in two
stages. First, we mark the edges as inside or outside and also mark an edge as
deleted if it is free in the þx direction. When we delete the edges in a particulargroup, say, Pij, more outside and inside edges of Pi may get freedom. We can
find all such edges by Lemma 3.5 and Lemma 3.3. All the edges which get
freedom due to the deletion of edges in a group Pij are called freeðPijÞ. If EFCi is
less than the total number of vertical edges in Pi after all these deletions, Pi isnot free in the þx direction. Hence, the deletion of all these edges may wrongly
give freedom to some other polygon which is blocked by the edges of Pi. Toprevent this, in the second stage, we delete the individual free edges but replace
them by the span of each group in both E tree and EFS. The correctness of thisprocess is ensured in Lemma 4.1.
Example 4.2. In Fig. 6, freeðP21Þ ¼ fe1g and freeðP22Þ ¼ fe3; e4; e5; e6; e7g, butthe deletion of all these edges does not give freedom to P2 in þx direction.
Hence, we replace all these edges by spanðP21Þ ¼ fe1g and spanðP22Þ ¼ ½t3; b5� inboth E tree and EFS.
Now, we explain how to spend only Oðlog nÞ time per deleted edge. Weconsider the case when we are visiting the E tree either first time or some
other time during the execution of our algorithm. We take the edges of EFS one
at a time. Consider an edge ek 2 EFS. The members of EFS are either inside edgesof some polygons or span edges, since we do not keep any outside edge in EFS.
When we are considering edge ek 2 Pi, we delete ek from the eastern tree if ekis an inside edge. Note that we can delete ek from the eastern tree without
affecting the freedom of the other polygons in the scene. This is because, due to
the structure of isothetic polygons, there is one or more outside edges to the leftof ek which block a polygon that is not free in the eastern direction. We check
A. Datta et al. / Information Sciences 164 (2004) 65–88 83
whether any other edges of Pi become free due to the deletion of ek. Note that,
if ek 2 Pi is an inside edge, several edges of Pi may become free due to the
deletion of ek and all these edges are outside edges in the eastern tree. We
cannot delete these outside edges from the eastern tree unless the completepolygon Pi is free in the eastern direction. We first find all such edges freed due
to the deletion of ek (we call this set of edges as freeðekÞ) and increment EFCi by
one for each such edge. Note that there may be some new edges freed due to the
deletion of the edges in freeðekÞ. We include all such edges in the set freeðekÞand increment EFCi accordingly. In case Pi is not free in th eastern direction
after the deletion of these edges in freeðekÞ, we find the rightmost (highest xcoordinate) edge el in freeðekÞ. Then we delete ek and all the edges in freeðekÞand replace them by spanðelÞ.
Lemma 4.1. If some polygon Pi was blocked in the þx direction by ek or someedges in freeðekÞ, it still remains blocked in the þx direction after the insertion ofspanðelÞ, where el is the rightmost edge in freeðekÞ. Further, no new polygon isblocked in the þx direction due to the insertion of spanðelÞ.
Proof. (sketch) Since el is the rightmost edge in freeðekÞ, it is easy to see that
spanðelÞ will lie completely within the polygon Pi. Hence, spanðelÞ will blockexactly the same polygons which ek or the edges in freeðekÞ block. h
The above lemma holds for the other free sets as well. In our algorithm,
we want to check whether the deletion of some edge ek 2 Pi gives freedom
to some other edge em of a polygon Pj such that em is only blocked by a
span edge of Pj after the deletion of ek. Note that we can only spend Oðlog nÞtime for each edge in EFS to achieve our claimed time complexity of Oðn log nÞ.Also, whenever we find an inside edge in EFS we delete it from E tree andfrom EFS and possibly replace it by its span (or the span of the group to
which it belongs). The main difficulty is that when we visit EFS several time
during the execution of our algorithm, the same span edge may be present in
EFS. We should delete such a span edge only if its deletion gives freedom to
other edges of the same polygon. We cannot spend Oðlog nÞ time for such a
span edge every time and we want to spend only Oðlog nÞ time overall for such
a span edge. To enusre this, we need some extra properties of our data
structure. we discuss how we can achieve Oðlog nÞ time through an example inLemma 4.2.
Suppose we have found a free polygon Pk in the southern direction. As
mentioned in the informal description, we delete all the edges of Pk from all the
four trees. In the following lemma, we consider the deletion of vertical edges of
Pk from E tree and show through an example how we spend Oðlog nÞ time for
each edge in EFS. In the following, we will refer to the span of an edge of a
polygon as span-edge.
84 A. Datta et al. / Information Sciences 164 (2004) 65–88
Lemma 4.2. If we delete the edges of Pk one by one from higher x to lower xdirection, each vertical edge of Pk can unblock a set of edges of atmost onepolygon Pm such that this set of edges is blocked in the þx direction by a span-edge of the same polygon Pm after the deletion of the edges of Pk.
Proof. We explain through an example why the above lemma holds. We refer
to Fig. 7. Suppose we started the peeling process with E tree. After the removal
of P11 (i.e., e1) and the edges in freeðP11Þ (i.e., the edges e11, e9 and e3), we insertspanðP11Þ (i.e., e1) in E tree. Since no polygon is free in the eastern direction, we
go to S tree and find that P2 is free in the southern (i.e.,�y) direction. Now, we
have to delete the vertical edges of P2 from E tree. Note that the vertical edge
e5 2 P1 is blocked by the edges e13 and e19 of P2. We delete the vertical edges ofP2 from E tree in a right to left order. After the deletion of e13, the edge e19blocks e5 2 P1 such that the edge e5 will be blocked in the eastern direction by
spanðP11Þ when e19 is deleted.
The claim of Lemma 4.2 is that there cannot be another edge (like e5) fromanother polygon which is freed due to the deletion of e19. Suppose there is
another edge em 2 Pj like e5, such that after the deletion of e19, em will be blocked
in the þx direction by some span-edge of Pj. Then the polygon Pj to which embelongs should have some part of it behind e19 (i.e., towards the less x coordinateside of e19). If Pj has some part behind e19, there are two possibilities.
• In the first case, e5 is blocked by some span-edge of Pj even after the deletion
of e19.• In the second case, spanðP11Þ blocks the part of Pj which is behind e19 even
after the deletion of e19.
In either case, a set of edges of only one polygon (P1 or Pj) remains blockedonly by some span-edge of the same polygon.
e1
e2
e3
e4
e5
e6
e7
e8
e9
e10
e11
e12
e13
e14
e15
e16
e17
e18
e19
P1
P2
e20
+X-X
-Y
+Y
Fig. 7. Illustration of the peeling process. The polygon edges are numbered in the clockwise order
from e1 to e12 for P1 and from e13 to e20 for P2.
A. Datta et al. / Information Sciences 164 (2004) 65–88 85
In our algorithm, a span-edge may be present in some free set, e.g., EFS,for several rounds when we visit EFS. So, we cannot spend Oðlog nÞ time for
such a span-edge every time we visit EFS. We need to ensure the following
whenever we delete a vertical edge from the eastern tree. If we find somehidden edge em of a polygon Pi such that em is blocked by some span-edge of
the same polygon Pi, we can indicate this in EFS by marking the corre-
sponding span-edge. Note that Lemma 4.2 implies that there can be at most
one such span-edge. If there are more than one such span edges, they are part
of the same polygon and as a result they have been already merged to form a
single span-edge. This follows from the definition of a span-edge. When we
visit EFS next time, we only delete the span-edge in EFS if it is marked.
Otherwise, we ignore the span-edge in that particular visit to E tree. This way,we invest Oðlog nÞ time for an edge in EFS, if the deletion of that edge really
gives freedom to some other edge of that same polygon. Now, we discuss this
process in detail.
When we insert a span-edge ek 2 Pi in E tree, suppose the two end points
of this span-edge are at the leaves ni and nj. We mark the node lcaðni; njÞ in
E tree with the identity of the span edge ek. Suppose we are deleting a
vertical edge el from E tree which has an overlap with ek (e.g., like an edge
e19 in Fig. 7, which has an overlap with spanðP11Þ). Note that one end pointof el is in the subtree rooted at lcaðni; njÞ. Suppose this end point of el is at
the leaf np. Before the deletion of el, we traverse the path from np to root
and discover the node lcaðni; njÞ. If a marked node like lcaðni; njÞ exists
while deleting the end point of el from the leaf np, we search for an edge of
Pi (to which ek belongs) to update the internal fields of E tree along the
deletion path. If such an edge of Pi exists, it will ultimately be brought to
one of the internal fields of either the left or the right child of lcaðni; njÞ. Inthat case, we mark the span-edge ek in EFS as a candidate for futuredeletion from EFS. We omit the details of this process, since this can be
done in the same way as in Lemma 3.3. This whole process takes Oðlog nÞtime for each edge we actually delete and hence, we can charge this time to
each deleted edge. h
In our algorithm, we start with one of the trees and repeatedly visit
the other trees in a round robin fashion. When no polygon can be separated
in a particular direction, we visit the next free set and try to seewhether any polygon can be separated in that direction. When a polygon is
free in a particular direction, we delete all its edges from the other three
trees and update the free sets in these three directions. If at any stage of the
algorithm, we cannot update all the four free sets, the scene is not one-
separable. Otherwise, at the end of the algorithm, all the trees become
empty and we can derive a separation order from the history of the
86 A. Datta et al. / Information Sciences 164 (2004) 65–88
execution of the algorithm. We summarize the result in the following the-
orem.
Theorem 4.3. The two-dimensional one-separability of a set of isothetic polygonscan be decided in Hðn log nÞ time and HðnÞ space, where n is the total number ofedges of the polygons in the set. A translational ordering of the polygons can alsobe derived within the same time and space bounds.
Proof. The correctness of the algorithm follows from the description above. If
the scene is separable, we are never stuck with the peeling process and the trees
become empty at the end. Sorting of the edges and the construction of the four
trees take Oðn log nÞ time. With every edge, we associate the identity of thepolygon to which the edge belongs. We assume that the polygons are given as a
clockwise list of edges. In OðnÞ time, we can mark each edge as inside or out-side. When we visit a particular tree and the corresponding free set, we delete a
span-edge only if it is already marked. For any other edge ei in the free set, we
either delete it completely (if the corresponding polygon is free in that direc-
tion) or replace it by its span. Hence, we spend only Oðlog nÞ time for each edge
in the scene. Hence, the total execution time is Oðn log nÞ. The space require-
ment is OðnÞ, since each internal node in a tree stores only a constant numberof fields. The four freedom counters EFCi, WFCi, NFCi and SFCi for each
polygon Pi takes Oð1Þ space.The lower bound on space is obvious. The lower bound on the time com-
plexity can be proved from the fact that the iso-separation problem (i.e., sep-
arating in a single axis-parallel direction) is a special case of the one-separation
problem. The iso-separation problem is equivalent to detection of intersection
of rectangles. This problem is in turn equivalent to the element uniquenessproblem which has a lower bound of Xðn log nÞ [11]. h
Finally, we illustrate the algorithm in the following example.
Example 4.3. We illustrate the algorithm in Fig. 7. We start the peeling with
E tree. Initially, EFS ¼ fe1g. Since e1 is an inside edge, we can delete e1 from
E tree. After the deletion of e1, e11 becomes free. When e11 is deleted, e9 gets
freedom. After the deletion of e9, e3 gets freedom. So, freeðe1Þ ¼ fe1; e11;e9; e3g. Since the polygon P1 does not get freedom (EFC1 is less than the numberof vertical edges) in the þx (eastern) direction, we delete all the edges in freeðe1Þand insert spanðe1Þ, i.e., e1 in E tree and EFS. At this point, no polygon is free in
the þx direction. Hence, we go to tree N tree. Initially, NFS ¼ fe12; e10; e8; e16g.Since all these edges are inside edges with respect to the þy direction, we deleteall of them. As a result, e2, e4 and e6 get freedom in the þy direction and the
polygon P1 is free in the þy direction. We delete all the horizontal edges of P1from the N tree and S tree and all its vertical edges from the E tree and W tree.
A. Datta et al. / Information Sciences 164 (2004) 65–88 87
Now, e20 and e18 also get freedom and NFS ¼ fe18; e20g. Since both these are
inside edges, we delete them and as a result, e14 gets freedom and the polygon P2gets freedom in the þy direction. We delete all the edges of P2 from the other
three trees and all the four trees become empty.
5. Conclusions
The main difference between our approach and that in Chazelle et al. [3] is
the data structure we use. In [3], the data structures for the four trees are
segment trees [11]. As a result, there are certain difficulties in maintaining
freedom information of the edges. The main problem is to check whether an
edge is free in a particular isothetic direction. An edge may be blocked by a
large edge which encloses it, or by a small edge which is enclosed by it. Thoughit is relatively easy to check the first case using segment trees, the second case is
more difficult. Chazelle et al. kept a secondary structure at each internal node
of the segment tree to check this case. This secondary structure is a priority
queue. As a result, the search becomes a two level search, first in the nodes of
the segment tree and then in the priority queues associated with the nodes of
the segment tree. This leads to a complexity of Oðn log2 nÞ. Another problem
with this data structure is that segment tree requires Oðn log nÞ space since eachedge may be present in Oðlog nÞ nodes.
Our data structure is a simple balanced binary tree. However, we maintain
additional fields in the internal nodes to facilitate our search. The number of
such additional fields is constant at every internal node and we do not need any
two level structure. As a result, we are able to achieve the optimal complexities
of Oðn log nÞ time and OðnÞ space for the one-separability problem.
Acknowledgements
The authors would like to thank one of the referees for extensive comments
which improved the presentation of the paper considerably. The first author
would like to thank S. Soundaralakshmi for reading an earlier version of the
paper and suggesting many improvements. The first author’s research is par-tially supported by the Western Australian Interactive Virtual Environments
Centre (IVEC) and Australian Partnership in Advanced Computing (APAC).
References
[1] P.K. Agarwal, M. de Berg, D. Halperin, M. Sharir, Efficient generation of k-directionalassembly sequences, in: Proceedings of the 7th ACM-SIAM Symposium on Discrete
Algorithms, 1996, pp. 122–131.
88 A. Datta et al. / Information Sciences 164 (2004) 65–88
[2] M. de Berg, H. Everett, H. Wagener, Translation queries for sets of polygons, Int. J. Comput.
Geom. Appl. 5 (1995) 221–242.
[3] B. Chazelle, Th. Ottmann, E. Soisalon-Soininen, D. Wood, The complexity and decidability of
SEPARATIONTM, in: J. Paredaens (Ed.), Automata, Languages and Programming, Proceed-
ings of International Colloquium on Automata, Languages and Programming, LNCS 172,
Springer, Berlin, 1984, pp. 119–127.
[4] F. Dehne, J.-R. Sack, Translation separability of sets of polygons, Vis. Comput. 3 (1987) 227–
235.
[5] M. Devine, D. Wood, SEPARATIONTM in d dimensions or strip mining in asteroid fields,
Comput. Graph. 13 (3) (1989) 329–336.
[6] L.J. Guibas, F.F. Yao, On translating a set of rectangles, in: F.P. Preparata (Ed.), Advances in
Computing Research, Volume I: Computational Geometry, JAI Press Inc., Greenwich, CT,
1983, pp. 61–77.
[7] B.K. Natarajan, On planning assemblies, in: Proceedings of the Fourth Annual ACM
Symposium on Computational Geometry, 1988, pp. 299–308.
[8] O. Nurmi, J.-R. Sack, Separating a polyhedron by one translation from a set of obstacles, in:
Proceedings of Workshop on Graph Theory, Amsterdam, 1988, LNCS 344, Springer, Berlin,
1984, pp. 202–212.
[9] D. Nussbaum, J.-R. Sack, Disassembling two-dimensional composite parts via translation, Int.
J. Comput. Geom. Appl. 3 (1) (1993) 71–84.
[10] Th. Ottmann, P. Widmayer, On translating a set of line segments, Comput. Vis. Graph. Image
Process. 24 (1983) 382–389.
[11] F.P. Preparata, M.I. Shamos, Computational Geometry: An Introduction, Springer-Verlag,
Berlin, 1985.
[12] J. Reif, Complexity of the mover’s problem and generalizations, in: Proceedings of 20th IEEE
Symposium on Foundations of Computer Science, 1979, pp. 560–570.
[13] G.T. Toussaint, Movable separability of sets, in: G.T. Toussaint (Ed.), Computational
Geometry, North-Holland, Amsterdam, 1985, pp. 335–375.