| ||
In this chapter, we introduce the quadtree and octree structures. Their definition and complexity, the recursive construction scheme, and a standard application are presented. Quadtrees and octrees have applications in mesh generation, as shown in Sections 1.3, 1.4, and 1.5.
A quadtree is a tree rooted so that every internal node has four children. Every node in the tree corresponds to a square. If a node v has children, their corresponding squares are the four quadrants, as shown in Figure 1.1.
Quadtrees can store many kinds of data. We will describe the variant that stores a set of points and suggest a recursive definition. A simple recursive splitting of squares is continued until there is only one point in a square. Let P be a set of points.
The definition of a quadtree for a set of points in a square Q = [ x 1 Q : x 2 Q ] — [ y 1 Q : y 2 Q ] is as follows :
If P ‰ 1, then the quadtree is a single leaf where Q and P are stored.
Otherwise, let Q NE , Q NW , Q SW , and Q SE denote the four quadrants. Let x mid := ( x 1 Q + x 2 Q ) / 2 and y mid := ( y 1 Q + y 2 Q ) / 2, and define
The quadtree consists of a root node v , and Q is stored at v . In the following, let Q ( v ) denote the square stored at v . Furthermore, v has four children: the X -child is the root of the quadtree of the set P X , where X is an element of the set { NE, NW, SW, SE }.