Hierarchical Data Structures and Algorithms for Computer Graphics. I. Fundamentals

Hierarchical Data Structures and Algorithms for Computer Graphics. I. Fundamentals

Data Structures I Hierarchical Data Structures Hanan Samet University of Maryland Robert E. Webber Rutgers University This is the first part of a two-part overview of the use C omputer graphics applications require the manip- of hierarchical data structures and algorithms in com- ulation of two distinct data formats: vector and raster (see puter graphics. In Part I, the focus is on fundamentals. Figure 1).The raster format enables the modeling of a Part II focuses on more advanced applications. Methods based on hierarchical data structures and graphics image as a collection of square cells of uniform algorithms have found many uses in image rendering size (called pixels]. A color is associated with each pixel. and solid modeling. While such data structures are not To attain maximum flexibility, an attempt is made to necessary for the processingof simple scenes, they are model directly the addressability of the phosphors on the central to the efficient processing of large-scale realis- display screen so that each pixel corresponds to a phos- tic scenes. Object-space hierarchies are discussed phor. This format has also proven useful in computer briefly, but the main emphasis is on hierarchies con- vision, since it corresponds to the digitized output of a structed in the image space, such as quadtrees and television camera. In contrast, instead of modeling the oc t rees. display screen directly, the vector format models the 48 0272-1716/8~/0500-0048$01.00 1988 IEEE IEEE Computer Graphics & Applications A B a b ~~ ~~__ Figure I. Example image represented in (a) a vector data format and (b) a raster data format. Figure 2. Linked list of records representing, by pairs of their endpoints, the line segments of Figure la. ideal geometric space to be represented on the display screen. Vector data consists of points, line segments, filled polygons, and polyhedral solids. In addition to pro- cessing these two formats of data directly, computer graphics also involves conversion between these two for- mats. Closely related to the distinction between the raster format and the vector format is the distinction between image space and object space presented in an early clas- sification of hidden-surface algorithms.' Both data formats have obvious representations, which are minimal in the sense of providing structure just suffi- cient to allow updating. For the raster format, the obvi- ous representation is as a two-dimensional array of color values. As an example, in Figure Ib, all elements of the array through which a line passes or that contain a point Figure 3. Winged-edge representation of the line seg- (shown shaded) are black. For the vector format, the obvi- ments and their endpoints of Figure la. The result is ous representation is as a linked list of line segments (see a graph with two types of nodes shown as squares and Figure 2). Early work on the vector format extended the narrow solid rectangles. The squares correspond to structure of this list by ordering the line segments around endpoints of line segments while the rectangles cor- common vertices. For example, consider the winged- respond to the actual line segments. Each arrow edge polyhedral representation' illustrated in Figure 3. denotes an edge in the graph between two nodes. While these representations are suitable for medium- Edges can exist between two line segments and also range applications, once the scene being modeled from line segments to their endpoints. May 1988 49 Figure 4. An example of the use of bounding objects: (a)unbounded objects for use in Figures 4b through 4c, (b) bounding boxes, (c) hierarchical bounding boxes. becomes significantly larger than the display grid, major ber of elements, etc.). The problems are solved with logistic problems arise. object-space hierarchies and image-space hierarchies, There are two ways' to handle the logistics problems. which are described in greater detail below. Next, we One approach, based on object-space hierarchies3 is present a definition of the quadtree and octree, an exami- discussed only briefly in this article. The other approach, nation of some of the more common ways in which they based on image-space hierarchies, is typified by hierar- are implemented, and an explanation of the quad- chical data structures such as the quadtree and octree, tree/octree complexity theorem. We conclude with a dis- and is the subject of Parts I and 114 of this article. cussion of vector quadtrees and vector octrees. The two parts are organized as follows. In Part I we review the basic fundamentals of hierarchical data struc- Object-space hierarchies tures and show how they are used in the implementation Two kinds of logistic problems present themselves in of some basic operations in computer graphics. The sec- scene modeling. First, communication between the user ond section of Part I contains a general discussion of software and the graphics package-i.e., the number of properties of the structures. The third section describes procedure calls (or commands transmitted on a graphics how some basic operations are performed using quad- channel)-can become a bottleneck for the system. The trees. The performance of basic operations using octrees, second problem is in determining what subset of the where it differs from quadtrees, is discussed in Part I1 scene is actually visible. For example, in a 512 x 512 x 512 of the article (to appear in the July 1988 CG&A). Part I1 scene, only about 512 x 512 of it is actually visible at any focuses on more advanced applications with a heavy given time. When the scene extends horizontally and ver- emphasis on quadtree hidden-surface algorithms and tically past the bounds of the viewing surface, the prob- such display methods as ray tracing and radiosity. More lem is further aggravated. The first problem has been references and details on hierarchical data structures addressed, in part, by observing that the universe can be appear el~ewhere.~.' hierarchically organized into objects composed of subobjects, which are in turn composed of other objects, Properties of quadtrees and and so forth.' This observation has been used as the basis for the organization of the user's interface to the octrees data from the earliest graphics systemsQ~'Oto the most In this section we discuss some fundamental proper- recent graphics package designs."*" ties of quadtrees and octrees. First, however, we elaborate Since the object hierarchy must be kept to solve the on the motivation for their development. As mentioned communication problem, it is tempting to use this hier- earlier, hierarchical data structures such as the quadtree archy to solve the visible-subset problem. One way to and octree have their roots in attempts to overcome prob- adapt the object hierarchy to the visible-subset problem lems that arise when the scene being modeled is more is through the notion of bounding objects. When deter- complex than the display grid (in size, precision, num- mining whether or not an object is visible, it is 50 IEEE Computer Graphics & Applications ~ommon’~to surround the object (see Figure 4a) with a bounding box (see Figure 4b) or even a sphere. If the bounding object is not visible, then clearly the object being bounded is also not visible. This technique produces a major computational savings, since it is usually much easier to test for visibility of the bounding object than the visibility of the bounded object. However, the approach cannot deal with the visible-subset prob- lem when the number of objects is large. researcher^^^'^^'^ have noted that the objects being bounded need not be limited to the primitive objects of a b the scene; instead, bounding objects can also be placed around the complex objects formed by the different levels Figure 5. Examples of nonsquare partitionings of the of the object hierarchy (see Figure 4c). plane: (a) equilateral triangles, (b) hexagons. This approach is easy to implement and can greatly improve execution time. But its efficiency is based on the notion that the object hierarchy is a structural approxi- mation of a balanced binary tree, in the sense that objects organization of the image space allows the resolution to in the hierarchy are expected to be locatable in time vary with the complexity of the objects in various roughly proportional to the logarithm of the number of regions. Of course, there are many ways to partition the objects in the hierarchy. Of course, this is often not the image space (when it is viewed as a continuous case, because there are two kinds of levels in a natural plane/spa~e],’~-~~but to interface easily with a Carte- hierarchy: those formed by a few unique objects and sian coordinate system and with the typical display those formed by a large number of nearly identical device controller, a decomposition of the plane into objects.’ Levels formed in the second manner can be square regions (and a space into cubical regions) is sim- very flat and of little computational benefit. Even when plest. Two examples of nonsquare partitionings of the the branching factor is reasonable, there is no guaran- plane are given in Figure 5. In the following, we discuss tee that the natural hierarchy will be balanced in the the organization of a planar image space (leaving consid- algorithmic sense. Some attempts have been made to eration of the 3D image space for a later section). structure the object-space artificially to avoid these prob- When justifying the use of object-space hierarchies for lems,I6 but such attempts have problems handling image-space processing, we often refer to the property dynamically changing scenes (due to preprocessing of area coherence, which means that objects tend to rep- costs) as well as often producing worst-case results.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    21 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us