scieee AI-readable full text Open interactive document viewer

Efficient computation of minimum-area rectilinear convex hull under rotation and generalizations

Alegría Galicia, Carlos,Orden Martin, David,Seara Ojea, Carlos,Urrutia Galicia, Jorge

Abstract

Let P be a set of n points in the plane. We compute the value of ¿¿[0,2p) for which the rectilinear convex hull of P, denoted by RHP(¿), has minimum (or maximum) area in optimal O(nlogn) time and O(n) space, improving the previous O(n2) bound. Let O be a set of k lines through the origin sorted by slope and let ai be the sizes of the 2k angles defined by pairs of two consecutive lines, i=1,…,2k. Let Ti=p-ai and T=min{Ti:i=1,…,2k}. We obtain: (1) Given a set O such that T=p2, we provide an algorithm to compute the O-convex hull of P in optimal O(nlogn) time and O(n) space; If T<p2, the time and space complexities are O(nTlogn) and O(nT) respectively. (2) Given a set O such that T=p2, we compute and maintain the boundary of the O¿-convex hull of P for ¿¿[0,2p) in O(knlogn) time and O(kn) space, or if T<p2, in O(knTlogn) time and O(knT) space. (3) Finally, given a set O such that T=p2, we compute, in O(knlogn) time and O(kn) space, the angle ¿¿[0,2p) such that the O¿-convex hull of P has minimum (or maximum) area over all ¿¿[0,2p).

Full text

Efficient computation of minimum-area rectilinear convex hull under rotation and generalizations∗ Carlos Alegría-Galicia†David Orden‡Carlos Seara§Jorge Urrutia¶ 1 Abstract2 Let Pbe a set of npoints in the plane. We compute the value of θ∈[0,2π)for which3 the rectilinear convex hull of P, denoted by RHθ(P), has minimum (or maximum) area4 in optimal O(nlog n)time and O(n)space, improving the previous O(n2)bound. Let O5 be a set of klines through the origin sorted by slope and let αibe the aperture angles6 of the 2ksectors defined by every pair of two consecutive lines. Let Θi=π−αiand7 Θ = min{Θi:i= 1, . . . , 2k}. We further obtain: (1) Given a set Osuch that Θ≥π 2, we8 provide an algorithm to compute the O-convex hull of Pin optimal O(nlog n)time and9 O(n)space, while if Θ<π 2the complexities are O(n Θlog n)time and O(n Θ)space. (2) Given10 a set Osuch that Θ≥π 2, we compute and maintain the boundary of the Oθ-convex hull11 of Pfor θ∈[0,2π)in O(kn log n)time and O(kn)space, or in O(kn Θlog n)time and O(kn Θ)12 space if Θ<π 2. (3) Finally, given a set Osuch that Θ≥π 2, we compute the Oθ-convex13 hull of Pof minimum (or maximum) area over all θ∈[0,2π)in O(kn log n)time and O(kn)14 space.15 Keywords: Rectilinear convex hull, Restricted orientation convex hull, Minimum area.16 1 Introduction17 Restricted-orientation convexity is a generalization of traditional convexity that stems from the18 notion of restricted-orientation geometry, where the geometric objects under study comply with19 restrictions related to a fixed set of orientations. Restricted-orientation geometry started with20 ∗Extended abstracts related to this work appeared in the XIV Spanish Meeting on Computational Geometry [2] and in the 30th European Workshop on Computational Geometry (EuroCG) [4]. †Posgrado en Ciencia e Ingeniería de la Computación, Universidad Nacional Autónoma de México, [email protected]. ‡Departamento de Física y Matemáticas, Universidad de Alcalá, Spain, [email protected]. Research supported by project MTM2017-83750-P of the Spanish Ministry of Science (AEI/FEDER, UE). §Departament de Matemàtiques, Universitat Politècnica de Catalunya, Spain, [email protected]. Research supported by projects Gen. Cat. DGR 2017SGR1640 and MINECO MTM2015-63791-R. ¶Instituto de Matemáticas, Universidad Nacional Autónoma de México, [email protected]. Research supported in part by SEP-CONACYT 80268, PAPPIIT IN102117 Programa de Apoyo a la Investigación e Innovación Tecnológica UNAM. This project has received funding from the European Union’s Horizon 2020 research and innovation programme under the Marie Skłodowska-Curie grant agreement No 734922. 1 the work of Güting [16] in the early eighties, as a generalization of the study of orthogonal21 polygons, whose edges are parallel to the coordinate axes.22 Ortho-convexity or orthogonal convexity [20, 21, 25] was defined by defining as convex sets23 those whose intersection with any line parallel to a coordinate axis is either empty or connected.24 The corresponding convex hull of a set Pof npoints in the plane, called rectilinear convex hull25 of Pand denoted RH(P), has been extensively studied since its formalization in the early26 eighties and, together with the rectilinear convex hull of other geometric objects, it has been27 applied in several research fields, including illumination [1], polyhedron reconstruction [10],28 geometric search [27], and VLSI circuit layout design [28].29 Researchers have also studied relations between rectilinear convex hulls of colored point30 sets [3], and developed generalizations of orthogonal convexity [14, 15, 19] along with related31 computational results [4, 5, 6]. Among these generalizations, it is particularly relevant the one32 by Fink and Wood [14], who defined O-convexity calling convex sets to those whose intersection33 with any line parallel to one in a given set Oof lines through the origin is either empty or34 connected. Thus, one can consider the O-convex hull of a point set P, sometimes called O-hull35 for short and denoted OH(P).36 1.1 Our work37 Bae et al. [8] considered the rectilinear convex hull of a set of point Pwhere convexity is defined38 by lines parallel to a rotation of the coordinate axis by an angle θ, denoted by RHθ(P)and called39 θ-rectilinear convex hull. In fact, the coordinates will remain to be considered with respect to40 the horizontal and the vertical axes, although convexity will be considered with respect to the41 set Oobtaining by rotating these axes by an angle θ∈[0,2π). This is why these rotations will42 be mentioned as “axes” instead of “coordinate axes”.43 In O(n2)time and O(n)space, Bae et al. computed the value of θ∈[0,2π)such that the44 area of RHθ(P)is minimum (notice that this area is orientation-dependent, more details in45 Section 2). However, the authors did not achieve to efficiently maintain the linear number of46 events where the structure of RHθ(P)changes as the value of θis increased from 0to 2π.47 In the present paper, we improve the results of Bae et al. [8] by providing an optimal48 O(nlog n)time and O(n)space algorithm. Our scheme for such an improvement is to maintain49 two structures: The set of vertices of RHθ(P), which has to be updated at every change arising50 during the rotation θ∈[0,2π)and the set of overlapping intervals, defined as the angular51 intervals contained in [0,2π)where opposite staircases of the boundary of RHθ(P)overlap52 with each other (more details in Section 2.2.1). Dealing with the set of vertices was achieved,53 indirectly, by Díaz-Báñez et al. [12] in optimal O(nlog n)time and O(n)space, while designing54 an algorithm to fit an orthogonal chain to a point set in the plane. Dealing with the set of55 overlapping intervals in O(nlog n)time and O(n)space is one of the main contributions in the56 current paper. In Section 2, we show how to maintain these two structures and design the57 optimal O(nlog n)time and O(n)space algorithm for this improvement.58 In Section 3 we focus on O-convex sets, i.e., sets for which the intersection with any line59 parallel to a line in Ois either empty or connected. We design algorithms to compute the O-60 convex hull of a set Pof npoints, denoted by OH(P); and also we generalize to O-convexity the61 rotation in Bae et al. [8] considering the Oθ-convexity, i.e., the convexity defined by the set Oof62 klines rotated by an angle θ, leading to OHθ(P). One of the problems will be computing and63 maintaining the boundary of OHθ(P)during a complete rotation for θ∈[0,2π). Some of the64 algorithms are sensitive to the following two parameters. The first parameter will be the cardinal65 k≥2of a set O={ℓ1, . . . , ℓk}of lines through the origin sorted by slope. The O(klog k)time66 complexity for sorting the lines in Ocan be added to the complexity of the upcoming algorithms;67 2 nevertheless, as we will see below, the number kwill be smaller than the number nof input68 points of the problems, and thus, O(klog k)will be in O(nlog n). However, the complexity of69 some of our algorithms can be sensitive to k, which will appear as a multiplicative factor. For70 the second parameter, let αibe the aperture angles of the 2ksectors defined by two consecutive71 lines in Oand let Θi=π−αi. The second parameter will be Θ = min{Θi:i= 1, . . . , 2k},72 which measures how “well distributed” are the the orientations of the klines of Ointo the unit73 circle and, in particular, we will distinguish whether Θ≥π 2or Θ<π 2.74 1.2 Contributions and relevance75 The main contributions of this work are the following:76 • We improve the O(n2)time complexity from Bae et al. [8], computing in optimal O(nlog n)77 time and O(n)space the value of θ∈[0,2π)for which RHθ(P)has minimum (or maxi-78 mum) area, also returning RHθ(P)(Theorem 5).79 • Given a set Oof klines such that Θ≥π 2, we provide an algorithm to compute OH(P),80 in optimal O(nlog n)time and O(n)space (Theorem 6).81 • Given a set Oof klines such that Θ<π 2, we provide an algorithm to compute OH(P)in82 O(n Θlog n)time and O(n Θ)space (Theorem 7).83 • We generalize to O-convexity the rotation in Bae et al. [8] showing that, for a set Oof84 klines, computing and maintaining the boundary of OHθ(P)during a complete rotation85 for θ∈[0,2π)can be done in O(kn log n)time and O(kn)space (Theorem 8) for Θ≥π 2 86 or in O(kn Θlog n)time and O(kn Θ)space (Theorem 9) for Θ<π 2.87 • As a consequence, for the two cases Θ≥π 2or Θ<π 2, computing an interval of θsuch88 that the boundary of OHθ(P)has minimum number of staircases, or minimum number89 of steps, or it is connected, or it has the minimum number of connected components, can90 be done in O(kn log n)time and O(kn)space, or in O(kn Θlog n)time and O(kn Θ)space,91 respectively (Corollaries 1 and 2).92 • Given a set Ocomposed by two non-perpendicular lines through the origin, we show93 that computing and maintaining the boundary of OHθ(P)during a complete rotation94 for θ∈[0,2π)can be done in O(n Θlog n)time and O(n Θ)space, where Θis the smallest95 aperture angle of the sectors defined by the two lines (Corollary 3).96 • Given a set Oof klines such that Θ≥π 2, we provide an algorithm to compute OHθ(P)97 with minimum (or maximum) area over all θ∈[0,2π)in O(kn log n)time and O(kn)98 space (Theorem 12).99 For possible applications, it is relevant to note that rotation-dependent and minimum area100 enclosing shapes are commonly used in form-shape analysis [11, 13, 24, 29], as well as in feature101 classification [18, 26].102 2 Rectilinear hull of a point set103 Let P={p1, . . . , pn}be a set of npoints in the plane, in general position. Let CH(P)denote104 the convex hull of Pand let V={p1, . . . , ph}be the set of vertices of its boundary ∂(CH(P)),105 as we meet them in counterclockwise order (starting at an arbitrary vertex p1). Further, let106 3 E={e1, . . . , eh}be the set of edges of ∂(CH(P)), where ei=pipi+1 and the indices are taken107 modulo h.108 An open quadrant in the plane is the intersection of two open half planes whose supporting109 lines are parallel to the x- and yaxes. Such an open quadrant is said to be P-free if it contains110 no element of P. The rectilinear convex hull of P[22] is the set:111 RH(P) = R2\∪ W∈W W, where Wdenotes the set of all P-free open quadrants. See Figure 1, left, for an example. It112 is interesting to note that, whith this definition, the rectilinear convex hull might be discon-113 nected [22].114 Figure 1: Left: The rectilinear convex hull RH(P)of a point set P. Right: The rectilinear convex hull RHθ(P)of the same point set for θ=π/6. As in Bae et al. [8], we will also consider the rectilinear convex hull when rotating the axes115 by an angle θ, also called the θ-rectilinear convex hull of P:116 RHθ(P) = R2\∪ Wθ∈Wθ Wθ, where Wθdenotes the set of all P-free open θ-quadrants, i.e., the open quadrants obtained when117 the axes are rotated by θ. Figure 1, right, shows an example, where the π/6-rectilinear convex118 hull happens to be disconnected.119 2.1 Computing and maintaining RHθ(P)120 In this subsection we describe an algorithm to compute and maintain RHθ(P), together with 121 all its relevant features, over all the rotations of the axes by an angle θ∈[0,2π). The algorithm122 works in optimal O(nlog n)time and O(n)space, thus improving the O(n2)time complexity123 achieved by Bae et al. [8].124 Let us start with the fixed value θ= 0. Given two points pi, pj∈P, the dominance relation125 pidominates pj, denoted by pj≺pi, is defined to be fulfilled when xj≤xiand yj≤yi. This126 relation is a partial order in P, and a point pi∈Pis called maximal if there does not exist127 pj∈Psuch that i=jand pi≺pj. The Set Maxima Problem [23] consists of finding all the128 maximal points of Punder this dominance ≺. Note that the condition above is equivalent to pj 129 being contained in the open quadrant with apex piwhich is a translation of the third quadrant.130 Analogous set maxima problems can be defined considering the remaining three quadrants, and131 the maxima problem for Pwith respect to any of the four quadrants can be solved optimally132 in O(nlog n)time and O(n)space [23], where each set of maximal points has a total ordering133 4 and can be organized as a height balanced search tree. These sets of maxima points for P134 with respect to the four quadrants provide the points of Pon the boundary ∂(RH(P)) of the135 rectilinear convex hull of Pfor θ= 0. See again Figure 1, left.136 Let us move to the case where the axes are rotated as in Bae et al. [8]. The set Vθ(P)of137 points of Plying on the boundary ∂(RHθ(P)) of the rotated RHθ(P)will be called the set of138 vertices of RHθ(P). As above, for any fixed θthe computation of RHθ(P)reduces to solving139 four set maxima problems, since140 Vθ(P) = Vθ(P)∪Vθ+π 2(P)∪Vθ+π(P)∪Vθ+3π 4(P),(1) for Vθbeing the set of maximal points of Pwith respect to the θ-quadrant defined rotating by θ141 the x- and yaxes [8, 12, 22]. In order to keep track of the changes in the set Vθ(P)of vertices142 of RHθ(P)while changing θin [0,2π), we can use results from Avis et al. [7] and Díaz-Báñez143 et al. [12] as follows.144 Every point p∈ Vθ(P)is the apex of a P-free open θ-quadrant in Wθ. Figure 2(a) shows145 a point pthat is in Vθ(P)(i.e., a vertex of RHθ(P)) for all θin the interval Ip= [θ′, θ′′). The146 endpoints of Ipmark the in and out events of p, i.e., the values of θwhen pstarts and stops147 being in Vθ(P). Because of the general position assumption for P, a point p∈Pcan have at148 most three intervals Ipfor which it is a vertex of RHθ(P), i.e., for which p∈ Vθ(P). xθ0 xθ00 p Ip Ip yθ00 yθ0 (a) p Ip xθ0 xθ00 xθ (b) p Ip xθ0 xθ00 xθ (c) Figure 2: (a) Ip= [θ′, θ′′ ), together with P-free open θ′- and θ′′ -quadrants (rotations of the first quadrant) with apex p. (b) Situation for a θ∈Ipand P-free open θ-quadrant with apex p. (c) Situation for a θ /∈Ipand non-P-free open θ-quadrant with apex p. 149 The following Theorem 1 is not stated explicitly as a result in [12], but it appears as a main150 step of an algorithm for a fitting problem. The proof is obtained by, first, computing the set of151 intervals Ipas above for which the points p∈Pare maximal with respect to some θ-quadrant152 (using a result from Avis et al. [7]), then, computing the ordered set of in- and out-events while153 θincreases from 0to 2π(performing a line sweep with four lines to obtain the maximal points154 of Pfor each of the four θ-quadrants). The reader is referred to [12] for further details.155 Theorem 1 (Díaz-Bañez et al. [12]).Computing and maintaining the θ-rectilinear convex hull156 RHθ(P)while θincreases from 0to 2πcan be done in optimal O(nlog n)time and O(n)space.157 5 2.2 Finding the value of θfor which RHθ(P)has minimum area158 For a fixed value of θ, we can compute the area of RHθ(P)using the fact that159 area(RHθ(P)) = area(P(θ)) −area(P(θ)\ RHθ(P)),(2) where P(θ)denotes the filled polygon having the points in Vθ(P)as vertices and an edge160 connecting two vertices if they are consecutive elements in Vθ(P), see Figure 3. We will compute161 the area of P(θ)\RHθ(P)by decomposing it into two types of regions: (i) The triangles defined162 by every pair of consecutive elements in Vθ(P), and (ii) the rectangular overlaps between two163 triangles that make RHθ(P)being disconnected, see again Figure 3.164 Figure 3: Computing the area of RHθ(P). The polygon P(θ)is bounded by the dash-dotted line. A triangle and a rectangular overlap are filled with blue. By Theorem 1, the triangles in (i) above can be maintained in optimal O(nlog n)time and165 O(n)space. While θincreases from 0to 2π, the set Vθ(P)of points on ∂(RHθ(P)) changes at166 the values of θwhere a point of Pbecomes (resp. is no longer) a vertex of RHθ(P). We call167 these angles in (resp. out)events.168 The rest of this subsection will deal with the rectangles in (ii), showing how to maintain169 the set Sθ(P)of rectangular overlaps that, analogously to Vθ(P), changes at overlap (resp.170 release)events where such a rectangular overlap appears (resp. disappears). See Figure 4. It is171 important to notice that there exist point configurations for which overlap and release events172 do not coincide with vertex events [8] and, hence, the computations of Vθ(P)and Sθ(P)are173 independent.174 2.2.1 On overlap and release events175 Let us label the points of Pin Vθ(P)(recall Equation 1) as v1, . . . , vmin increasing order176 according to the rotation xθof the x-axis. Let Wi θdenote the P-free θ-quadrant supported by177 two points vi, vi+1 ∈Vθ(P), see Figure 4(a), and proceed analogously for Vθ+π 2(P),Vθ+π(P),178 and Vθ+3π 4(P). The P-free θ-quadrants obtained, that define the boundary of RHθ(P), will179 be called extremal. We say that two such θ-quadrants with a difference of πin the subindex,180 e.g., Wi θand Wj θ+π, are opposite, see again Figure 4(a). When the intersection of two opposite181 extremal θ-quadrants is nonempty, as in Figure 4(b) where Wi θ∩Wj θ+π=∅, we say that they182 overlap, and we denote their intersection by Sθ(i, j). Thus, the set Sθ(P)of rectangular overlaps183 defined above is composed by these Sθ(i, j).184 Recall, from the beginning of Subsection 2.1, that for a fixed value of θthe set Vθ(P)of185 vertices can be computed in optimal O(nlog n)time and O(n)space. For that fixed θ, the set186 6 vi vi+1 vj vj+1 xθ0 Wi θ Wj θ+π (a) vi vi+1 vj vj+1 xθ0 (b) vi vi+1 vj vj+1 xθ0 xθ00 (c) Figure 4: (a) Overlap event (an overlap begins at angle θ′). (b) Overlap, which disconnects RHθ(P). (c) Release event (an overlap ends at angle θ′′). Sθ(P)of rectangular overlaps can be computed from Vθ(P)in O(n)time. In the following, we187 show how to efficiently maintain the set Sθ(P)while θincreases from 0to 2π. We now justify188 why overlaps were defined above only for opposite extremal θ-quadrants.189 Lemma 1. If two extremal θ-quadrants have nonempty intersection, then they have to be190 opposite. When this happens, RHθ(P)gets disconnected.191 Proof. In any pair of non-opposite θ-quadrants, one of them contains a ray parallel to a bounding192 ray of the other one. Since every extremal θ-quadrant is supported by at least two points of P193 (recall that it defines part of the boundary of RHθ(P)), if a pair of non-opposite extremal194 θ-quadrants had nonempty intersection, that would imply one of them not being P-free, a195 contradiction. See again Figure 4(b).196 This property will be useful in the next two subsections, where we will show that the number197 of overlap and release events is linear and, then, we will illustrate an algorithm to compute them198 in an optimal way.199 2.2.2 The chain of arcs200 Let the chain of arcs of P, denoted by A(P), be the curve composed by the points ain the plane201 which are apexes of a P-free extremal θ-quadrant Wafor some θ∈[0,2π). Notice that Wais202 supported by at least two points of P. The sub-chain associated to an edge eiof ∂(CH(P)) will203 be defined as the curve Aeicomposed by those points asuch that Waintersects ei. See Figure 5,204 left. This sub-chain Aeiis monotone with respect to ei, since it is composed by arcs of circles,205 which have to be monotone in order for Wato intersect ei, and two consecutive monotone206 arcs whose extremal θ-quadrants intersect eican only form a monotone curve. Finally, since a207 sub-chain may have vertices not belonging to P, we call link to the part of a sub-chain which208 lies between two points of P. See Figure 5, right.209 Note that, if a pair of opposite extremal θ-quadrants generates an overlapping region, then210 their apexes lie on intersecting links and the rectangular overlap lies in the area bounded by211 the intersection of the two links. See again Figure 5, left. Hence, in order to prove that the212 set Sθ(P)of overlapping regions can be maintained in linear time and space, we will prove that213 the number of overlap and release events is linear by proving that there is a linear number of214 intersections between links.215 7 pi pi+1 ei pi pi+1 Figure 5: Left: The arc-chain of P, highlighting the sub-chain associated to ei. Right: Highlighted, a link of that sub-chain. 2.2.3 The number of intersections between links is in O(n)216 Let us outline the flow of ideas in this subsection. We will construct a weighted graph, whose217 vertices are the sub-chain disks, defined as disks that have as diameter an edge of ∂(CH(P)).218 The edges of the weighted graph will join those sub-chain disks whose corresponding sub-chains219 intersect. The number of intersections will be, precisely, the weight of the edge. Then, the total220 number of intersections equals the sum of weights, which we are proving to be linear.221 Each point p∈Pcan be in at most four sub-chain disks, because pcan be the apex of at222 most four P-free wedges of size π 2(actually, of at most three when considering general position).223 Thus, each point p∈Pcan be in the intersection of at most (4 2)= 6 pairs of sub-chain disks,224 therefore contributing to the weight of at most 6edges of the weighted graph. We will prove225 that the weight of every edge in the graph is linear on the number of points from Pcontained226 in the corresponding sub-chain disks (Theorem 2). Therefore, the sum of weights in the graph227 will be linear on the total number of points in P, as aimed.228 We first need a series of three lemmas:229 Lemma 2. For any three points a, b, c appearing from left to right on a link, the angle ∠abc lies230 in [π 2, π). In particular, every link with endpoints p, q ∈Pis contained in the disk of diameter231 pq, which will be called its link disk.232 Proof. Since p, q are the endpoints of the link, hence consecutive points of Palong the chain,233 it turns out that b∈ P,Wbbeing a P-free extremal θ-quadrant. That ∠abc ≥π 2follows from234 a, c not being in the interior of Wb(otherwise this would not be P-free, either because some of235 a, c is in Por because one of the points of Psupporting the extremal θ-quadrants with apexes236 a, c is in the interior of Wb). That ∠abc < π follows from the orthogonal projections of pand237 qover the corresponding edge of ∂(CH(P)) being inside the intersection of that edge with Wb.238 See Figure 6.239 In the following lemma we identify the diameter of a link with the diameter of its link disk.240 Lemma 3. Consider the link disks in the two sub-chains associated to a pair of edges of the241 boundary ∂(CH(P)). The link disk Dof the smallest diameter can be intersected by at most five242 links from the other sub-chain Ae.243 Proof. Let Rbe the strip bounded by the lines that orthogonally project Dover the edge e244 associated to the sub-chain Ae. Because of the monotonicity, only the part of the sub-chain245 being inside Rcan intersect D(see Figure 7, left).246 8 b c Wb p q a Figure 6: Illustration of Lemma 2. e D R e p q r e Figure 7: Left: Only the part of the sub-chain being inside Rcan intersect D. Middle: There are no peaks at points of Pinside R. Right: At most 5links intersectD. If no arc in the sub-chain Aehas endpoints inside R, then at most one link can intersect D.247 Otherwise, we will see that the sub-chain Aehas no peaks at points of Pinside R: If there248 were a peak p∈R, let q, r be its neighbors, being rthe one closer to the edge e. The segment249 obtained by intersecting the parallel to ethrough qwith the strip R, determines a disk which250 does not contain the peak p, since the length of pq equals the diameter of a link-disk and, hence,251 has to be greater than the diameter of D, which equals the width of R. See Figure 7, middle.252 Then ∠qpr < π 2, a contradiction with Wpbeing P-free.253 Since Aehas no peaks at points of Pinside R, it can have at most one valley inside R254 and, therefore, at most five links from Aecan intersect D, since this is inside R. See Figure 7,255 right.256 Lemma 4. There are O(n)pairs of intersecting links in the two sub-chains associated to a pair257 of edges of ∂(CH(P)).258 Proof. Let Lbe the list of all those links, ordered by increasing diameter. From Lemma 3, the259 first link in Lis intersected by at most five of the remaining links in L. By removing this link260 from L, we get that the next link in the list is also intersected by at most a constant number of261 links. As there is a linear number of arcs and each arc belongs to a single link, there is also a262 linear number of elements in L. Therefore, by recursively removing the link with the smallest263 diameter from L, the total number of intersecting pairs adds up to O(n).264 We are now ready to prove the main result of this section, Theorem 2, which implies that265 9 2.3.3 The overlapping regions411 According to Bae et al. [8] the area of the k-th overlapping region can be expressed as area(k(θ)) = |(xi−xj) cos(θ−α)+(yi−yj) sin(θ−α)|(6) × |(yi+1 −yj+1) cos(θ−α)+(yi+1 −yj+i) sin(θ−α)|, where (xi, yi)are the coordinates of the vertex pi, and similarly for pi, pi+1, pj,and pj+1. These412 four points are the vertices that support the overlapping θ-quadrants that generate k(θ).413 Contracting Equation 6 the area of the k-th overlapping region can be expressed as414 area(k(θ)) = Bk+Ckcos 2(θ−α) + Dksin 2(θ−α),(7) where Bk,Ck, and Dkare constants depending on the coordinates of the vertices supporting415 the overlapping θ-quadrants that generate k(θ). Equation (7) can be computed in constant416 time and there are O(n)overlapping regions in Sθ(P), so at any fixed value of θthe term417 ∑karea(k(θ)) can be computed in O(n)time. Overlap or release events require the term of a418 single overlapping region to be added to or deleted from ∑karea(k(θ)). As a vertex supports419 at most two extremal θ-quadrants, at an overlap event the terms of a constant number of420 overlapping regions are added or deleted.421 Before describing the minimum area algorithm, we need the next three important properties of422 area(RHθ(P)). First of all, from Lemma 4 in Bae et al. [8], there are configurations of points423 such that the optimal area does not occur at in- or out vertex events, i.e., the value of θfor which424 area(RHθ(P)) is minimum in (α, β)will be a value such that α < θ < β. Second, Equation (3)425 has O(n)terms for any θ∈(α, β)and thus, it can be reduced to426 area(RHθ(P)) = C+Dcos 2(θ−α) + Esin 2(θ−α)(8) in O(n)time. The terms C,Dand Edenote constants resulting from adding up the constant427 values in area(P(θ)) and in Equations (5) and (7). Finally, as Equation (8) has a constant428 number of inflection points in [0,2π), a constant number of operations suffice to obtain the429 value of θthat minimizes area(OHθ(P)) in (α, β). Notice that at this point we can also ask for430 the value of θthat maximizes area(OHθ(P)) in (α, β), and that, in fact, the maximum can be431 also take place in any of the extremes αor β.432 2.3.4 The search algorithm433 We now outline the algorithm to compute the angle θfor which RHθ(P)has minimum area.434 1. Compute the sequence of events.435 Compute the sequence of vertex in- and out-events, as described in Subsection 2.1, and436 the sequence of overlap and release events, as described in Subsection 2.2.4. Merge both437 sequences into a single circular sequence of angles < θ1, θ2, . . . , θm−1, θm, θ1>,m∈O(n),438 which we can represent in a circular table as in Figure 13. Clearly, while θincreases in439 [0,2π)the relevant features of RHθ(P)remain unchanged during each interval (θi, θi+1),440 and each angle θiis an in-, out-, overlap-, or release-event.441 2. Initialize the angular sweep.442 Represent the four θ-quadrants over the circular table, as we did in Figure 13. Without loss443 of generality, assume that the first (counterclockwise) defining ray of the first θ-quadrant444 16 intersects the angular interval (θ1, θ2). Compute the sets Vθ1and Sθ1for the current θ1 445 as before, and express area(RHθ(P)) for θ∈[θ1, θ2)using Equation (8). Compute the446 constant values in this equation considering the restriction θ∈[θ1, θ2). Optimize the447 resulting equation to compute the angle θmin (resp. θmax) of minimum (resp. maximum)448 area.449 3. Perform the angular sweep.450 Rotate simultaneously the four four θ-quadrants, as we did in Subsection 2.2.5. During451 the sweeping process, update Vθ(P)and Sθ(P)as explained before. Additionally, at each452 event:453 (a) Update Equation (8) by adding or subtracting terms as previously explained.454 (b) Optimize the updated version of Equation (8) to obtain the local angle of minimum455 (resp. maximum) area, and replace θmin (resp. θmax) if area(RHθ(P)) is improved.456 From Theorems 1 and 3, computing the sequences of vertex and overlap and release events457 takes O(nlog n)time and O(n)space. As both sequences have O(n)events, we require linear458 time to merge them into the sequence of events and thus, Step 1 consumes a total of O(nlog n)459 time and O(n)space. At Step 2, Vθ(P)can be computed in O(nlog n)time and O(n)space460 (see [17]), and Sθ(P)can be easily computed from Vθ(P)in linear time. An additional linear461 time is required to obtain Equation (8), while θmin (resp. θmax) can be computed in constant462 time. This gives a total of O(nlog n)time and O(n)space. Finally, by Theorems 1 and 4,463 respectively, maintaining Vθ(P)and Sθ(P)requires O(nlog n)time and linear space for each.464 Step 3(a) and Step 3(b) are repeated O(n)times (one per event in the sequence) and, as we465 described before, each repetition takes constant time. Therefore, to perform Step 3 we consume466 a total of O(nlog n)time and O(n)space. Notice that, after the sweeping process is finished, in467 additional O(nlog n)time and O(n)space we can compute both RHθ(P)and area(RHθ(P))468 for the angle θmin (resp. θmax) giving the minimum (resp. maximum) area.469 The optimality of the algorithm is clear since given RHθ(P)we can compute in linear time470 CH(RHθ(P)) = CH(P), and it is known that computing the convex hull of a set of npoints471 in the plane has an Ω(nlog n)time lower bound [23]. From this analysis, we obtain our main472 result.473 Theorem 5. Computing RHθ(P)for the value of θ∈[0,2π)such that RHθ(P)has minimum474 (or maximum) area can be done in optimal O(nlog n)time and O(n)space.475 3O-hull of a point set476 As mentioned in Section 1, orthogonal convexity can be generalized to consider a finite set O477 of kdifferent lines passing through the origin. A set is thus said to be O-convex if its intersection478 with any line parallel to an element of Ois either connected or empty. Following the lines in479 Section 2, here we study the O-convex hull of a set Pof npoints.480 3.1 Definitions481 Let us label the lines in Oas ℓ1, . . . , ℓk, so that i < j implies that the slope of ℓiis smaller than482 the slope of ℓj. We consider the set of lines in Obeing sorted by slope; otherwise we would483 spend O(klog k)time for that sorting and add this complexity to the total complexity of the484 upcoming algorithms. Nevertheless, the number kof lines will be smaller than the number n485 of input points of the problem because if k > n then, at most nlines can participate as it486 17 will becomes clear in Subsection 3.2.1, and thus O(klog k)will be in O(nlog n). However, the487 complexity of some of our algorithms can be sensitive to k, which will appear as a multiplicative488 factor.489 The origin splits each ℓiinto two rays riand ri+k, generating a set of 2krays. Hereinafter,490 indices are such that 2k+i:= i. Given two indexes iand j, we define the wedge Wi,j to be491 the open region spanned as we rotate riin the counterclockwise direction until it reaches rj. A492 translation of a Wi,j wedge will be called a Wj iwedge, and one of these will be said to be P-free493 if it does not contain any point of P. Of particular interest to us is the set of Wi+k i+1 wedges,494 i= 1, . . . , 2k, which we will call O-wedges for short. See Figure 16.495 r1 r2 r3 r4 r5 r6 r2 r4 r3 r5 r3 r5 r4 r6 r1 r5 r2 r6 r1 r3 Figure 16: Top: A set Owith k= 3. Bottom: From left to right, the corresponding Wi+1,i+k wedges for i= 1, . . . , 2k. We denote by Withe union of all the P-free Wi+k i+1 wedges. Thus, by analogy with the496 orthogonal case in Section 2, the O-hull of Pis (see Figure 17 for an example):497 OH(P) = R2\ 2k ∪ i=1 Wi. Figure 17: The set Oin Figure 16 and the O-hull OH(P)for a point set P. As in Section 2, we consider rotations of the axes by an angle θ. Let Oθbe the set of lines498 obtained after rotating the elements of Oby an angle θ. Clearly, the Oθ-hull of P, denoted as499 OHθ(P), changes while θgoes from 0to 2π, since rotating Oby an angle θmakes the wedges500 Wi,j rotate as well and, hence, the sets Wichange accordingly. We will denote the resulting set501 as Wi θ, so that OHθ(P)is now defined as (see Figure 18 for an example):502 OHθ(P) = R2\ 2k ∪ i=1 Wi θ. 18 Figure 18: Changes on the Oθ-hull OHθ(P)while changing θ. 3.2 Computing OH(P)503 In this subsection we provide an optimal O(nlog n)time and O(n)space algorithm to compute504 the O-hull OH(P)of a set Pof npoints. 505 3.2.1 Computing the vertices506 For each ri, compute first the directed line parallel to riwhich supports (the pre-computed)507 CH(P)leaving Pon its right side. Suppose, without loss of generality, that each of these lines508 intersects CH(P)at a single point, labelled psi,i= 1, . . . , 2k. Notice that it is not necessarily509 true that psiis different from psi+1 . Thus, ps1, ps2, . . . , ps2kare vertices of the boundary of the510 O-hull, ∂(OH(P)), see Figure 19, labelled as we meet them in counterclockwise order. Note511 also that these psimight not give all the vertices of ∂(OH(P)), see again Figure 19.512 Because of the definition OH(P) = R2\∪2k i=1Wi, we need to compute ∂(Wi)and this requires513 knowing when a wedge in Wican intersect the interior of CH(P). It is easy to see that there514 are wedges in Withat intersect the interior of CH(P)if, and only if, psi=psi+1 , and that any515 wedge in Wiintersecting the interior of CH(P)necessarily does so by intersecting an edge of516 ∂(CH(P)) whose endpoints pj, pj+1 fulfill si≤j, j + 1 < si+1. See Figure 19. Abusing the517 notation, let us denote by [si, si+1]the closed interval of those indices of vertices on ∂(CH(P))518 between siand si+1, called the stabbing interval of Wi. See the caption of Figure 19.519 Observation 2. If sbelongs to the stabbing interval [si, si+1]of a wedge in Wi, then the520 orientation of the edge esof ∂(CH(P)) belongs to the sector formed by the rays riand ri+1 521 in O. See Figure 19 once more. Also note that, if Ocontains the supporting lines of the h522 edges in ∂(CH(P)), then the stabbing interval of each of all the Wiis a point and therefore523 OH(P) = CH(P).524 It is easy to see that we can calculate the elements ps1, . . . , ps2kon ∂(CH(P)) in O(nlog n)525 time, in fact, in O(klog n)time. This gives us the endpoints of the stabbing interval [si, si+1].526 Only those intervals not being a single index will be needed, the others can be discarded. Next,527 we calculate the alternating polygonal chain on ∂(OH(P)) connecting psito psi+1 , which we528 refer to as staircase.529 19 ps1 =ps2 ps3 =ps4 ps5 ps6 r1 r2 r3 r4 r5 r6 r2 r4 r3 r5 r3 r5 r4 r6 r1 r5 r2 r6 r1 r3 Figure 19: Left: Recalling Figure 16. Right: The O-hull OH(P)in Figure 17, showing which edges of ∂(CH(P)), if any, are intersected by wedges in each Wi. Note that wedges in W1and W3, for which examples are lined instead of solid, do not intersect the interior of CH(P). For p1being the uppermost point and labelling counterclockwise the vertices of ∂(CH(P)), the stabbing intervals are [1,4],[4,6],[6,7], and [7,1]. 3.2.2 Computing the staircases530 The staircase connecting psito psi+1 is determined by wedges in Wiand is contained in the531 boundary ∂(Wi). Counterclockwise around OH(P), right turns arise at apexes of wedges in Wi 532 which we call extremal, and left turns arise at points of Pwhich we call the supporting points533 of those extremal wedges. See Figure 20.534 p r s Figure 20: Another OHθ(P)for the Oin Figure 16. Left: An extremal wedge in W6with apex p and supporting points rand s. Right: Opposite extremal O-wedges, one in W6and the other in W3. In dark, the overlapping region, which is now a rhomboid instead of a rectangle. Before presenting how to compute the staircase, let us note that OH(P)can also be dis-535 connected. Similarly to Subsection 2.2.1, we say that a pair of extremal wedges are opposite to536 each other if one of them is in Wiand the other in Wi+k(i.e., one is defined by parallels to the537 rays ri+1 and ri+kand the other by parallels to the rays ri+k+1 and ri). As seen in Figure 20, a538 non-empty intersection between two opposite O-wedges results in OH(P)being disconnected.539 In such case, we say that the intersecting wedges overlap, and refer to their intersection as their540 overlapping region. The following lemma is a straightforward generalization of Lemma 1.541 Lemma 5. If two extremal O-wedges have nonempty intersection, then they have to be opposite.542 When this happens, OHθ(P)gets disconnected.543 20 We now proceed with the computation of the staircases, starting by the computation of544 their supporting points. In order to do so, we make use of an algorithm by Avis et al. [7]. Let545 us call αithe angle defined by two consecutive rays riand ri+1, so that the wedges in Wihave546 aperture angle Θi=π−αi. We consider Θ = min{Θi:i= 1, . . . , 2k}and we will distinguish547 two cases: either Θ≥π 2or Θ<π 2according to the “well distributed” criteria of the lines in O.548 For the first case where Θ≥π 2, i.e., all the sectors defined by the klines have aperture angle549 at most π 2, the algorithm by Avis et al. [7] finds, in O(nlog n)time and O(n)space, the maximal550 Θ-escaping wedges, defined as those (i) having as apex a point p∈P, (ii) having aperture angle551 at least Θ, and (iii) being P-free, i.e., not containing any point of Pin its interior. (In other552 words, maximal Θ-escaping wedges are the maximal wedges allowing an angle Θto escape from p553 without hitting other points of P.) The points being apexes of a maximal Θ-escaping wedge554 are called Θ-maxima. Indeed, for each such wedge the algorithm by Avis et al. [7] provides its555 two defining rays. Thus, the algorithm gives at most three maximal Θ-escaping intervals for556 every p∈P, hence a linear number in total.557 p . . . Figure 21: Left: Escaping intervals for a point pand Θ = π 2as in Figure 16. Right: Circular table where the solid circles correspond to the points p1, . . . , pnfrom the inside to the outside. On them, the Θ-escaping intervals, where the ones for the pdepicted in the left are highlighted. In gray, the stabbing interval corresponding to the wedge W2,4from Figure 16 (the other stabbing intervals are omitted for the sake of clarity). Finally, the innermost circle reflects, as small marks, the vertex events in [0,2π)corresponding to the endpoints of the escaping intervals. We will store these intervals in a circular table, together with the stabbing wedges Wi+1,i+k.558 See Figure 21. Doing so, when a stabbing wedge Wi+1,i+kfits into the escaping interval of a559 point p, we know that pis not only a Θ-maxima, but actually a Θi-maxima, which is indeed560 equivalent to be a supporting point in ∂(Wi). (In Figure 21, right, the gray stabbing interval561 from the wedge W2,4does not fit into the black escaping interval, because in the left picture the562 wedge W4 2with apex pcannot escape from p.)563 Thus, in O(nlog n)time and O(n)space we can sort the endpoints of the two types of564 intervals and sweep circularly the table, stopping at the defining rays of the wedges Wi+1,i+kto565 check if the corresponding psupports the staircase contained on ∂(Wi). This gives the set V(P)566 of vertices of OH(P). It just remains to obtain the boundary of OH(P), for which standard567 techniques [23] can be used in order to compute the staircases ∂(Wi)from their supporting568 points and to join them in O(nlog n)time and O(n)space. Hence, we have computed OH(P)569 in O(nlog n)time and O(n)space. This time complexity is optimal, since given OH(P)we can570 compute in linear time CH(OH(P)) = CH(P), and it is known that computing the convex hull571 21 of a set of npoints in the plane has an Ω(nlog n)time lower bound [23]. Therefore, we get the572 following result.573 Theorem 6. Given a set Oof klines such that Θ≥π 2,OH(P)can be computed in optimal574 O(nlog n)time and O(n)space.575 For the second case where Θ<π 2, the algorithm from Avis et al. [7] also works for Θ<π 2, but576 now in O(n Θlog n)time and O(n Θ)space. The algorithm gives at most 2π Θmaximal Θ-escaping577 intervals for every p∈P. Thus, we can construct a circular table as above, storing at most 2π Θ 578 circular intervals for each p, hence using O(n Θ)space in total. Therefore, the previous result is579 extended as follows:580 Theorem 7. Given a set Oof klines such that Θ<π 2,OH(P)can be computed in O(n Θlog n)581 time and O(n Θ)space.582 Note that the value 1 Θcan be considered a constant for not too small values of Θ.583 3.3 Computing and maintaining OHθ(P)584 Recall that, as we rotate Oby an angle θto obtain Oθ, the wedges Wi,j also rotate. Thus, the585 sets Wichange accordingly, giving rise to the sets Wi θ. The rotated hull Oθ-hull of Pis then586 (recall Figure 18):587 OHθ(P) = R2\ 2k ∪ i=1 Wi θ. Let ∂(Wi θ)denote the boundary of Wi θ. As in Subsection 3.2.2, ∂(Wi θ)is an alternating588 polygonal chain, or staircase, with interior angle Θi=π−αiwhere, in counterclockwise direction589 around OHθ(P), right turns arise at apexes of Oθ-wedges in Wi θ, called extremal, and left turns590 arise at points of Pwhich are the supporting points of those extremal wedges. Recall Figure 20.591 The following lemma follows directly from Lemma 5.592 Lemma 6. If two extremal Oθ-wedges have nonempty intersection, then they have to be opposite.593 When this happens, OHθ(P)gets disconnected.594 As in Subsection 3.2.2, let Θ = min{Θi:i= 1, . . . , 2k}for Θi=π−αi, and again we will595 consider the two cases above.596 The first case is where Θ≥π 2. We next show how to maintain OHθ(P)for θ∈[0,2π). As in597 Subsection 2.2, we will denote by Sθ(P)the set of overlapping regions in OHθ(P), and by Vθ(P)598 the set of vertices of OHθ(P)in counterclockwise order while traversing ∂(Wi θ),i= 1, . . . , 2k.599 Applying a rotation of angle θto the set Ochanges the OHθ(P). In particular, the sup-600 porting vertices of the staircases ∂(Wi θ)might change. We now aim to update those staircases, 601 in O(log n)time per insertion or deletion of a point. In order to do so, we need to maintain602 the (at most) 2kstaircases into (at most) 2kdifferent balanced trees, one for each staircase.603 Notice that some of the staircases may appear and/or disappear during the rotation. The total604 insertion or deletion operations can be done in O(kn log(kn)) = O(kn log n)time.605 Using the circular table in Figure 21, we can rotate the (gray) stabbing wedges Wi+1,i+k,606 stopping at events arising when a defining ray of a stabbing wedge hits a vertex event in607 the innermost circle, i.e., entering or leaving an escaping interval (black). This provides the608 information about whether the stabbing wedges fit or not into the escaping intervals and this,609 as in Subsection 3.2.2, allows to handle the insertion or deletion of points in the set Vθ(P)of610 vertices of OHθ(P)(i.e., the points on the staircases). Since the number of escaping intervals611 for a point is at most three and during the rotation these can arise in any of the 2kwedges612 corresponding to rotated Wi+1,i+k, there are O(kn)events. Thus, we get the following result.613 22 Theorem 8. Given a set Oof klines such that Θ≥π 2, computing and maintaining the614 boundary of OHθ(P)during a complete rotation for θ∈[0,2π)can be done in O(kn log n)time615 and O(kn)space.616 Furthermore, it is easy to see that while running our algorithm, we can keep track of the617 parameters in the following result.618 Corollary 1. Given a set Oof klines such that Θ≥π 2, computing an orientation θsuch that619 the boundary of OHθ(P)has minimum number of steps, or minimum number of staircases,620 or it is connected, or it has the minimum number of connected components, can be done in621 O(kn log n)time and O(kn)space.622 Now, as in Section 3.2, we can also handle the second case where Θ<π 2.623 Theorem 9. Given a set Oof klines such that Θ<π 2, computing and maintaining the624 boundary of OHθ(P)during a complete rotation for θ∈[0,2π)can be done in O(kn Θlog n)time625 and O(kn Θ)space.626 Corollary 2. Given a set Oof klines such that Θ<π 2, computing an orientation θsuch that627 the boundary of OHθ(P)has minimum number of steps, or minimum number of staircases,628 or it is connected, or it has the minimum number of connected components, can be done in629 O(kn Θlog n)time and O(kn Θ)space.630 Another interesting consequence of Theorem 9 is that we can also generalize Theorem 1 to631 the case where k= 2 and the two lines are not perpendicular.632 Corollary 3. For a set Ogiven by two non-perpendicular lines, computing and maintaining633 the boundary of OHθ(P)during a complete rotation for θ∈[0,2π)can be done in O(n Θlog n)634 time and O(n Θ)space, where Θis the smallest aperture angle of the sectors defined by the two635 lines.636 3.4 Finding the value of θfor which OHθ(P)has minimum area637 The results in Subsections 2.2 and 2.3 can be adapted to the case of a set Oof klines through638 the origin such that all the sectors they define have aperture angle at most π 2, i.e., with Θ≥π 2.639 Again, for a fixed value of θ, we can compute the area of OHθ(P)using the fact that640 area(OHθ(P)) = area(P(θ)) −area(P(θ)\ OHθ(P)),(9) where P(θ)denotes the polygon having the points in Vθ(P)as vertices and an edge connecting641 two vertices if they are consecutive elements in Vθ(P). Again, we will compute the area of 642 P(θ)\ OHθ(P)by decomposing it into two types of regions: (i) The triangles defined by every643 pair of consecutive elements in Vθ(P), and (ii) those rhomboid overlaps between two triangles644 which make OHθ(P)be disconnected. Recall Figures 3 and 20.645 By Theorem 8, the triangles in (i) above can be maintained in O(kn log n)time and O(kn)646 space. While θincreases from 0to 2π, the set Vθ(P)of points on ∂(OHθ(P)) changes at the647 values of θwhere a point of Pbecomes (resp. is no longer) a vertex of OHθ(P). These angles648 are again called insertion (resp. deletion)events.649 Next, we will deal with the rhomboids in (ii), showing how to maintain the set Sθ(P)of650 rhomboid overlaps which, analogously to Vθ(P), changes at overlap (resp. release)events. We651 will use the same techniques as in Subsection 2.2, but repeating the process at most ktimes, i.e.,652 computing separately all the possible overlapping rhomboids for each pair of opposite staircases653 in OHθ(P)while θincreases in [0,2π).654 23 3.4.1 The sequence of overlap and release events655 Let us denote an overlap as Sθ(i, j), and let Sθ(P)be the set of all overlaps Sθ(i, j)of OHθ(P),656 for angle θ. By Theorem 8, for a fixed value of θ,OHθ(P)can be computed in O(kn log n)time657 and O(kn)space, and then Sθ(P)can be computed from Vθ(P)in O(n)time.658 To maintain the set Sθ(P)while θincreases from 0to 2π, we will compute a sequence of659 events for each pair of opposite staircases, computing their overlap and release events. The660 events of each pair are computed independently, and then the ksequences are merged in O(kn)661 time to form the definitive sequence of all overlap and release events.662 By Lemma 6, only opposite staircases ∂(Wi θ)and ∂(Wi+k θ)can intersect, i.e., for any θ,663 only one pair {i, i +k}of opposite staircases can intersect, making OHθ(P)disconnected. The664 corresponding intersection can be composed of several overlapping regions, which we will show665 next how to maintain as θincreases.666 We will adapt the definitions and observations in Subsection 2.2.2, highlighting the differ-667 ences. First, the chain of arcs is defined in the same way, with the only difference that the locus668 of the points being apexes of P-free extremal θ-wedges might be “flatter arcs”, with curvature669 smaller than or equal to that of circle arcs, since the aperture angles of the wedges are now at670 least π 2instead of exactly π 2. Naturally, the possibility of the arcs being flatter does not affect671 to the monotonicity of a sub-chain Aeiwith respect to an edge eiof ∂(CH(P)). The property672 of overlapping regions corresponding to intersecting links is also maintained. The reader might673 recall Figure 5, considering the possibility that flatter arcs appear.674 Next, we adapt Subsection 2.2.3 to see that the number of intersections between links is675 now in O(kn). For that, it is enough to check that Lemmas 2, 3, and 4 are valid for each of the676 kpairs of opposite staircases in OHθ(P)and, using them, Theorem 2 is still true for each of677 the O(k)pairs of opposite staircases in OHθ(P). It is important to notice that the assumption678 of Θ≥π 2in this Subsection 3.4 is needed for these two last paragraphs to work.679 Then, we can adapt Subsection 2.2.4 to compute the sequence of overlap and release events.680 In order to do so, we proceed with an algorithm analogous to the one outlined there, but681 computing in O(nlog n)time and O(n)space the sequence of overlap and release events for682 each pair of opposite staircases. After doing so, we merge the ksequences of overlap and release683 events obtained into a single sequence of overlap and release events, obtaining the sorted events684 during a complete rotation of θfrom 0to 2π. In this way, we get the following result, which685 generalizes Theorem 3.686 Theorem 10. The sequence of overlap and release events for OHθ(P), while θincreases from 0687 to 2π, can be computed in O(kn log n)time and O(kn)space. 688 In order to sweep the sequence of overlap and release events, we store again the events689 sequence as points on a circle [0,2π), over which we represent the wedges Wi+1,i+kin a similar690 way as we did in the innermost circle in Figure 21, right (where we stored the vertex events691 instead). Proceeding as in Subsection 2.2.5, but considering that now we have at most O(kn)692 total overlap and release events, we get the following result, which generalizes Theorem 4.693 Theorem 11. Using the sequence of overlap and release events for OHθ(P), the set Sθ(P)can694 be maintained while θincreases in [0,2π)using O(kn)time and O(kn)space.695 3.4.2 Computing minimum area696 The final step is to compute the value of θthat minimizes (or maximizes) the area of OHθ(P).697 We show next how to compute this angle in O(kn log n)time and O(kn)space.698 24 Let α,βbe two events (of any type) such that (α, β)is an angular interval in [0,2π)containing699 no events. Extending Equation 9 and mimicking Equation 3, we express the area of OHθ(P)700 for any θ∈(α, β)as follows:701 area(OHθ(P)) = area(P(θ)) −∑ i area(△i(θ)) + ∑ j area(♢j(θ)).(10) As before, P(θ)denotes the polygon having the points in Vθ(P)as vertices, and an edge connect-702 ing two vertices if they are consecutive elements in Vθ(P). The term △i(θ)denotes a triangle703 defined by two consecutive vertices p, q ∈ Vθ(P). The boundary of this triangle is formed by the704 line segment pq and one of the current Oθ-wedges in Wi θsupported by pand q. As the aperture705 angle of an extremal wedge is at least π 2, the triangle is now either rectangular (Figure 3) or706 obtuse (Figure 22). Finally, the term ♢j(θ)denotes the j-th overlapping region in Sθ(P), which707 is now either a rectangle (Figure 3) or a rhomboid (Figure 23).708 We now show that, for any particular value of θ, we can evaluate Equation (10) in O(kn log n)709 time and, as θincreases from 0to 2π, a constant number of terms need to be updated at each710 event, regardless of its type.711 The polygon. At any fixed value of θthe area of P(θ)can be computed from Vθ(P)in O(n)712 time. The term area(P(θ)) changes only at vertex events. These events can be processed in713 constant time, since at an insertion (resp. deletion) event, the area of a single triangle needs to714 be subtracted (resp. added) to the previous value of area(P(θ)), as the same as in Figure 14.715 The triangles. Let pand qbe two consecutive vertices in Vθ(P)such that pprecedes q. Sup-716 pose that, for any θ∈(α, β), the points pand qdefine the triangle △i(θ). This triangle is717 bounded by pq and an extremal wedge supported by pand q. Let ω≥π 2denote the aperture718 angle of the extremal wedge, and ωpand ωqdenote respectively, the internal angles of △i(α)719 at pand q. See Figure 22.720 r1 r5 (a) p q ω (b) Figure 22: Computing the area of a triangular region. (a) The wedge of size ωthat bounds the triangle. (b) The triangle defined by pand q. The area of △i(θ)can be expressed as721 area(△i(θ)) = |pq|2 2 sin(ω)·sin(ωp+ (θ−α)) ·sin(ωq−(θ−α)),(11) and expanding Equation (11) we obtain area(△i(θ)) = A·cos2(θ−α) + B·cos(θ−α)·sin(θ−α) + C·sin2(θ−α) =D+E·cos(2(θ−α)) + F·sin(2(θ−α)),(12) 25