Canonical polygon Queries on the plane: a New Approach

The polygon retrieval problem on points is the problem of preprocessing a set of $n$ points on the plane, so that given a polygon query, the subset of points lying inside it can be reported efficiently. It is of great interest in areas such as Comp…

Authors: Spyros Sioutas, Dimitrios Sofotassios, Kostas Tsichlas

Canonical polygon Queries on the plane: a New Approach
Canonical Polygon Queries on the Plane: A Ne w Approach S. Sioutas, D. So fotassios, K. Tsichlas, D. Sotiropoulos , P . Vlamos Ionian University-Department of Inform atics, Comp uter T echnolog y Institute, Aristotle University of Thessaloniki-I nform atics Department, Greec e Email: sioutas@ionio.gr, sofos@cti.gr , tsichlas@csd.auth.gr, { dgs,vlamos } @ion io.gr Abstract — The polygon retriev al problem on points is th e problem of preprocessing a set of n points on the plane, so that given a polygon qu ery , the sub set of points lyin g inside it can be reported efficiently . It is of grea t int erest in areas such as Computer Graphics, CAD applications, Spatial Databases and GIS deve loping tasks. In thi s paper we study the problem of canonical k -vertex polygon queries on the plane. A canonical k -vertex polygon query always meets the follo wing specific property: a point retriev al query can be transf ormed into a lin ear n umber ( with respect to the number of vertices ) of point retrie vals f or orthogonal objects such as rectangles and triangles (throughout this work we call a triangle orthogonal iff two of its edges are axis- parallel). W e present two new algorithms for thi s problem. The first one requires O ( n log 2 n ) space and O ( k log 3 n log log n + A ) query time. A si mple modification scheme on first algorithm lead us to a second soluti on, whi ch consumes O ( n 2 ) space and O ( k log n log log n + A ) query time, wh ere A denotes th e si ze of th e answer and k is the number of vertices. The best prev ious solution f or the general polygon re triev al p roblem uses O ( n 2 ) space and answers a qu ery i n O ( k log n + A ) time, where k is the n umber of ve rtices. It is also v ery complicated and difficult to be implemented in a standard imperativ e program ming language su ch as C or C++. Index T erms — Algorithms and Complexity , Data Struc- tures, Computational Geometry , Sp atial Databases. I . I N T R O D U C T I O N Giv en a set S o f n points on the p lane, the problem of retrieving a subset S ′ ∈ S that lie in the interior of a planar geometric o bject is of great in terest in th e areas of Comp utational Geometry , Spatial Databases, Com puter Graphics, CAD and GIS ap plications. The ef ficiency of the solutions pr esented so far dep ends on the existence or not of orthog onality on the query object, which means that not all the line segments f orming the quer y figure ar e vertical or horizontal. A range tree [20] for a example, is powerful enough to su pport windowing of points (i.e. the query object is an arbitrar y axis-parallel rectang le) in O (log n + A ) time using O ( n lo g n ) space. Th e prob lem b ecomes har der as the com plexity of the q uery object increa ses (i. e. triang le, quadrilater al, arb itrary polygo n), a nd there is no full orthog onality . It is importan t to no tice that the po int re triev al prob lem for simple polygons is an interesting pr oblem for many This is the extende d and correct version of that one prese nted in proceed ings of Australasian W orkshop On Combinatorial Algorithms 2004(A WOCA 04). application areas. In med icine f or example, the term R OI, which stands for Region Of Interest, is widely used by physisians in ord er to in dicate a po lygona l region o f arbitrary c omplexity on their scene (i. e. Radiology Im- age). Many in formation systems d ev eloped so far support retriev al queries at such a region by first computing its bound ing rectangle. Th en, they rep ort all the points inside the rectangle an d finally these points ar e filtered so th at only the points inside the region remain. W illard [15 ], was the first to p resent a solution for the point retriev al pr oblem f or simple k - vertex po lygons. It uses O ( n ) space and the query time is O ( n 0 . 77 + A ) . Edelsbrun er and W elzl [10], reduced the q uery time to O ( n 0 . 69 + A ) . A faster algorithm was presented by E delsbrun er , K irkpatrick and M aurer [9] that uses O ( k log n + A ) q uery time and O ( n 7 ) space. Cole and Y ap [6], presented a method u sing O ( n 2 / lo g n ) space and O ( k log n log log n + A ) time. Finally , Paterson and Y ao [13] have presented the be st kno wn solutio n (for a simple arbitrary po lygon) . This solution uses O ( n 2 ) spa ce and answers a query in O ( k log n + A ) time. In this work we consider the p olygon retriev al p roblem on points in special ca se of cano nical po lygons which always satisfy the following strict pr operty: a retriev al query on a set of points can b e transformed to a linear number (on the numb er of their vertices) of queries on orthog onal o bjects such as rectangles and trian gles. W e call a triangle o rthogo nal if f two of its ed ges are axis- parallel. W e present two solutions: The first o ne re quires O ( n log 2 n ) space an d O ( k log 3 n loglo gn + A ) query time. The second o ne co nsumes O ( n lo g n ) spac e and O ( k logn loglo gn + A ) qu ery time, where A d enotes the size of the answer and k is the num ber of vertices. The b est previous solution for the gen eral p olygon retriev al pro blem uses O ( n 2 ) space and answers a query in O ( k lo g n + A ) time, wh ere k is the numbe r of vertices. This pap er is organized as follows. In Sectio n II we briefly in troduce some preliminary data stru ctures. In Section III we giv e th e details of our algor ithms. In Section IV we present some special extensions for the general p olygon retr iev al problem based o n alg orithm of Paterson an d Y ao for which we shortly introdu ce the fund amental notions. Finally , some conclusion s and further extension s concernin g this pr oblem are c onsidered in Section V. I I . P R E L I M I N A RY D A TA S T RU C T U R E S A. Fusion T r ees At A CM STOC 1990, Fredman and Willard [1 1] sur- passed the comparison -based lower bounds for s orting and searching using the features in a standard impera ti ve p ro- grammin g lan guages such as C . Th eir key r esult was an O ( l og n/l og l og n ) time bou nd for determin istic searching in linear space. The time b ounds fo r dynamic search ing include b oth sear ching an d upda tes. Since then much effort has been sp ent o n find ing the inh erent com plexity of fundam ental searchin g pr oblems. B. Plana r P oin t Lo cation in Subloga rithmic T ime T imothy M. Chan [1] and Mih ai Patrascou [18 ] ex- tended the 1-dimension al fusion tree [11] to 2-dimensions, in order to handle the p oint locatio n problem in O ( l og n/l og l og n ) time and linear O ( n ) space. C. Half Plane Ran ge Query The half plane ran ge q uery prob lem is the problem of reportin g all the po ints in a set S of n poin ts o n the plane that lie on a g i ven side of a query line L . T his section combines the m ethod presented by Chazelle, Guib as, an d Lee [5] that achieves O (lo g n + A ) query time and linear space (using the no tion of duality) with the best cur rent method fo r plan ar point lo cation pro blem [1], [1 8]. The main steps of algorithm [5] are the following: • Prepro cessing 1) Partition S into a set o f con vex lay ers: (a) De fine S i as the conv ex h ull of all the points curren tly in S (b) Remove the vertices of S i from S (c) Incremen t i , repe at the process The time cost is O ( n log n ) while the spa ce complexity is O ( n ) , using a technique that computes con vex hulls in a dynamic en viron- ment [2]. 2) Augm ent the set of layers building vertical con- nections as fo llows: for each vertex w of lay er S i , keep a pointer to the two edges immediately above and below w . This clearly u ses O ( n ) extra space. 3) Using d uality , the tran sformation of each vertex w into its c orrespon ding line m aps each laye r into another conve x polygo n. The prod uced mapping is organized into a po int location structure, occupying O ( n ) space. • Query Processing 1) Given a query line L tr ansform it into its correspo nding dual poin t P L . 2) Apply a p lanar p oint loca tion algo rithm for the point P L in the p roperly organized structure. This d etermines the in nermo st layer am ong the layers contain ing the point P L . Th us, in the dual mapp ing it determines the inn ermost layer among the layers that L intersects. Call this layer neighb oring . Using the best cu rrent p oint location algorithm , this co sts O ( l og n/l og l og n ) time. 3) Using th e p ointers m entioned at step 3 of the prepro cessing p rocedu re, i t is easy to report one vertex lying at the qu ery half plane fo r each layer which encloses the neigh boring on e. 4) Tra verse each layer from each of the vertices reported across the part of the layer inside the half plane. Report the vertices tra versed. Clearly , th ese step s lead to an alg orithm fo r answer- ing ha lf plane range q ueries u sing O ( n ) space and O ( l og n/l og l og n + A ) qu ery time. W e use this me thod in order to an swer orthogon al triangle range queries on points. D. Priority Searc h T r ee In this su bsection, we b riefly revie w th e prio rity search tree of McCreight [ 16]. Let S be a set o f n poin ts on the plane. W e want to stor e them in a data structure, so th at the points that lie inside a semi-infinite strip of the for m ( −∞ , b ] × ( −∞ , c ] , can be found efficiently . The pr iority search tree is a binar y search tree over the x -coordin ates of the points. Th e ro ot of the tr ee co ntains the point p with the minimum y -c oordin ate. Th e left (resp. right) subtree is recursively defined for the set of po ints in S − { p } . Th e set S − { p } is partitioned equ ally into the two sub trees o f the root. As a result, it is easy to see, that a poin t is stored in a node on th e search path fro m the root to the leaf conta ining its x -co ordina te. Queries with ranges that are half-infin ite in both x and y directions are also kn own as quad rant range sear ch . T o answer a quad rant range que ry , we find the O (lo g n ) nodes in the searc h path P b for poin t b . Let L b be the left children o f these node s that do no t lie on the path (see Figure 1). In O (log n ) time , the points of the nodes of P b S L b that lie in the quer y-rang e can be deter mined. Then, f or eac h n ode o f L b storing a p oint inside the range query , its two ch ildren are visited an d checked wheth er their points lie in the ran ge. This procedur e co ntinues recursively , as lo ng as points in the query-range are found. The cor rectness of the q uery algorithm is proved as follows. First, observe that nodes to the r ight of the sear ch path, have points with x -coord inate larger than b and therefor e lie outside the quer y-rang e. The points of P b may have x -coor dinate larger than b o r they may have y - coordin ate larger than c . In any case, they a re not re ported. The nodes of L b and their descendants hav e points with x - coordin ate smaller than b , so that only their y -coord inates need to be tested. The children of nodes of L b with y - coordin ate less than c must be co nsidered. In particu lar , the reporting proce dure pro ceeds recu rsiv ely , as long as points inside the query range are fou nd. I f a p oint of a node u d oes n ot lie in side the qu ery-ra nge, then th is p oint has y -coo rdinate larger than c . Theref ore, all poin ts in th e r b Fig. 1. P b : the search path, L b : the nodes that are left sons of nodes on P b and do not belong to the path. subtree roo ted at u lie ou tside the quer y-rang e and they are not reported. W e can easily bound the query time by O (log n + t ) , since O (log n ) time is needed to visit the nod es in P b S L b and O ( t ) time is necessary for the reportin g proce dure in th eir subtrees. E. P ersistent Modified Priority Sear ch T ree In th is subsection, we briefly review the Modified Priority Search T ree of siou tas et al. [21]. Le t S be a set of n po ints on the p lane with coord inates ( x, y ) , where x ∈ { 1 , . . . , M } and y ∈ ℜ . W ithout loss of generality we assume that all poin ts are distinct. W e will show how to store th e points in a d ata structure T , so that the t po ints in a quer y ra nge of the form ( −∞ , b ] × ( − ∞ , c ] , can be found in O ( t ) time. Our structure relies on the prior ity search tre e, which we augmen t with list-structures sim ilar to those in [17 ]. W e denote by T v the subtree of T with root v . The tree structure T has the following prop erties: • Each po int of S is stored in a leaf of T and the points are in sorted x -order from left to righ t. • Each intern al node v of T stores a point p ( v ) of S . The po int p ( v ) is the poin t with th e minimu m y - coordin ate amongst the po ints stored in the leaves of T v . • Each nod e v is equip ped with a secon dary list S ( v ) . S ( v ) contains the p oints stored in the leaves o f T v in increasing y -co ordina te. For con venience we will assume that the tree T is a complete binar y tree (i.e. all its leaves h av e depth log n ). Note th at if n is not a power of 2 , th en we may a dd some dummy leaves so that T becomes com plete. W e also use an array A of size M , which stores pointer s to the leaves of T . Specifically , A [ i ] co ntains a po inter to the leaf of T with max imum x -coord inate smaller or equal to i . This array is used to d etermine in O (1) time the leaf of the search path P b for b . In each leaf u o f the tree with x -coor dinate i we store the lists L ( u ) and P L ( u ) . The list L ( u ) stores the p oints of the node s of L i . The list P L ( u ) stores the points of the nodes of P i which ha ve x -coordin ate smaller or eq ual to i . Both lists also co ntain po inters to the n odes of T th at con tain these points. Each list L ( u ) , P L ( u ) , stores its n odes in increasing y -coo rdinate o f their points (see Figure 2). r L(u) P L (u) Fig. 2. L ( u ) : it stores the points of the nodes of L i . P L ( u ) : it stores the points of the nodes of P i which have x -coordinat e smaller or equal to i . T o answer a qu ery of the form ( −∞ , b ] × ( −∞ , c ] we find in O (1) time the leaf u of the search path P b for b . Then, we tra verse the list P L ( u ) and repor t its po ints until we find a point with y -coord inate greater than c . W e traverse the list L ( u ) in the same manner and find the nodes v of L b whose points have y - coord inate less than or equal to c . For each such node v we traverse the secondary list S ( v ) an d report its points un til we find a point with y -coo rdinate g reater than c . The f ollowing theorem boun ds the size and the qu ery time of our structure. Theorem 1. Given a set of n po ints on the plane with coordin ates ( x, y ) such that x ∈ { 1 , . . . , M } and y ∈ ℜ , we can store them in a data stru cture with O ( M + n log n ) space that supp orts quad rant range queries in O ( t ) time, where t is the num ber of repo rted points. Proof. Th e qu ery algor ithm finds the t ′ points o f nodes of P b S L b that lie inside the query-ran ge in O ( t ′ ) time by simp le tra versals o f the lists P L ( u ) , L ( u ) . The search in the respective sub trees T ( v ) can be perform ed by traversing the seco ndary lists S ( v ) an d takes O ( t ) additional time for rep orting t p oints in total. Th erefore , the query algorithm need s O ( t ) ti me. Each list P L ( u ) , L ( u ) stores the r espectiv e poin ts in the nodes of the p ath from root to u , and p oints in the left children of nodes of this path. So, the size o f each list is O (log n ) an d the space of T is O ( n log n ) . The total space of secondary lists S ( v ) is also O ( n ) . Th us, th e space of the whole structure is O ( M + n lo g n ) becau se of the size of th e array A . The O ( n log n ) term in the space b ound is du e to the size of the lists P L ( u ) and L ( u ) . W e c an reduc e the total space of these lists to O ( n ) by making them p ersistent. Ordinary structures a re ephem eral in the sen se that u pdate operation s make p ermanen t changes to the structur es. Therefo re in or dinary structu res it is impossible to acc ess their old versions (bef ore the u pdates). Accord ing to the terminolo gy of Driscoll et al. [7 ] a structure is persistent, if it allows access to older version s of th e structu re. The re are tw o ty pes o f per sistent data structures: partially and fully persistent. A partially persistent data structure allo ws updates of its latest version only , while a fully persistent one a llows updates of any of its version s. In [ 7], a gen eral methodo logy is prop osed for making data structures of bound ed in-d egree per sistent. W ith their method such a structure can be made partially persistent with O (1) amortized space co st p er change in th e structur e. In o ur case a list can be made partially persistent with a O (1) amortized increase in space per insertion/d eletion. W e show how to implement the lists P L ( u ) using a partially per sistent list. L et u be a leaf in T and let w be its p redecessor (th e leaf on the left o f u ). W e den ote by x u the x -coor dinate of u and by x w , the x -coordinate of w . The two root-to -leaf paths P x u , P x w , share the nodes f rom the r oot of T to the nearest com mon ancestor of u , w . As a result, we can create P L ( u ) by updating P L ( w ) in the following way . First we delete from list P L ( w ) th e points that don’t lie on P x u . Then we insert the points of P x u which have x -coo rdinate smaller o r equal to x u . In this way we can construct all list s as versions of a persistent list: we begin from the leftmost leaf and construct the list P L ( u ) of each le af u by updating the one of its pred ecessor ( see Figure 3). r u w Fig. 3. Lists P L ( u ) and L ( u ) are implemented as partially persistent lists, by performing a sweep from left to right. The total number o f insertions a nd deletions is O ( n ) because each point is inserted an d de leted o nly once. Therefo re the space of all th e lists is O ( n ) . In the same way , lists L ( u ) are constructed for all leav es in O ( n ) space. Therefo re: Theorem 2. Given a set of n po ints on the p lane with coordin ates in the range [1 , M ] × R we can stor e them in a data structur e with O ( n + M ) spa ce th at allows q uadran t range qu eries to b e an swered in O ( t ) time, where t is the number of answers. The p repro cessing time is O ( M + n log n ) but with a more carefu l implementation we can redu ce this complex- ity to O ( M + n ) , by using the pruning tech nique as in [12]. F . Geometric T ransformation Of Duality In hom ogeneo us coordin ates, there exists a d uality between the point ( a, b, c ) and the line ( ax + by + cz = 0) for all ( a, b, c ) 6 = (0 , 0 , 0) . Further more, the f ollowing pairs are dual: • poin ts o n a line ← → lines thr ought a point • line segment ← → ”dou ble wed ge” o f lines • set of lines intersecting a line se gment ← → set of points in a double wedge (see Figure 4) A more form al definition of th is p owerfull too l can be found in [5]. Fig. 4. An example of Geometric Duality Tran sformation: Dual pairs I I I . A L G O R I T H M S F O R O RT H O G O N A L O B J E C T S A. Data Stru ctur es for Orthogonal T riangle Ran ge Queries An orth ogon al triang le range que ry is the problem o f determinin g all the points fro m a set S of n poin ts on the plane lying inside an orthogon al triangle. Recall, a triangle is o rthogo nal if f two of its edges a re ax is-parallel. Let T be an orthog onal triang le defined b y the point ( x q , y q ) an d the line L q that is not axis-pa rallel (see Figure 5). x q y q L q Fig. 5. An example of Orthogonal Triangle Range Query A retr iev al query fo r this pro blem can be sup ported efficiently by the following data structures: 1) First Solution: A 3-layered T ree: T o set up th e data structure , first sort the n p oints accord ing to th eir x -coordinates and then store the o rdered sequence in a leaf-or iented balan ced bina ry search tree of depth O (log n ) . This structure answers th e query: ”d etermine th e p oints having x -co ordina tes in the range [ x 1 , x 2 ] ” by trav ersing the two paths to the lea ves correspond ing to x 1 , x 2 . The poin ts stored as lea ves at the subtree s o f the nodes which lie between the two paths are exactly these points in the range [ x 1 , x 2 ] . F or each subtree, the points stored at its leav es are organ ized further to a seco nd lev el data stru cture acco rding to their y -coor dinates in the same way . For each sub tree o f the seco nd lev el da ta structure, the po ints stored at its leaves are organized fu rther to a third lev el m odified data structure of Chaze lle ( presented in sub section 2 .3) for half -plane ran ge que ry . So, each Orthog onal T riangle Range Qu ery is perfo rmed throu gh the following steps: a) In the tree stor ing the poin tset S accordin g to x -c oordin ates, traverse the path to x q . All the points h aving x -co ordina te in th e range [ x q , ∞ ) are stor ed at th e sub trees on the nod es that are r ight son s o f a no de of the search path and d o no t b elong to the path. There are at most ⌈ log n ⌉ such disjoint subtrees. b) For every suc h subtree traverse th e path to y q . By a similar argum ent as in the previous step, at most ⌈ log n ⌉ disjoint subtr ees ar e lo cated, storing po ints that h av e y -coord inate in the range [ y q , ∞ ) . c) For each subtree in Step 2, apply the half- plane r ange q uery algor ithm pr esented in sub- section 2.3 in ord er to retrieve the po ints that lie on the side o f line L q tow ards th e tr iangle. The correctness o f the above algorithm follows fr om the data stru cture u sed. Since we have to visit O (log n ) subtre es in each of the two first layers and the third lay er requ ires O ( logn loglo gn + A ) time, the overall query time beco mes O ( log 3 n loglo gn + A ) while the space complexity is O ( n log 2 n ) . 2) Second Solution: A two layered tree: Th e first layer is a linear space Persistent Modified Priority Search Tree. The second layer organizes eac h o f the O (log 2 n ) subsets of P L ( u ) and L ( u ) with th e modified structure of [5] presented in subsection 2.3 which returns a set of nodes v whose points lie inside the triang le. Then, it organizes each of the O ( n 2 ) subsets of S ( v ) with the same stru cture (see figure 6). More specifically , we find in O (1) time the leaf u of the search path P b for b . Each leaf u stores two y -order ed Persistent lists P L ( u ) an d L ( u ) , b oth of size O (lo g n ) . The total num ber of sub sets, which can be pro duced by tak ing all the possible y- ordered permutation s amon gst the y-c oordin ates of P L ( u ) and L ( u ) , is O (log n ) , sinc e each list P L ( u ) or L ( u ) consumes O (log n ) space in worst-case. Each subset has minimum size 1 and m aximum O (log n ) , thus their total sp ace is 1 + 2 + + l og n = O (log 2 n ) . W e can access the a pprop riate subset of points (according to y q - c oordin ate of the query ) in O (log log n ) time by applying a simple b inary searching. T hen we ap ply in the subset above a half plane r ange quer y (accord ing to query line L q ) in order to find the n odes v whose poin ts lie inside the trian gle. For e ach suc h no de v we o rganize its secondary list S ( v ) aga in as the mod ified struc- ture o f Chazelle presen ted in subsection 2 .3. Th e total nu mber o f subsets, which can be pr oduced by takin g all the po ssible y-or dered per mutations amongst the y-coo rdinates of S ( v ) , is O ( n ) , sin ce each seconda ry list S ( v ) consum es O ( n ) space in worst-case. Each sub set ha s min imum size 1 and maximum O ( n ) , thus the ir to tal space is 1 + 2 + + n = O ( n 2 ) . W e can access the appr opriate subset of poin ts (accord ing to y q - co ordinate of th e qu ery) in O ( logn loglo gn ) time by usin g th e f usion tree metho d [11]. T hen we ap ply in the subset above a ha lf plane range query (accord ing to query line L q ). As a con sequence th e overall qu ery time becom es O ( l og n/l og l og n + A ) and the sp ace c onsumptio n is O ( n 2 ) . x q v 1 v k v i u 1 u k S(u 1 ) S(u k ) u i P xq L xq S (u z ) S (u z(g) ) g O(n) S (u z(n) ) P xq r O(logn) i P xq(logn) P xq(r) L xq s O(logn) L xq(s) L xq(logn) P xq(r) L xq(s) S (u z(g) ) HP(P xq(r) ) HP(L xq(s) ) HP(S(u z(g) )) Fig. 6. The second solution . T he lists P , L, S and its respecti v e Half Plane (HP) structures B. The Results Every canonical k -vertex polygon can be decom posed into O ( k ) ortho gonal triangles b ecause of the strict sym- metry in the topology of the vertices. In Figur e 7 su ch a decomp osition is depicted . Fig. 7. Orthogonal triangle decomposition of a canonical octagon • Solution 1 : Que rying the 3-layere d data struc- ture O ( k ) times, th e O ( n log 2 n ) space and O ( k l og 3 n/l og l og n + A ) time follows. • Solution 2 : Querying the two layered data structure O ( k ) times, the O ( n 2 ) spac e a nd O ( k l og n/l og l og n + A ) time f ollows. I V . S O M E T H O U G H T S O N T H E G E N E R A L P O LY G O N R E T R I E V A L P R O B L E M A. The Algo rithm of P aterson and Y ao This section sketches the basic ideas o f the algorithm for p olygo n retrieval on points th at Paterson an d Y ao [13] have presented . This p roblem is to pre process a set S of n poin ts on the plane , so that for any query p olygon P the subset of them lyin g inside it can be reported ef ficiently . W e assume that the gi ven polygon is co n vex with k vertices. If not, ( P is n on-convex) th en a suitable dec omposition into conv ex parts ca n be carried out and the algorithm can be applied to every such part. The key-idea of Paterson/Y ao’ s algorithm is a further decom position o f ev ery conve x part into O ( k ) simpler par ts called qua ds . They solve the problem for each such q uad separately , using the we ll- known geo metric tr ansforma tion of duality . T o set up th e da ta structu re, Paterson/Y ao first sort the n points accord ing to their po lar angles at th e or igin and then store the ordered sequence in a leaf-oriented bal- anced b inary search tree of d epth O (log n ) . T his stru cture answers the query : ”de termine the points having po lar angle in th e range [ a 1 , a 2 ] by tra versing the two paths to the leav es correspon ding to a 1 , a 2 . The points stored as leav es at the subtrees of the nodes wh ich lie b etween the two paths are exactly these points in th e range [ a 1 , a 2 ] . F or each su btree, the p oints stor ed at its leaves are organized further to a second level data struc ture as f ollows: by the duality corresp ondenc e, th ese points are mapped to a set of straigh t lines, and a poin t lo cation struc ture is built for th is planar su bdivision [8]. Using this data structu re a query of the f orm: ”Report the po ints lying in a do uble wedge” is reduced to a query to the dual stru cture of the form: ”report the lines th at intersect a query line se gment. ” At this point, we are ready to give a step b y step description o f the polyg on r etriev al algorithm of Paterson and Y ao: 1) Let P be the k -vertex co n vex query p olygon . Sepa- rate P in to simpler region s called qu ads by cutting the plane into secto rs . T he sectors are ob tained by drawing sem i-infinite lines from the o rigin to each vertex of P . Each q uad has a particu larly simple form (it is the intersection of a sector and a doub le wedge). (see Figure 8) P O Origin sector Quad O Origin sector Fig. 8. An example of Sectors and Quads Every k -g on is th e disjoint un ion o f O ( k ) such quads . 2) Using the two-level data stru cture do the following for each quad with boun ding r ays ℓ 1 , ℓ 2 : • Determin e the (at mo st) 2 ⌈ l og n ⌉ disjoin t sub- trees that descend fr om th e two sear ch paths to the angles o f ℓ 1 , ℓ 2 and lie between th em. All the points b etween ℓ 1 and ℓ 2 are stored a s leav es in these subtrees. • for each such subtree in turn rep ort the poin ts inside th e doub le wedge de termining the q uad using the dual point location structu re. The space u sed is O ( n 2 ) b ecause of th e point lo cation structure and the query time is O ( k lo g n + A ) (th ere exist O ( k ) quad s and the time spent for every ” quad- retriev al” is O (log 2 n + A i ) which can be improved using the fractio nal cascading technique [4] on the p oint location structur es). It is worthw ile to note that the above algorithm works even when P is unbou nded. If P is non-co n vex, then the pre liminary decomp osition step into conv ex p arts does not c hange the asymptotic space and time bounds. Unfortu nately , th e O ( n 2 ) space bound is th e best pos- sible if we directly use th e dual po int location structu res. This me ans that in or der to red uce the space requir ements of the later algo rithm, we ha ve to find an alg orithm supportin g ”quad retrie val” without u sing the duality on a rbitrary sets of O ( n ) p oints wh ich lies to O ( n 2 ) space sub divisions. The next section demo nstrates such an algorithm working e fficiently when P is a can onical k -vertex polyg on. B. An Extended Appr oach In this section we presen t an extended ap proach f or th e general po lygon retriev al p roblem. Th e pro posed solution is based o n the algorithm of Paterson /Y ao fo r answering ”quad retrieval” quer ies, which was described in th e previous section . The key-idea is the re duction of a quad retriev al query to a con stant O (1 ) n umber of ortho gonal triangles retriev al q ueries. This is achiev ed by drawing parallel lines (vertical or h orizontal) fro m th e vertices of the quad so that th e lin es stay inside the quad and intersect the rays fro m the orig in. T o d o this, a suitable decomp osition of each quad is needed. In the gener al case of an a rbitrary (non canonical) k -vertex p olygon , such a decomp osition is not always possible. For example, the quad in Figure 9(a ) can b e decom posed into O (1) orthog onal tr iangles while the quad in Figure 9(b) canno t be decompo sed. O O (a) (b) Not part of the quad Vertical and horizontal supporting lines Fig. 9. An example of Quad Decomposition This o f course dep ends on various g eometric ch aracter- istics of the q uad. If the p olygon is k - vertex canonical, we can always directly carried out a d ecompo sition into O ( k ) orthog onal triangles because of the strict symmetry in the topology of the vertices. Arbitrary k -vertex po lygons satisfy such a decom position on ly in special cases. V . C O N C L U S I O N S In this work we p resented efficient algo rithms for the problem of canonical po lygon r etriev al queries on the plane. One d eficiency or our algorithms is that th ey are static. It seems very inter esting the dynamiza tion of p resented algo rithms. Furthermo re, it still remains an open problem whether an O ( n log O (1) n ) space and O (log O (1) n + A ) time alg orithm exists for the gen eral problem of arb itrary polygon retriev al queries. Finally , it would b e of gr eat importan ce the incorpo ration of the proposed algo rithms in meand ric polyg ons [19 ], a specific kind of plan ar p olygon s with many application s in bioinform atics. The latter constitutes a real case stud y in bioinf ormatics, which we plan to imp lement in the n ear future. R E F E R E N C E S [1] Chan T .M., P oint Location in o(log n) T ime, V or onoi Diagr ams in o(n log n) T ime, and Other Tr ansdic hotomous Results in Computation al Geometry , 47 th IEEE FOCS 2006, pp. 333-344. [2] Chazelle B., Optimal algorithms for computing depths and l ayers , Brown Univ ersity , T ech nical R eport, C S-83-13, March 1983. [3] Chazelle B., Dobkin D., Decomposing a polygon into its con ve x parts , Proc. 11 th A CM Symp. on Theory on Comp.,1979, pp.38-45. [4] Chazelle B.,Guibas L ., F raction al Cascading: a data struc- turing technique with Geometric Applications , 12 th ICALP 1985, pp. 90-100. [5] Chazelle B .,Guibas L. , Lee D.L., T he power of Geometric Duality ,Proc. of 24 th IEEE Annual Symposium on Foun- dations of Computer Science, 1983, pp.217-225. [6] Cole R. , Y ap C., Geometric R etrieval Pr oblems , Pr oc. 24 th IEEE Annual Symposium on Foundations of Computer Science 1983, pp. 112-121. [7] J. R. Driscoll, N. Sarnak, D. D. S leator , R. E. T arjan , Making data structures persistent, J. Comp. S yst. Sci. 38 (1989) pp. 86-124. [8] Edelsbruner H., Guibas L.,St olfi J., Optimal point l ocation in a monotone subdivision , T echnical Report 2, DEC sys- tems Research Center , 1984. [9] Edelsbruner H., Kirkpatrick D., Maurer H., P olygonal Intersection Sear c hing , Information Processing Letters, 14, 1982, pp. 74-79. [10] Edelsbruner H., W elzl E., Halfplanar ra nge sear ch in linear space and O ( n 0 . 695 ) query time , Inform. Proc. Letters 23, 1986, pp. 289-293. [11] M.L. Fredman and D.E. W illard. Surpassing the informa- tion t heoretic bound wi th fusion trees. . Comput. Syst. S ci., 47:424-43 6, 1993. Announced at STOC ’90. [12] O. Fri es, K. Mehlhorn, S . Naher and A. Tsakalidis, A loglogn data structure for three sided range queries, Inform. Process. Lett. 25 (1987), pp. 269-273. [13] Paterson M.S., Y ao F . F ., P oint Retrieval for P olygons , journal of Algorithms, 1986, pp.441-447. [14] W elzl E. P artition trees for counting and other ra nge sear c hing pr oblems , Proc. 4th A CM Symp. on Computa- tional Geometry , 1988, pp. 23-33. [15] Willard D., P olygon Rertieval , SIAM J. Computing, 14,1982,pp . 149-16 5. [16] E. M. McCreight, Priority sear c h trees , S IAM J. Comput. 14 (1985), pp. 257-276. [17] H. Overmars, Efficient data structures for rang e searc hing on a grid , J. Algorithms 9 (1988), pp. 254-275. [18] M. Patrasc u, Planar P oint Location in Sublogarithmi c T ime , 47 th IEEE FO CS 2006, pp. 325 - 332. [19] A. Panayotopoul os and P . Vlamos, Meandric P olyg ons , Ars Com- binator ia (to appear). [20] H. Samet, The Design and Analysis of Spatial Data Structu res, Addison-W esley , Reading, MA, 1990, pp 80-83. ISBN 0-201- 50255-0. [21] S. Sioutas, Ch. Makris, N. Kitsios, G. L agogia nnis, J. Tsaknakis, K. Tsichlas, B. V assiliad is: ”Geometric Retrie val for Grid Points in the RAM model”, Journal of Uni ve rsal Computer Science, V ol ume 10, no.9(2004), pp 1325-1353, Springer Co. Pub .

Original Paper

Loading high-quality paper...

Comments & Academic Discussion

Loading comments...

Leave a Comment