Download File - University of Limerick

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

Linked list wikipedia , lookup

Lattice model (finance) wikipedia , lookup

Red–black tree wikipedia , lookup

B-tree wikipedia , lookup

Interval tree wikipedia , lookup

Binary tree wikipedia , lookup

Quadtree wikipedia , lookup

Binary search tree wikipedia , lookup

Transcript
Decorated Dissection Trees
Donal MacVeigh, S.J.
Saint Peter's College Jersey City NJ 07306
[email protected]
On Sabbatical at
University of Limerick
Limerick Ireland
Department of Computer Science and Information Systems
Research Report UL-CSIS-96-2
Abstract
In this paper I look at a method of building a binary search tree for storing a two-dimensional figure with all
its subfigures. The problem is to store lines and curves such that searching and retrieval will be fast. When
we do a partitioning, we must insert the partitioning arc and the subfigures such that a further data point will
find the correct subfigure. What is distinctive about this insertion is the way we insert figures into the tree
before any of the points within them.
This paper continues a work written up in a previous conference by MacVeigh (1995), in which a method of
partitioning figures in the plane by arcs of circles and straight line segments was described. Each time we
wish to partition the figure (for example ABCD in figure 1), we first generate a random point (for example
'1' in figure 1) within the figure. We then search the tree to find the innermost figure within which the point
falls. At each interior node that contains a line segment, if the point is to the left of the line it moves to the
left subtree, else it moves to the right subtree. At each interior node that contains an arc instead of a line
segment, if the distance from the center of the arc to the point is less than or equal to the radius of the arc, it
moves to the left subtree, else it moves to the right subtree. Once we reach the terminal node we store the
point and retrieve the list of lines and arcs bounding the figure. We then do the partitioning of the figure by
an arc or line segment through the point.
We have to store the partitioning arc and the two subfigures in the appropriate places in the binary tree. We
return to the terminal node in which we stored the point, change it to an internal node, and insert the
partitioning arc. We allocate two children for this node. We have decide which subfigure should be inserted
in which child. This must be done in such a way that any point generated after this will go to the subtree
corresponding to the subfigure within which the point lies.
To do this we must find a point not on the partitioning arc such that any further point generated will either be
on the same side of the arc, in which case we want to go to the same subtree, or on the opposite side, in
which case we want to go to the other subtree. To find this point we follow the sides of the first subfigure
until we find a point not on the partitioning arc. If the partitioning arc is a line segment then we attach the
first subfigure to the left or right subtree depending on whether the point is to the left or right of the line. If
the partitioning arc is a circular arc, then if the point is inside the partitioning arc's radius we attach the first
subfigure to the left subtree, else attach it to the right subtree.
The Problem
In this paper I look at a method of building and searching a binary search tree for storing a two-dimensional
figure with all its subfigures. I have developed a partitioning method, and I am concerned with storing and
organizing the data. Partitioning lines and curves in general are not parallel to the axes. The problem is to
store these lines and curves such that searching and retrieval will be fast. This is important because each time
we generate a data point, we must find the innermost subfigure within which it falls. When we do a
partitioning, we must insert the partitioning arc and the subfigures such that a further data point will find the
correct subfigure. What is distinctive about this insertion is the way we insert figures into the tree before any
of the points within them.
Previous Work
This paper continues a work written up in a previous conference by MacVeigh (1995), in which a method of
partitioning figures in the plane by arcs of circles and straight line segments was described. In each case the
partitioning arc or line segment must pass through the data point and at its ends be perpendicular to the sides
of the existing figure. It must not hit the figure walls in more than two places. In this paper I will describe a
method of storing the information about the figure and its subfigures in a binary tree. The root corresponds to
the initial figure. Information about each point and the partitioning arc through it is placed in the tree node
that corresponds to the innermost figure within which it falls, and children of this node are created to
correspond to the new subfigures.
Binary search trees are the most common partitioning data structure. Knuth (1973) shows that no search
method based on comparisons can make fewer comparisons than binary search. Balanced binary search trees
are also treated by Knuth. Overmars (1983) lists nineteen kinds of approximately balanced binary trees.
Our interest is in the two-dimensional case. We wish to store points, line segments, and arcs, not real
numbers. Samet (1984) surveys the quadtree and other hierarchical data structures used for this purpose. He
updates this information in (1990). In the survey he cites applications in image processing, computer
graphics, geographic information systems, and robotics. He cites more applications in (1990b) and Samet and
Webber (1990). Much work has been done in this area for these applications. Oskard et al (1990) use a
quadtree for underwater mapping, Hsiao and Feng (1990) use a variation of the quadtree to compact VLSI
masks, Depauw and Wegten (1990) use another variation for storage of geometrical data in CAD
applications, Nasrabadi et al (1990) use it to decompose a HDTV image into homogeneous regions, and
Strobach (1991) uses it to obtain a variable block size coding algorithm. Most of the previous work has
partitioned a two-dimensional figure by a line or lines parallel to one or both of the axes, though there have
been exceptions. Gomez and Guzman (1979) partitioned a rectangle into four triangles by lines through the
vertices,* then repeatedly partitioned each triangle into four vertices. Also Montanvert et al (1991) used
hierarchies of irregular tessellations in image analysis, adapting the structure of the hierarchy to the image
content.
Building the Tree
The method begins with three elements:
* an arbitrary closed figure in the plane composed of line segments and circular arcs
* a corresponding binary search tree initially containing only a root containing a list of line segments
and arcs, which corresponds to the initial figure
* a method of generating random points within the initial figure.
Each time we partition the figure, we first generate a random point within the figure. We then search the tree
to find the innermost figure within which the point falls. We store the point in this node. We partition the
figure by the shortest line or arc through the point perpendicular to the figure's boundaries at its ends. We
then store the partitioning line or arc in the node corresponding to the partitioned figure, and create two
children for it. In each of these children we store one of the subfigures that results from the partitioning. It is
these subfigures that will be refined by any further partitioning.
In the tree undivided figures are represented by external nodes (terminal nodes). These contain only the list
of lines and arcs bounding the figure. Partitioned figures are represented by internal nodes. These contain the
list of lines and arcs bounding the figure, and also the partitioning arc and the point through which it was
drawn.
The routine that recursively searches the tree to find where to insert the newly generated point must search
the tree until it finds a terminal node, which represents the innermost figure within which the point falls. At
each interior node that contains a line segment, if the point is to the left of the line it moves to the left
subtree, else it moves to the right subtree. At each interior node that contains an arc instead of a line segment,
if the distance from the center of the arc to the point is less than or equal to the radius of the arc, it moves to
the left subtree, else it moves to the right subtree.
Once we reach the terminal node we store the point and retrieve the list of lines and arcs bounding the figure.
We can then do the partitioning of the figure by an arc or line segment through the point. We have to store
the partitioning arc and the two subfigures in the appropriate places in the binary tree. We return to the
terminal node in which we stored the point, change it to an internal node, and insert the partitioning arc. We
allocate two children for this node. Now we have decide which subfigure should be inserted in which child.
This must be done in such a way that any point generated after this will go to the subtree corresponding to
the subfigure within which the point lies.
To do this we must find a point not on the partitioning arc such that any further point generated will either be
on the same side of the arc, in which case we want to go to the same subtree, or on the opposite side, in
which case we want to go to the other subtree. To find this point we follow the sides of the first subfigure
until we find a point not on the partitioning arc. If the partitioning arc is a line segment then we attach the
first subfigure to the left or right subtree depending on whether the point is to the left or right of the line. If
the partitioning arc is a circular arc, then if the point is inside its radius we attach the first subfigure to the
left subtree, else attach it to the right subtree.
Discussion
The important step above is the last. We do not have a point, we have a partitioning arc and two subfigures to
insert into the tree. So we simply take the first point of the first subfigure that is not on the line or circle
defined by the partitioning arc, and do exactly the same comparison as when inserting a point. The intent is
to find a criterion that will enable us to put the boundaries on the 'correct'
side of the partitioning arc such that any further point within the subfigure will be placed in the correct
subtree. This method chooses the end of the next link as its key at this step. In understanding this we must
keep in mind that we began with a method that creates a partitioning arc perpendicular at its ends to the sides
of the existing figure. This results in a figure in which all interior angles are right angles. This is by
construction - our partitioning method chooses the shortest arc that is perpendicular to the sides of the figure
at its end that does not hit the figure walls in more than two places. So any point within one of the subfigures
will be on the same side of the partitioning arc as the point we used to place the subtrees.
Conclusion
In this paper I have described a method of building the associated search tree for a scheme that partitions a
figure in the plane. The new feature is that at the last step I am searching to see where to insert an arc and
two figures, not a point.
REFERENCES
Depauw,W.,Weyten,L. 1990 Multiple Storage
Adaptive Multi-Trees, IEEE Transactions on
Computer-Aided Design of Integrated
Circuits and Systems,9,3,248-252.
Gomez,D.,Guzman,A. 1979 Digital Model for
Three-Dimensional Surface Representation,
Geo-Processing,1,53-70.
Hsiao,P.,Feng,W. 1990 Using a Multiple
Storage Quad Tree on a Hierarchical VLSI
Compaction Scheme, IEEE Transactions on
Computer-Aided Design of Integrated
Circuits and Systems,9,5,522-536.
Knuth,D. 1973 The Art of Computer
Programming 3: Sorting and Searching,
Addison-Wesley, Reading MA.
MacVeigh,D. 1995 Emulation of Mud Cracks, Proceedings of Fourth International Conference on Computational Graphics and
Visualization Techniques, Dec 11-14, 1995, Alvor Portugal, Graphic Science Promotions and Publications, Massama Portugal,
218-227
Montanvert,A.,Meer,P.,Rosenfeld,A. 1991
Hierarchical Image-Analysis Using Irregular
Tessellations, IEEE Transactions on Pattern
Analysis and Machine Intelligence, 13,4,307316.
Nasrabadi,N.,Choo,C.,Harries,T.,Smallcomb,J.
1990 Hierarchical Block Truncation Coding
of Digital HDTV Images, IEEE Transactions
on Consumer Electronics, 36,3,254-261.
Oskard,D.,Hong,T.,Shaffer,C. 1990 Real-Time
Algorithms and Data-Structures for
Underwater Mapping, IEEE Transactions on
Systems Man and Cybernetics,20,6,14691475.
Overmars,M. 1983 The Design of Dynamic
Data Structures, Springer-Verlag, New York.
Samet,H. 1984 The Quadtree and Related
Hierarchical Data Structures, ACM
Computing Surveys, 16, 2, 187-260.
Samet,H. 1990a The Design and Analysis of
Spacial Data Structures, Addison-Wesley,
Reading MA.
Samet,H. 1990b Applications of Spacial Data
Structures: Computer Graphics, Image
Processing, and GIS, Addison-Wesley,
Reading MA.
Samet,H.,Webber,R. 1990 Hierarchical Data
Structures and Algorithms for Computer
Graphics, IEEE Computer Graphics and
Applications, 8,3,48-68; 8,4,59-75.
Steinhaus,H. 1960 Mathematical Snapshots,
Oxford University Press, New York.
Strobach,P. 1991 Quadtree-Structured
Recursive Plane Decomposition Coding of
Images, IEEE Transactions on Signal
Processing,39,6,1380-1397.
Walker,J. 1986 The Amateur Scientist,
Scientific American, 255, 4, 204-209.