Download An Evaluation of a Hierarchical Method for Curvilinear Data Represe

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Lattice model (finance) wikipedia , lookup

Linked list wikipedia , lookup

Red–black tree wikipedia , lookup

Interval tree wikipedia , lookup

B-tree wikipedia , lookup

Binary search tree wikipedia , lookup

Quadtree wikipedia , lookup

Transcript
An Evaluation of a Hierarchical Method for Curvilinear Data
Representation
Marius Dorian Zaharia
Computers Department
POLITEHNICA University of Bucharest
Splaiul Independentei, 313, Bucharest – 77206, Romania
[email protected]
Abstract: The paper describes the implementation and evaluation of a hierarchical data
structure used to represent polygonal meshes, the PM-tree. This structure is suitable to be used in
spatial databases such as geographic information systems. Algorithms to solve the main
categories of queries (proximity queries, range queries) applied to large PM-tree coded
curvilinear data collections, were also implemented and evaluated.
Keywords: spatial database, hierarchical data structure, tree, polygon mesh.
1. Introduction
A lot of application classes as those in the fields of computer graphics, computer aided
design, computer vision, robotics, geographic information systems manipulate curvilinear data.
An important class of curvilinear data are polygon meshes in this case the lines composing the
mesh form the boundary of polygonal regions. The lines of the polygonal mesh are not allowed
to cross.
There are various methods to represent polygon mesh data, for example lists based
representations (where the lists of edges and vertices of the mesh could be structured in many
different ways) or chain codes (simples or generalised) []. In case of spatial databases
manipulating curvilinear data, the representations should allow efficient implementation of
geometrical search queries and of operations such as polygons intersection or reunion. In this
above-mentioned case the use of hierarchical data structures allows obtaining efficient
algorithms to solve typical geometric search queries.
The method described and evaluated in this paper is a hierarchical space decomposition
technique in which the data space is splitted in equally sized regions. Each region contains a part
of the entire data collection. If the quantity of information in one such region satisfies an
overflow condition, this region will be farther splitted in at least two spatial cells.
There are various types of spatial decomposition techniques depending on the shape of
the decomposition cells, on the number of cells who are splitted when an overflow condition
occurs or on the number of data space dimensions who are driving the splitting process. The
splitting hyperplanes could be placed in fixed positions (depending only on the level of the
spatial decomposition) or in positions determined by the data values to be represented.
2. The PM-tree data structure
In the following it will considered that the data space including the polygon mesh has a
square shape. The method to build a PM-tree consists in decomposing repeatedly the collection
of edges (and vertices) forming the polygonal mesh. The decomposition process stops when the
resulted subset of edges is simple enough to be represented by other method. The splitting
process could be modelled through a quad tree. Each tree node (N) has an associated spatial
region (R) of square shape. The four equally sized regions of (R) will correspond to the four
sons of (N). Obviously the information about the edges of the polylines represented by a PM-tree
is stored only in the leaf nodes. Initially the PM-tree has only one leaf node whose associated
spatial region is the entire data space. The PM-tree could equally be used to represent polylines,
which are not necessarily closed.
More specific, the rules to decide the termination of the splitting process are:
•. The spatial region (R) associated to a leaf node should contain at most one vertex of the
polygonal map. (*)
• If region (R) contains no vertex it could contain only a part of a single edge of the polygonal
(**)
map.
Figure 1
A PM-tree node (N) could be implemented as a record with the following fields of
information:
•. Type of the node (internal or leaf)
•. Size length and coordinates of the centre of the square spatial region associated to the tree
node
•. References to the sons of the current node
The C specification of the above mentioned data structure is:
typedef struct pmt {
rpunct c;
// centre of the spatial region corresponding to
current tree node
double lg;
// size length of the same spatial region
int tipnod:
// the node could be “leaf” or “internal”
lista_muchii lm;
//list of associated edges (for leaf nodes)
struct pmt *fii[4];
//pointers to the node sons
} *arbore_PM;
Every leaf node (L) could have a non empty list of references to the edges of the
polygonal map who are crossing the square spatial region associated to (L). These edges must
satisfy the conditions (*) and (**) mentioned above.
All square regions of the spatial decomposition are considered closed. If one vertex (V)
of the polygonal map is placed on the boundary of a spatial region corresponding to a PM-tree
node, the edges having (V) as extremity will be properly inserted in “lm” list of the
corresponding leaf nodes avoiding in this way a high level of spatial decomposition.
The insertion algorithm of an edge (E) into an edge set modelled through a PM-tree
consists in a preorder traversal of the tree. If (E) does not cross the spatial region associated with
the current tree node (N), all the nodes dominated by (N) will no more be traversed. If the
traversal process reaches a leaf node (L), (E) will be added to the “lm” list of edges already
associated with (L). Let new_list be the resulting list. If the edges in new_list satisfy the
termination conditions (*) and (**) the insertion process stops, (E) being added to lm. Otherwise
the spatial region associated with (L) is splitted in four equal subregions; (L) becomes an internal
node and the process continues trying to insert the edges from new_list in each of the four
subtrees dominated by (L).
The function verifying if the edges in list “l” are satisfying the PM-tree validity
conditions (*) and (**) relative to a spatial region associated with a leaf node referred by N is
specified by the following pseudo-code sequence:
function verify_validity_PM(lista_muchii l, arbore_PM N) is
if *l is empty then
return
else
if *l has only one element (E) then
if *both extremities of (E) are placed in current spatial region
then
return false
else
return true
else
fe ← *first edge of l
if *both extremities of fe are placed in current spatial region
then
return false
else if *first extremity of fe is placed in current spatial
region
then
return *first extremity of fe is common with one extremity
of all the other edges from l
else if *second extremity of fe is placed in current spatial
region then
return *second extremity of fe is common with one
extremity of all the other edges from l
else
return false
end
The algorithm presented above was implemented in C on an INTEL PENTIUM/200
processor. The polygonal maps used to test the algorithm were Delaunay triangulations having
50 vertices. The elements that are influencing the height of the resulted tree are the minimal
angle between two adjacent edges and the “density of points” in a given area (every point must
have his own quadrant of the spatial decomposition). Some runtime results are shown in Table
1.
No. of
vertices
50
50
50
50
50
No. of
Min.
Area per
triangles angle (°)
point
78
31.29
1198
76
13.57
1128
87
1.52
1590
90
0.84
1629
84
0.70
1752
No. of
nodes
613
845
1925
3629
3621
No. of
leaves
460
634
1444
2722
2716
Height
9
11
14
15
14
Insert
time
5
6
11
16
16
Delete
time
5
11
17
21
11
Table 1
One method to reduce the height of the tree is to relax the condition (**) considering that
a decomposition cell (C) could contain more edges if and only if all these edges have a common
vertex placed eventually in a cell different from (C). In that case (C) must contain no vertex of
the polygonal map. Using this rule to verify the termination of the splitting process leads to
larger edge collections associated to the leaves of the PM-tree. These will slightly complicate the
search algorithms that are using the new kind of PM-tree, but the efficiency of the tree building
process is definitely improved. Table 2 shows running time performances of the insert/delete
algorithms used to dynamically update a polygonal map represented by the last mentioned PMtree data structure. The first 4 lines in Table 2 are referring to the same data sets as the
corresponding lines from Table 1. Comparing the memory amounts necessary to store the same
polygonal map (a Delaunay triangulation) when this is modelled by the two variants of PM-trees
leads to a factor of 3-4 favourable to the second type of PM-tree.
No. of
vertices
50
50
50
50
100
100
No. of
Min
Area per
triangles angle (°)
point
78
31.29
1198
87
1.52
1590
84
0.70
1752
86
0.42
1659
187
1.06
870
187
0.23
873
No. of
nodes
221
349
449
561
957
1033
No. of
leaves
166
262
337
421
718
775
Height
6
8
10
9
9
10
Insert
time
6
5
5
11
22
17
Delete
time
0
0
0
3
5
6
Table 2
Figure 2 shows the two PM-tree representations of a Delaunay triangulation with 20
vertices and 29 triangles. The first tree has 629 nodes, 472 leaves and a depth of 11; the second
tree has 137 nodes, 103 leaves and a depth of 5.
Figure 2
The deletion of an edge from an edge collection modelled by a PM-tree requires using a
merging process between neighbour nodes. In this way, each region associated to a leaf node of
the resulted tree will have a maximal area. For example, deleting the edge AC from the edge
collection modelled by the PM-tree from Figure 1 results the tree from Figure 3.
Figure 3
If after the elimination of an edge, one node (N) has all his sons leaf nodes, the algorithm
computes the union of all the edge sets associated to the sons of (N). If the resulted edge set
satisfies rules (*) and (**) it will be associated to (N) and the four sons of (N) will be deleted.
The process continues recursively towards the root of the PM-tree.
3. Typical queries implemented on PM-trees modelled polygon maps
The main categories of queries referring to curvilinear data are proximity queries (that ask for a
set of edges placed near a given point) and range queries (that determine a set of edges included
in a given spatial region, usually a rectangle). In case of polygonal maps using PM-trees, these
search queries could be implemented by logarithmic algorithms. For example the following
algorithm implements the proximity query.
procedure proximity_query(rpunct p, arbore_PM a, lista_muchii lrez)
if * a points to an empty tree then
return
if * p is in spatial region associated with node pointed by a then /*1*/
if * current node is a leaf then
lrez ! * union of the edges in lrez and a->lm
else
for * each son of a do
proximity_query(p, *current son of a, lrez)
return
end
The algorithm is a preorder traversal of the tree. Edge list “lrez” accumulates the edges crossing
the minimal square spatial regions covering point p. There may be more such regions if p is
placed on the boundary of the decomposition cells. Condition /*1*/ could eliminate a lot of
subtrees from the search process. If point p is placed in a spatial region that contains no edges of
the polygonal map it is possible that the geometrical search process returns an empty edge list.
The algorithm efficiency could be improved in case of data sets, which requires very deep spatial
decompositions. In that case the search could terminate at a tree node (N) placed at a predefined
tree level and “lrez” will accumulate all edges placed in spatial regions associated to the leaves
of the subtrees dominated by (N).
4. Conclusions
The PM-tree is an internal data structure, that could be used to represent polylines collections in
a dynamic environment. This structure is suitable to be used especially in applications where
geometrical search queries are predominant. The second variant of PM-tree allows better
performances regarding the storage requirements. The price paid for these improved
performances is the slight decay of the answer time of spatial queries. That fact is due to the
coarser resolution of the spatial decomposition, which associates longer edge lists with
elementary cells of the decomposition.
References
[1]
J. Foley, A. van Damm, S. Feiner, J. Hughes, Computer Graphics Principles and
Practice, Addison-Wesley Publishing Company, 1992.
[2]
[3]
[4]
[5]
[6]
Freeman H. (1974), Computer processing of line drawing images, ACM Computing
Surveys, pp. 55-97, March.
Overmars M.H. (1988), Geometric data structures for computer graphics: an overview.
In: Theoretical Foundations of Computer Graphics and CAD (R.A. Earnshaw (Ed.)) pp.
21-49, Springer Verlag, Berlin, Heidelberg.
Samet H. (1984), The quadtree and related hierarchical data structures, ACM Computing
Surveys, pp. 187-260, June.
Samet H. (1994) Spatial Data Structures, in: Modern Database Systems. The Object
Model Interoperabiliy and Beyond (W. Kim (Ed.)), pp. 361-385, Addison Wesley,
Reading, MA.
Zaharia M. (1998), Elemente de Geometrie Algoritmica, Editura Printech, Bucuresti.