visualization of three-dimensional delaunay meshes

15
Algorithmica (1997) 19: 114–128 Algorithmica © 1997 Springer-Verlag New York Inc. Visualization of Three-Dimensional Delaunay Meshes M. S. Karasick, 1 D. Lieber, 1 L. R. Nackman, 1 and V. T. Rajan 1 Abstract. We describe an algorithm for the rapid display of three-dimensional Delaunay meshes (or selected portions thereof) on standard raster displays, without the use of special purpose graphics hardware. The algorithm allows the display of the interior structure as well as the surface of the mesh, and furthermore does not require that the meshed domain be convex, or even connected. The algorithm computes a depth ordering on the mesh elements. This ordering can be used to display subsets of the mesh, as well as isosurfaces induced by fields represented on the mesh. Furthermore, by utilizing mesh coherence, the depth ordering can be used to view the mesh from front to back as well as back to front. An implementation of the algorithm has been incorporated in a system for designing and analyzing the performance of three-dimensional semiconductor and electronic packaging structures. The system is in regular use and the mesh-display algorithm has been used to visualize both meshes and fields computed over the meshes. Key Words. Delaunay, Visualization, Isosurface, Rendering, Nonconvex domain, Three-dimensional mesh, Implementation. 1. Introduction. The finite-element method for solving partial differential equations is used extensively in engineering analysis. The most labor-intensive step in using the finite-element method to solve practical problems is discretizing the domain of interest into a large number of simple elements. This process is called mesh generation. For an efficient and accurate solution of the equation, the mesh must reflect the anticipated behavior of the solution, being dense where the solution changes rapidly, and less dense elsewhere. Generating good meshes, especially for three-dimensional problems, remains an art, requiring the analyst to use intuition about the equations being solved to guide programs that generate the mesh. This is done interactively: The analyst provides certain parameters to the mesh-generation program, then looks at the resulting mesh, revises the parameters based on the mesh’s appearance, and regenerates the mesh. After achieving a satisfactory mesh, the analyst runs the equation solver and examines the solution. The analyst then uses the solution to guide further iterations of this process. The ability to visualize the mesh is key to the entire process. A technique is needed that provides the simplicity of a shaded, hidden-surface removed image, with the ability to see interior detail of a wireframe drawing. One solution, suggested by work in volume visualization [4], is to provide a sequence of isocontour surfaces based on a field defined over the mesh. This does not give detail on the mesh structure, however. Figure 1 illus- trates a sequence of images that reveal important changes in interior mesh density. To allow the analyst to explore meshes of the complex structures encountered in practice, it must be possible to generate rapidly sequences of images from a variety of viewpoints 1 IBM T. J. Watson Research Center, P. O. Box 218, Yorktown Heights, NY 10598, USA. Received May 31, 1994; revised November 14, 1994, April 4, 1995, and July 8, 1995. Communicated by J. S. B. Mitchell.

Upload: v-t

Post on 23-Aug-2016

217 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Visualization of Three-Dimensional Delaunay Meshes

Algorithmica (1997) 19: 114–128 Algorithmica© 1997 Springer-Verlag New York Inc.

Visualization of Three-Dimensional Delaunay Meshes

M. S. Karasick,1 D. Lieber,1 L. R. Nackman,1 and V. T. Rajan1

Abstract. We describe an algorithm for the rapid display of three-dimensional Delaunay meshes (or selectedportions thereof) on standard raster displays, without the use of special purpose graphics hardware. Thealgorithm allows the display of the interior structure as well as the surface of the mesh, and furthermore doesnot require that the meshed domain be convex, or even connected.

The algorithm computes a depth ordering on the mesh elements. This ordering can be used to display subsetsof the mesh, as well as isosurfaces induced by fields represented on the mesh. Furthermore, by utilizing meshcoherence, the depth ordering can be used to view the mesh from front to back as well as back to front.

An implementation of the algorithm has been incorporated in a system for designing and analyzing theperformance of three-dimensional semiconductor and electronic packaging structures. The system is in regularuse and the mesh-display algorithm has been used to visualize both meshes and fields computed over the meshes.

Key Words. Delaunay, Visualization, Isosurface, Rendering, Nonconvex domain, Three-dimensional mesh,Implementation.

1. Introduction. The finite-element method for solving partial differential equationsis used extensively in engineering analysis. The most labor-intensive step in using thefinite-element method to solve practical problems is discretizing the domain of interestinto a large number of simple elements. This process is calledmesh generation. Foran efficient and accurate solution of the equation, the mesh must reflect the anticipatedbehavior of the solution, being dense where the solution changes rapidly, and less denseelsewhere. Generating good meshes, especially for three-dimensional problems, remainsan art, requiring the analyst to use intuition about the equations being solved to guideprograms that generate the mesh. This is done interactively: The analyst provides certainparameters to the mesh-generation program, then looks at the resulting mesh, revises theparameters based on the mesh’s appearance, and regenerates the mesh. After achievinga satisfactory mesh, the analyst runs the equation solver and examines the solution. Theanalyst then uses the solution to guide further iterations of this process.

The ability to visualize the mesh is key to the entire process. A technique is neededthat provides the simplicity of a shaded, hidden-surface removed image, with the abilityto see interior detail of a wireframe drawing. One solution, suggested by work in volumevisualization [4], is to provide a sequence of isocontour surfaces based on a field definedover the mesh. This does not give detail on the mesh structure, however. Figure 1 illus-trates a sequence of images that reveal important changes in interior mesh density. Toallow the analyst to explore meshes of the complex structures encountered in practice, itmust be possible to generate rapidly sequences of images from a variety of viewpoints

1 IBM T. J. Watson Research Center, P. O. Box 218, Yorktown Heights, NY 10598, USA.

Received May 31, 1994; revised November 14, 1994, April 4, 1995, and July 8, 1995. Communicated byJ. S. B. Mitchell.

Page 2: Visualization of Three-Dimensional Delaunay Meshes

Visualization of Three-Dimensional Delaunay Meshes 115

Fig. 1.Sequence of six regions of interest, which reveal important changes in mesh density. The mesh consistsof approximately 2500 Delaunay tetrahedra.

and a variety of regions of interest. Effective visualization demands that it take at mosta few seconds to generate images of new regions of interest from a fixed viewpoint, andat most a few tens of seconds to begin generating images from a new viewpoint.

The algorithm we describe in this paper has been incorporated in a system, called Foxi,for designing and analyzing the performance of three-dimensional semiconductor andelectronic packaging structures. With Foxi, an engineer can create parametrized modelsof three-dimensional structures complete with material properties, boundary conditions,and loadings. Finite-element analysis is then used to compute various mechanical andelectrical properties such as thermally induced stresses, resistances, and capacitances.Figure 2 shows such a mesh and a mesh detail, both created and rendered using Foxi.The detail was obtained by (interactively) interrupting the visualization, magnifying,and then resuming the visualization. The Foxi system, including the mesh-visualizationalgorithm described here, has been in use for several years within IBM.

Page 3: Visualization of Three-Dimensional Delaunay Meshes

116 M. S. Karasick, D. Lieber, L. R. Nackman, and V. T. Rajan

Fig. 2. The top picture was obtained by interrupting the visualization, and the bottom picture was generatedby magnifying the screen image, resuming the visualization, and then interrupting it again.

Page 4: Visualization of Three-Dimensional Delaunay Meshes

Visualization of Three-Dimensional Delaunay Meshes 117

2. Previous Work. The key step in most standard techniques for producing shaded,hidden-surface removed images of polyhedral scenes (such as a tetrahedral mesh) is toorder the faces of the polyhedra from back to front. Then, if the faces are drawn from backto front, the resulting image will be correct. Unfortunately, this is not always possible[16]. There are two solutions. One is to use a hardware Z-buffer. However, attainingsufficient speed with tens of thousands of mesh elements requires hardware that is moreexpensive than widely available standard raster display hardware, such as that used withX-windows.

The second solution requires splitting the polygons so that an ordering exists and canbe found. This can be done using a Binary Space Partitioning (BSP) tree [10], but itis far too slow for rendering complicated meshes. For example, a hidden surface andperspective view of a 17,000-element mesh using a BSP tree [10] required 38 minuteson an IBM RiscSystem/6000, which is far too slow for interactive use.

Instead of computing a visibility ordering of faces, Williams [17] showed how toorder tetrahedral elements, and thus obtain an ordering of their faces. In particular, if(1) the meshed region is convex, that is, the union of the mesh’s tetrahedra is convex,and (2) the mesh adjacency graph is acyclic, then a visibility ordering is contained in themesh adjacency graph. The Meshed Polyhedra Visibility Ordering (MPVO) algorithmconstructs and traverses this graph (in visibility order) as follows:

1. Construct the adjacency graph for the mesh. Each node of the graph corresponds toan element (tetrahedron) of the mesh. Two nodes are connected by a graph edge ifthe two elements share a face. This is done once per mesh.

2. To display the mesh from a given viewpoint:(a) For each pair of adjacent elements, if one elemente1 is behind elemente2, direct

the corresponding graph edge from the node corresponding toe1 to the nodecorresponding toe2; otherwise direct the graph edge in the opposite direction.This yields a directed, acyclic graph (DAG).

(b) Perform a topological sort of the DAG. The resulting total ordering of the DAGgives an order in which to display the elements. An element is displayed byrendering its forward-looking faces.

Given a nonconvex mesh with an acyclic adjacency graph, Williams presents a heuristicthat sometimes, but not always, obtains a visibility ordering. The structures analyzedwith Foxi are often nonconvex.

Delaunay triangulations, which are commonly produced by automated three-dimen-sional mesh generators [2], [13], have the property that there always exists a visibilityordering among the tetrahedra [6]. We use the termDelaunay Triangulationto refer toa three-dimensional mesh that consists of Delaunay tetrahedra. This is different fromrelated triangulations, such as theconstrainedDelaunay triangulation, often discussedin the meshing literature. To be useful as a finite-element mesh, an (unconstrained)Delaunay triangulation must have the property that a subset of the Delaunay tetrahedraexactly covers the region to be meshed. Such a triangulation is sometimes called aconforming Delaunay triangulation. A conforming triangulation can be achieved byaugmenting the set of vertices with a sufficient number of Steiner points [8]. The mesherused in Foxi places additional vertices as sketched in [13].

Max et al. [12] have applied the result of [6] to volume rendering of a scalar field

Page 5: Visualization of Three-Dimensional Delaunay Meshes

118 M. S. Karasick, D. Lieber, L. R. Nackman, and V. T. Rajan

and induced contour surfaces when the field is represented over a Delaunay mesh. Theiralgorithm, like Williams’s algorithm, traverses the mesh adjacency graph to find thedepth ordering, but uses the result of [6] to compare tetrahedra.

In this paper we present an algorithm for rendering Delaunay tetrahedra that doesnot require the adjacency graph and works with all meshes, convex and nonconvex.Our computation of the visibility ordering is similar to that of [12], except that we donot require the mesh adjacency graph. Hence, the mesh need not be connected, or evenconvex. This is especially important when rendering subsets of a mesh. For example,if a field is represented over a Delaunay mesh, then we can render just those tetrahedraintersected by an induced isosurface, and the rendering time is a function of the isosurfacesize, not of the mesh size.

We also use the visibility ordering as the basis for tools that show in real-time howinterior mesh structure changes, and how the field varies over the mesh. This is quitedifferent from Maxet al. [12] who produce a volumetric rendering of a scalar field.

3. Theoretical Background. The theory behind our visualization code was sketchedin [12]. This section gives a more complete description of the theory, including thetreatment of degenerate triangulations, which occur often in practice.

3.1. Visibility Partial Ordering. We begin by defining the notion of a visibility partialordering. LetA = A1, . . . , An be a set of convex geometric objects in<3 with disjointinteriors. Let a pointp ∈ <3 be called the viewpoint.

DEFINITION 1. If there exists a ray from the viewpointp that intersects the interiors ofbothAi andAj , then we define thepairwise visibility orderingof Ai andAj with respectto p as follows. If the ray intersectsAi first, thenAi ≺p Aj ; otherwiseAj ≺p Ai . If thereis no such ray, then we say thatAi andAj arepairwise incomparablewith respect top.

LEMMA 1. The pairwise visibility ordering ofA is an irreflexive, asymmetric relation.2

PROOF. We must first show that the pairwise visibility ordering is well defined, that is,that it is independent of the choice of rays. Suppose that two rays yield different orderings.Let r1 andr2 be two rays originating from the viewpointp and intersecting the objectsA and B. Let pointsa1 and b1, in that order, be in the interior of the intersectionsof r1 with A and B. Likewise, letb2 and a2, in that order, be in the interior of theintersections of rayr2 with A and B. By convexity, the point of intersection of linesegmentsa1a2 andb1b2 is in the interior of bothA andB. This contradicts the disjointinteriors assumption. Thus, the pairwise visibility ordering is independent of the raychosen. Along any particular ray, the pairwise visibility ordering is determined by theordering of the points of first intersection with the objects. This constitutes a mappingto the real numbers, and therefore irreflexivity and asymmetry follow.

2 See Section 2.2.3 of [11] for definitions of these terms.

Page 6: Visualization of Three-Dimensional Delaunay Meshes

Visualization of Three-Dimensional Delaunay Meshes 119

We would like to extend our study of visibility ordering beyond pairwise orderingby introducing transitivity. This can lead to a contradiction if there exists a sequence ofelements ofA such thatAk ≺p Ai1 ≺p · · · ≺p Aim ≺p Ak. In this case,A is said tobecyclic with respect to the viewpointp. For an acyclic set, the addition of transitivitymakes the visibility ordering a partial ordering.

DEFINITION 2. If A has an acyclic visibility ordering with respect to a viewpointp,then the pairwise visibility ordering augmented with transitivity is a partial ordering,which we call thevisibility partial ordering.

3.2. Visibility Properties of Delaunay Triangulations. We now show how the propertiesof Delaunay tetrahedra allow us to obtain quickly a total ordering that embeds thevisibility partial ordering.

DEFINITION 3. A triangulation of a point set in<3 is aDelaunay triangulationif thecircumsphere of every tetrahedron does not contain any member of the point set in itsinterior.

It can be shown that if the point set isnondegenerate, that is, the set contains no fivecospherical points, then the Delaunay triangulation is unique [5]. (See [1] for a reviewof the properties of Delaunay triangulations.) We say that two tetrahedra aredegenerateif their vertices are cospherical. We discuss degenerate tetrahedra in Section 3.3.

DEFINITION 4. Thepower, P(p, S), of a pointp with respect to a sphereS centeredat c with radiusr is (c− p)2 − r 2. Thepower, P(p, T), of a pointp with respect to atetrahedronT is the power ofp with respect to the circumsphere ofT .

Geometrically, if the pointp is outside the sphere, the power is the square of the lengthof the tangent fromp to S; if the point is inside, the power is minus the square of thelength of the half-chord withp as center.

The importance of the power function for us is given by the following theorem [12].

THEOREM1. If Ta and Tb are two nondegenerate tetrahedra in a Delaunay triangula-tion and Ta ≺p Tb, thenP(p, Ta) < P(p, Tb). If Ta and Tb are two degenerate tetrahedrain a Delaunay triangulation, thenP(p, Ta) = P(p, Tb).

We shall prove this theorem by a sequence of lemmas.Three noncollinear points in<3 define a trianglet with a circumcircleCt centered at

ct with radiusrt . There exists a one-parameter family of spheresCPt called apencil ofcoaxal spheres[3, Section 6.5], that pass throughCt . This family of spheres is the familyof circumspheres of the tetrahedra witht as a face. The sphere centers lie along thelineof centers, the line that passes throughct and that is normal to the plane oft . Withoutloss of generality, we let the plane oft be thex–y plane, with the origin atct . The lineof centers is thez-axis and the coaxal pencil is parametrized by thez-coordinate of thesphere centers. See Figure 3.

Page 7: Visualization of Three-Dimensional Delaunay Meshes

120 M. S. Karasick, D. Lieber, L. R. Nackman, and V. T. Rajan

Fig. 3.Section throughx–z-coordinate plane of a pair of coaxal spheres.

LEMMA 2. Let p = (x, y, z), z> 0, be a point, and let two spheres S1 and S2 be fromCPt with centers at(0, 0, z1) and (0, 0, z2), respectively. If z1 > z2, thenP(p, S1) <

P(p, S2).

PROOF. By the Pythagorean theorem, the square of the radius ofSi is r 2t + z2

i . Bydefinition,P(p, Si ) = x2 + y2 + (z− zi )

2 − (r 2t + z2

i ). Thus,P(p, S1) − P(p, S2) =2z(z2− z1) < 0.

LEMMA 3. Let T1 and T2 be two nondegenerate Delaunay tetrahedra that share acommon face t, and let S1 and S2 be the corresponding circumspheres with circumcenters(0, 0, z1) and(0, 0, z2), respectively. If T1 ⊂ {z≥ 0} and T2 ⊂ {z≤ 0}, then z1 > z2.

PROOF. Let q = (xq, yq, zq) be the fourth vertex ofT1, as illustrated in Figure 4. By

Fig. 4. Section throughx–z-coordinate plane of two adjacent tetrahedra. Note that the pointq need not be inthex–z-coordinate plane.

Page 8: Visualization of Three-Dimensional Delaunay Meshes

Visualization of Three-Dimensional Delaunay Meshes 121

definition, it lies onS1, which implies thatx2q+ y2

q+(zq−z1)2−(r 2

t +z21) = 0. However,

sinceq lies outside ofS2, we also havex2q+ y2

q+ (zq− z2)2− (r 2

t + z22) > 0. Combining

these, we obtainzq(z1− z2) > 0. Sincezq > 0, z1 > z2.

LEMMA 4. Let T1 and T2 be two nondegenerate Delaunay tetrahedra that share acommon face t and letp be a point. If T1 ≺p T2, thenP(p, T1) < P(p, T2).

PROOF. SinceT1 ≺p T2, the pointp lies on the same side oft as T1. Therefore theconditions of Lemmas 2 and 3 are satisfied and they imply the lemma.

PROOF OFTHEOREM1. With this, we can now prove Theorem 1. If two tetrahedra aredegenerate, they have the same circumsphere, so the powers of any points with respectto the tetrahedra are equal. In the nondegenerate case, the convexity of the Delaunaytriangulation of a point set implies that any ray that intersects bothTa andTb intersects asequence of adjacent Delaunay trianglesTa = T1, . . . , Ti , . . . , Tb. Let Ti andTi+1 sharea common triangleti . Then, from Lemma 4,P(p, Ti ) ≤ P(p, Ti+1), with equality whenTi andTi+1 are degenerate. SinceTa andTb are nondegenerate, there is at least one strictinequality in this sequence, and hence the result follows.

Even though the proof of Theorem 1 assumes the existence of a sequence of adjacentDelaunay tetrahedra, computation of the power function, which determines the partialvisibility ordering, requires only the coordinates of their vertices. A Delaunay mesh foran object is defined as the subset of tetrahedra from a Delaunay triangulation that coversthe object and conforms to its boundary. If the object is nonconvex, so is the mesh. Thus,given the coordinates of the vertices of the tetrahedra of a Delaunay mesh, we can usethe power function to obtain the visibility partial ordering of the tetrahedra.

3.3. Visibility Properties of Degenerate Delaunay Triangulations. WhenTa and Tb

are degenerate,P(p, Ta) = P(p, Tb), and therefore the power function does not provideordering information. However, the converse is not true: equality of the power functionsdoes not imply that the tetrahedra are degenerate because it is also possible that theyare incomparable in the partial ordering. In the latter case, the tetrahedra can be orderedarbitrarily.

We now consider the degenerate case. A set of degenerate Delaunay tetrahedra mayor may not have an acyclic visibility ordering. In the acyclic case, the ordering can becomputed by brute-force pairwise comparison of the tetrahedra. Since the number ofsuch tetrahedra is small even this quadratic-time approach is acceptable. However, thecyclic case is more difficult, requiring tetrahedra to be split to break the cycle, such asby using the BSP-tree algorithm [10]. Alternatively, it is possible to avoid generatingdegenerate tetrahedra that have a cyclic visibility ordering.

Most often, Delaunay tetrahedra are generated using one of several incremental al-gorithms, that is, algorithms that add one point at a time [9], [15]. Any set of degeneratepoints can be perturbed slightly to make it nondegenerate [7] and the Delaunay tri-angulation generated from the perturbed points is acyclic. If an incremental algorithmconsistently treats each newly inserted degenerate point as either inside or outside the

Page 9: Visualization of Three-Dimensional Delaunay Meshes

122 M. S. Karasick, D. Lieber, L. R. Nackman, and V. T. Rajan

circumsphere, this is tantamount to perturbing the points. Therefore, such incrementalalgorithms for Delaunay triangulation always generate triangulations with an acyclicvisibility ordering. Thus, Delaunay triangulations with cyclic visibility orderings do notoccur in practice, and we ignore them hereafter.

4. Algorithm. Since the power function is a mapping from the tetrahedra to the realnumbers, it provides a total ordering, which can be used to render the tetrahedra of anyDelaunay mesh. Ignoring degeneracies for the moment, the algorithm is straightforward:

1. Compute the circumsphere of each tetrahedron in the mesh.2. For a given viewpoint:

(a) Compute the power of the viewpoint with respect to each circumsphere.(b) Sort the tetrahedra by their powers.(c) Render the tetrahedra in order of decreasing power.

Some efficiency can be gained by precomputing the viewpoint-independent part ofthe power function. The power function can be written as(c2−r 2)−2c·p+p2, of whichthe first term can be precomputed and the last term can be dropped since it is constantfor a given viewpoint. Note that for orthographic projections,p tends to infinity, and theordering can be determined by sorting the circumcenters in the viewpoint direction.

If two tetrahedra have the same power function, it means that either they are degener-ate or they are incomparable in the visibility ordering. We can easily determine whetherthe tetrahedra are degenerate by testing for equality of their centers. If they are not degen-erate, they can be rendered in arbitrary order. Degenerate tetrahedra must be ordered bypairwise comparison, for example, by ray-casting from the viewpoint direction. Since thecomputation is done using floating-point arithmetic, there is the possibility of numericalerror in comparison of the power function, and the circumcenters. Our implementationis conservative, and will do ray-casting when in doubt. In practice, this extra ray-castingdoes not affect the computation time.

5. Analysis. The computation of the circumcenter and circumradius for each tetrahe-dron requires evaluating four 4× 4 determinants. This requires time linear in the size ofthe mesh, and is done once. The sort of then tetrahedra for any given viewpoint (includ-ing computation of the power) can be done inO(n logn) worst-case time. In practice,we use a bucket sort to reduce the expected sorting time to linear (see Section 7). If wemake the realisitic assumption that the size of each subset of degenerate tetrahedra isbounded by a constant, then each sort takes constant time.

Contrast this with the BSP-tree [10] approach. The best-known algorithm for pro-ducing a BSP tree [14] requiresO(n3) viewpoint-independent preprocessing time andproduces an output data structure of sizeO(n2), which then takesO(n2) time to renderfor each viewpoint. (The size of the data structure is bounded from below byÄ(n3/2).)In practice,n is of the order 103 to 105, so the difference is significant. We presentexperimental evidence to this effect below. (For larger meshes, such as those used incomputational fluid dynamics analyses, the difference is even more significant.)

The MPVO algorithm of Williams [17] runs in timeO(n) for acyclic convex meshes,but requires the adjacency graph for the mesh. If not given, the graph must be constructed

Page 10: Visualization of Three-Dimensional Delaunay Meshes

Visualization of Three-Dimensional Delaunay Meshes 123

by sorting. Williams presents a heuristic for acyclic nonconvex meshes, which requiresan initial sort of front-facing tetrahedra, and can produce an incorrect visibility ordering.Max et al. [12] also use the adjacency graph to compute the visibility ordering.

6. User Interaction. The ability to order tetrahedra rapidly opens up new possibilitiesfor user interaction.

6.1. Interacting with Delaunay Meshes. As we described in Section 1, practical appli-cations demand the ability to visualize the interior of complex three-dimensional meshes.While drawing a two-dimensional mesh is sufficient, visualizing a three-dimensionalmesh is more difficult. Rapid sorting helps by letting us use time as another displaydimension: watching complete tetrahedra be drawn from back to front provides an im-portant depth cue.

Time can also be used to select a region of interest. By stopping the rendering processat any time, the user will see a meaningful portion of the interior of the mesh. Stoppingcan be accomplished by pressing a button, specifying a depth value, or a percentageof the tetrahedra to be drawn. After stopping, the user can change the viewpoint forthe tetrahedra that have already been drawn, and then further examine that subset fromdifferent views. This selection process can be repeated to pare the region of interestfurther.

Rapid visibility sorting also makes it possible to display “motives” of regions ofinterest. Draw the tetrahedra back to front, then “undraw” tetrahedra front to back.Repeat this over and over to get a back-and-forth “movie” of a region of interest.

6.2. Undrawing. The obvious approach to undrawing is to clear the screen and redrawthe elements from back to front, stopping before drawing the elements to be “undrawn.”For practical size meshes on current workstation hardware, this is much too slow. Anotherapproach is to undraw a tetrahedron by drawing its back faces. This works wheneverthere is a tetrahedron of the same material that is adjacent to the other side of the backface. However, for nonconvex or multiple material meshes there are tetrahedra for whichthis is not true. For nonconvex meshes, the undrawn tetrahedron may expose a void, andfor multiple material meshes, it may expose a tetrahedron of a different material, thatmay be rendered using a different color.

Undrawing can be implemented as follows. Starting with the portions of the meshcurrently displayed (possibly all of it), undraw the elements in the reverse order that theywere drawn. An element can be undrawn by drawing each of its back faces in inversevisibility order: for a back face that is shared with another element, draw the face in thecolor of the adjacent element; for a back face that is not shared with another element,restore the pixels covered by the projection on the screen of the face to their contentswhen the back face was encountered when drawing from back to front. Figure 5 showsan example in which both cases arise. In the figure, instead of saving and restoring thepixels covered by the projection of each unshared back face, the pixels covered by theaxis-aligned bounding box of the projection of the whole element are saved. Since anysuperset of the pixels can be saved and restored, the choice of the superset is driven byimplementation considerations.

Page 11: Visualization of Three-Dimensional Delaunay Meshes

124 M. S. Karasick, D. Lieber, L. R. Nackman, and V. T. Rajan

Fig. 5. (a) After drawing the mesh elements, from back to front. (b) All of elementA’s back faces are sharedwith another element, so it is not necessary to save any pixels. (c) ElementB has an unshared back face, so, justbefore drawingB, the pixels covered by the axis-aligned bounding box of the projection ofB onto the screenare saved.B is undrawn by restoring these pixels. (d)A is undrawn by redrawing its back faces (highlightedhere) as front faces of the adjacent elements.

Implementing this undrawing scheme requires that element adjacency information beavailable. Element adjacency information is computed by most mesh generators, but issometimes discarded in node-element table format data files. If not available, it can becomputed by lexicographically sorting face coordinates. Since element adjacency is aproperty of the mesh, it is viewpoint independent and only needs to be computed once.In fact, all that is required is that tetrahedra that lie on material interfaces be annotatedwith the material type on the opposite side of the interface.

When drawing the mesh, instead of ignoring back faces completely as in the usualpainter’s algorithms, a rectangular region of display pixels must be saved for each backface that has no adjacent element. In the worst case the number of regions that need tobe saved is linear in the number of elements. In practice, memory usage has not been aproblem and the overhead of saving pixels decreases the speed of the drawing algorithmby roughly 20% for large meshes.

6.3. Rendering Fields over Delaunay Meshes. Solutions are often represented as a fielddefined over the mesh. The ability to visualize interior mesh elements provides a meansto visualize the behavior of the corresponding field. Instead of rendering the tetrahedronitself, simply render the behavior of the field over the tetrahedron. For example, a scalarfield can be represented by rendering using different color values to correspond to fieldintensity. Each tetrahedron can be colored according to the value of the interpolatedscalar field at its centroid. If the field values do not vary significantly over each element,then this kind of approximation works well. Optionally, the tetrahedral facet color canbe graded. The ability to watch a “movie” of the field by rendering the tetrahedra in thisway, from back to front, is a powerful visualization aid.

An isosurface of a scalar field can also be visualized. Maxet al. [12] superimpose a

Page 12: Visualization of Three-Dimensional Delaunay Meshes

Visualization of Three-Dimensional Delaunay Meshes 125

Fig. 6.An isosurface of a temperature field: the dark side and light sides of the isosurface are respectively thehot and cold sides of the surface.

family of isocontours by intersecting the mesh tetrahedra with the members of the family.This can be done quickly for fields interpolated with a linear shape function, becausethe intersections are triangles and quadrilaterals. We use the isosurfaces to prune themesh. When running the drawing algorithm, only tetrahedra that intersect the isosurfaceneed to be examined, and only those tetrahedra that intersect the isosurface need to beresorted when changing viewpoint. (This is possible because the mesh adjacency graphis not needed in order to sort the tetrahedra.) See Figure 6. Movies of isosurfaces can begenerated by varying the isocontour threshold, and rendering only those tetrahedra thatintersect the isosurface.

7. Implementation. The algorithm has been implemented on an IBM Risc-System/6000 workstation using the standard X-windows library (Xlib) to drive the dis-play. Figure 1 shows a sequence of six regions of interest in one mesh that was renderedby the algorithm discussed. To illustrate the performance improvements over conven-tional techniques that do not require mesh adjacency graphs, Table 1 gives timings forrendering several meshes with both the BSP-tree algorithm and our algorithm. It isreadily apparent that the performance benefit increases dramatically with the numberof tetrahedra in the mesh. Since meshes used in nonlinear stress analyses often have a

Page 13: Visualization of Three-Dimensional Delaunay Meshes

126 M. S. Karasick, D. Lieber, L. R. Nackman, and V. T. Rajan

Table 1.Performance of the BSP-tree algorithm and the algorithm in this paper on an RiscSystem/6000 model 530.

Rendering time(seconds)

Mesh sizeBSP-tree This algorithm

(elements) Preprocess* Render* Preprocess* Render*

2,500 15 7 ∼0 217,000 220 50 ∼0 12

(30 min) (8 min)73,000 Exceeds machine resources 2 70

*Preprocessing time is time spent once per mesh; rendering time is time required to render the meshfrom one viewpoint. For both methods, rendering begins as soon as the preprocessing is complete.The parenthesized times are total “wall clock” times, and are included when different from thecomputing time (due to paging overhead).

few tens of thousands of elements, and meshes used in semiconductor device simulationhave on the order of 105 elements, the performance benefits are important in practice.Table 2 shows the rendering time of different meshes of the same object, a U-shapedtrench (see Figure 7), on different machines. The meshes are created by placing nodes atcorners of cuboids. Table 2 shows the aspect ratio of the cuboids. The first five meshes inthe table are highly degenerate. (The nodes are equally spaced inx, y, andz directions.See, for example, Figure 7.). As can be seen from the table, the rendering time dependsalmost entirely on the number of elements in the mesh. There is a small dependency onthe shape of the elements (aspect ratio of the cuboids).

Table 2. Rendering times for meshes of trench (aU-shaped cylinder) contained in a box of dimension

2× 1× 1 units.∗

Mesh shape and Rendering timessize (seconds)

dx:dy:dz Elements T320 T590

1:1:1 3,786 16 41:1:1 16,314 56 131:1:1 32,249 107 271:1:1 71,437 213 521:1:1 97, 624 310 705:5:2 96,175 278 68

10:5:1 99,965 295 72

∗The meshes were created by placing nodes at distancesdx, dy, dz apart in each direction. Two measurementswere taken by a stopwatch for each machine and eachmesh, and the times were averaged and rounded to thenearest second. T320 and T590 are the times on RS/6000Model 320 and Model 590, respectively. Model 320 israted at 20 mips, and Model 590 is rated at 133 mips.

Page 14: Visualization of Three-Dimensional Delaunay Meshes

Visualization of Three-Dimensional Delaunay Meshes 127

Fig. 7.This is a snapshot of the interior of the 32,249-element mesh described in Table 2. About a third of theelements have been rendered.

Processing for our algorithm requires computation of the circumsphere and powerfunction for each tetrahedron, sorting the tetrahedra, and then displaying them in order.In practice, the display time is significant, and therefore we use a bucket-sort, so thatwe can interleave the display and sorting for each bucket. This makes preprocessing(computation of the circumsphere, power function, and bucketing) negligible. Our pre-processing time compares favorably with those given for the MVPO algorithm in [17],even though we include the time needed to compute the circumspheres, while [17] doesnot include the time needed to compute face equations.

For our implementation, the time required to sort the tetrahedra is swamped by thedisplay time (which is governed by display-hardware speed). We also found that therewas no need to sample the mesh in order to get a uniform hash-bucketing for highlygraded meshes. Even when our algorithm is used for very large meshes (106 elements),we expect the display time to dominate.

This implementation has been in use within IBM for several years; it has been usedto visualize hundreds of meshes and calculated fields over those meshes. Users indicatethat rapid visualization of meshes and fields is one of the most important features ofFoxi.

8. Summary and Conclusions. We have presented an algorithm for visibility orderingof the tetrahedra in a Delaunay or generalized Delaunay triangulation. This algorithm,which works for convex and nonconvex meshes and requires no adjacency information,has been applied to rapid rendering of finite-element meshes and fields.

We have also presented an algorithm for undrawing elements, which provides thepossibility of exploring a region of interest with both backward and forward motions inthe mesh. This second algorithm requires that element adjacency information be knownor computed. Moreover, for nonconvex meshes it requires storing pixel maps. In theworst case, large amounts of memory could be required, but in practice this schemeworks well.

Page 15: Visualization of Three-Dimensional Delaunay Meshes

128 M. S. Karasick, D. Lieber, L. R. Nackman, and V. T. Rajan

Our implementation of these algorithms has been used within IBM for several yearswith excellent performance.

References

[1] F. Aurenhammer. Voronoi diagrams—a survey of a fundamental geometric data structure.ACM Com-puting Surveys, 23:345–405, 1991.

[2] J. C. Cavendish, D. A. Field, and W. H. Frey. An approach to automatic three-dimensional finite-element mesh generation.International Journal for Numerical Methods in Engineering, 21:329–347,1985.

[3] H. S. M. Coxeter.Introduction to Geometry, 2nd edn. Wiley, New York, 1969.[4] R. A. Drebin, L. Carpenter, and P. Hanrahan. Volume rendering.Computer Graphics, 22(4):65–74,

August 1988.[5] H. Edelsbrunner.Algorithms in Combinatorial Geometry. Springer-Verlag, Berlin, 1987.[6] H. Edelsbrunner. An acyclicity theorem for cell complexes. InProc. Fifth Annual Symposium on Com-

putational Geometry, pages 145–151, Saarbr¨ucken, June 1989. Association for Computing Machinery,New York.

[7] H. Edelsbrunner and E. M¨ucke. Simulation of simplicity: technique to cope with degenerate cases ingeometric algorithms.ACM Transactions on Graphics, 9(1):66–104, January 1990.

[8] H. Edelsbrunner and Tiow Seng Tan. An upper bound for conforming delaunay triangulations. InProc.Eighth Annual Symposium on Computational Geometry, pages 53–62, Berlin, June 1992. Associationfor Computing Machinery, New York.

[9] D. A. Field. Implementing Watson’s algorithm in three dimensions. InProc.Second Annual Symposiumon Computational Geometry, pages 246–259, Yorktown Heights, NY, June 1986. Association forComputing Machinery, New York.

[10] H. Fuchs, Z. Kedem, and B. Naylor. On visible surface generation bya priori tree structures.ACMSIGGRAPH: Computer Graphics, 14:124–133, July 1980.

[11] D. E. Knuth.The Art of Computer Programming, vol. 1. 2nd edn. Addison-Wesley, Reading, MA,1973.

[12] N. Max, P. Hanrahan, and R. Crawfis. Area and volume coherence for efficient visualization of 3dscalar functions.Computer Graphics, 24(5):27–33, November 1990.

[13] S. Meshkat, J. Ruppert, and Hungwen Li. Three-dimensional unstructured grid generation basedon Delaunay tetrahedrization. InProceedings Third International Conference on Numerical GridGeneration, pages 841–851, Barcelona, June 1991. North-Holland, Amsterdam.

[14] M. S. Paterson and F. F. Yao. Binary partitions with applications to hidden-surface removal and solidmodelling. InProc. Fifth Annual Symposium on Computational Geometry, pages 23–32, Saarbr¨ucken,June 1989. Association for Computing Machinery, New York.

[15] V. T. Rajan. Optimality of the delaunay triangulation inr d. In Proc. Seventh Annual Symposium onComputational Geometry, pages 357–363, North Conway, NH, June 1991. Association for ComputingMachinery, New York.

[16] I. E. Sutherland, R. F. Sproull, and R. A. Schumacher. Ten hidden-surface algorithms.ACM ComputingSurveys, 6:1–55, March 1974.

[17] P. L. Williams. Visibility ordering meshed polyhedra.ACM Transactions on Graphics, 11:103–126,April 1992.