visibility computations on hierarchical triangulated terrain models

32
GeoInformatica, 1, 219–250 (1997) c 1997 Kluwer Academic Publishers. Manufactured in The Netherlands. Visibility Computations on Hierarchical Triangulated Terrain Models LEILA DE FLORIANI [email protected] PAOLA MAGILLO [email protected] Dipartimento di Informatica e Scienze dell’Informazione Universit` a di Genova Via Dodecaneso, 35 - 16146 Genova (Italy) Received June 13, 1996; Revised April 23, 1997; Accepted May 19, 1997 Abstract Hierarchical terrain models provide a multiresolution description of a topographic surface based on a nested partition of the domain. The tree-like structure of these models is an effective support to processing spatial op- erations. In this paper, we consider visibility computations on hierarchical terrain models based on triangular subdivisions, called Hierarchical Triangulated Irregular Networks (HTINs). We address two basic problems in visibility computation, namely determining the visibility of a query object, and computing the viewshed of a given viewpoint. We propose algorithms for performing such operations on an HTIN at variable resolution. A general drawback of hierarchical models is in the inconsistency of representations at variable resolution obtained from them, since vertical gaps may occur at edges where different resolutions meet. The algorithms proposed here avoid this undesired effect. A related, but independent, contribution of this paper is also a new algorithm for extracting a consistent terrain representation at variable resolution from an HTIN. Keywords: multiresolution representations, hierarchical terrain models, visibility computation, data structures and algorithms 1. Introduction In geographic information systems, terrains are represented through digital models: a digital terrain model is characterized by a domain partition, and by a space of functions used to piecewise represent the surface on such partition. A better accuracy in the approximation is generally achieved through a finer partition of the domain, thus yielding larger storage costs and higher computation times. On the other hand, not all tasks in GIS applications necessarily require the same accuracy, and even a single task may need different degrees of resolution in different portions of the terrain. Visibility computations are examples of such tasks. For instance, in landscape visualization and in flight simulation, the terrain surface and the objects on the terrain must be rendered at different degrees of resolution, depending on their distance from the viewpoint. In general, visibility computations are sensitive to elevation errors near the viewpoint, therefore it is recommended to vary resolution according to the distance from the viewpoint [15]. Multiresolution models provide a compact representation of a terrain at different resolu- tion levels. In a hierarchical terrain model, multiresolution is achieved on the basis of a nested partition of the domain into increasingly finer subdivisions. The tree-like structure of a hierarchical model can be easily navigated both vertically (i.e., across different resolution

Upload: leila-de-floriani

Post on 02-Aug-2016

213 views

Category:

Documents


0 download

TRANSCRIPT

GeoInformatica, 1, 219–250 (1997)c© 1997 Kluwer Academic Publishers. Manufactured in The Netherlands.

Visibility Computationson Hierarchical Triangulated Terrain Models

LEILA DE FLORIANI [email protected]

PAOLA MAGILLO [email protected] di Informatica e Scienze dell’InformazioneUniversita di GenovaVia Dodecaneso, 35 - 16146 Genova (Italy)

Received June 13, 1996; Revised April 23, 1997; Accepted May 19, 1997

Abstract

Hierarchical terrain models provide a multiresolution description of a topographic surface based on a nestedpartition of the domain. The tree-like structure of these models is an effective support to processing spatial op-erations. In this paper, we consider visibility computations on hierarchical terrain models based on triangularsubdivisions, called Hierarchical Triangulated Irregular Networks (HTINs). We address two basic problems invisibility computation, namely determining the visibility of a query object, and computing the viewshed of a givenviewpoint. We propose algorithms for performing such operations on an HTIN at variable resolution. A generaldrawback of hierarchical models is in the inconsistency of representations at variable resolution obtained fromthem, since vertical gaps may occur at edges where different resolutions meet. The algorithms proposed hereavoid this undesired effect. A related, but independent, contribution of this paper is also a new algorithm forextracting a consistent terrain representation at variable resolution from an HTIN.

Keywords: multiresolution representations, hierarchical terrain models, visibility computation, data structuresand algorithms

1. Introduction

In geographic information systems, terrains are represented throughdigital models: a digitalterrain model is characterized by a domain partition, and by a space of functions used topiecewise represent the surface on such partition. A better accuracy in the approximationis generally achieved through a finer partition of the domain, thus yielding larger storagecosts and higher computation times. On the other hand, not all tasks in GIS applicationsnecessarily require the same accuracy, and even a single task may need different degrees ofresolution in different portions of the terrain. Visibility computations are examples of suchtasks. For instance, in landscape visualization and in flight simulation, the terrain surfaceand the objects on the terrain must be rendered at different degrees of resolution, dependingon their distance from the viewpoint. In general, visibility computations are sensitive toelevation errors near the viewpoint, therefore it is recommended to vary resolution accordingto the distance from the viewpoint [15].

Multiresolution models provide a compact representation of a terrain at different resolu-tion levels. In ahierarchical terrain model, multiresolution is achieved on the basis of anested partition of the domain into increasingly finer subdivisions. The tree-like structure ofa hierarchical model can be easily navigated both vertically (i.e., across different resolution

220 DE FLORIANI AND MAGILLO

levels) and horizontally (i.e., within the same level), and provides an efficient and effectiveway for moving and rendering at variable resolution through the domain.

In this paper, we consider visibility operations at variable resolution on hierarchical ter-rain models. Such operations are classified intovisibility queries, which require the visibileportions of a query object from a given viewpoint, andviewshed computations, i.e., deter-mining the portion of the terrain visible from a selected viewpoint. We describe algorithmsfor implementing these operations, at variable resolution, on hierarchical triangulated terrainmodels, calledHierarchical Triangulated Irregular Networks(HTINs).

Visibility computation is a fundamental operation for terrain analysis in GISs: it may benecessary both for visualizing the surface and for analyzing or detecting properties of thesurface itself. Visibility information is useful in many GIS applications, such as selectionof optimal locations for fire towers or radar sites, line-of-sight communication problems,or the computation of hidden or scenic paths, etc.

Algorithms described here extend and improve previous methods proposed by the authors.The tree-like structure of an HTIN provides an effective support to processing spatialoperations, but a drawback is in the possible inconsistency of representations at variableresolution obtained from the model, since vertical gaps may occur at edges where differentresolutions meet. The algorithms proposed here avoid the undesired effect of vertical gaps.An independent contribution of the paper is an algorithm for extracting from an HTINa consistent description of a focus area of the surface at a level of resolution variablethrough the domain. In this paper, such algorithm is used as a sub-component of visibilityalgorithms.

We have developed a prototype system for terrain representation, analysis and visualiza-tion, which implements the algorithms described in this paper.

The reminder of this paper is organized as follows. Hierarchical TINs are defined inSection 2. In Section 3, we consider the issue of accessing an HTIN at variable resolutionand present a new algorithm for extracting a representation describing an area of interest of aterrain at variable resolution. The visibility problems addressed are introduced in Section 4.In Section 5 and 6, we discuss the solution of visibility queries and viewshed computationson an HTIN, respectively. Our algorithm for viewshed computation at variable resolutionon an HTIN is described in details in Section 7. In Section 8 we present some experimentalresults. Finally, Section 9 contains some concluding remarks.

2. Hierarchical Triangulated Terrain Models

A terrain is a surface in three dimensions, which can be characterized as the graphG of acontinuous bivariate functionz = φ(x, y), defined over a compact and connected subsetDof thexy-plane:

G ≡ (x, y, φ(x, y)) | (x, y) ∈ D.

SetD is called thedomainof the terrain.In practice, a terrainG is known at a finite setS ⊆ G of data points. Based on such points,

Digital Terrain Models(DTMs) are built. A DTM consists of a plane subdivisionΣ, withvertices at the projections of the data points, and a family of functions which approximateφ locally, on each region ofΣ.

VISIBILTY COMPUTATIONS 221

Depending on the topology of the domain subdivision, existing DTMs can be classifiedinto Regular Square Grids(RSGs), andTriangulated Irregular Networks(TINs). TINsare characterized by a triangulation of the domain and by linear interpolating functions; aproperty of TINs is the continuity of the surface described. In RSGs, the domain subdivisionconsists of a regular pattern of rectangles; functions used on such partition depend on thedegree of continuity desired for the surface: usually, either bilinear or constant functionsare used. RSGs can only be built from a regular distribution of points. Despite RSGs, TINscan deal with irregularily distributed data points and, thus, better adapt to terrain featuresby varying the density of sampling according to the roughness of the surface. For a fixednumber of vertices, a TIN usually provides a better approximation of the original surfacethan an RSG.

For a fixed subdivision topology, the accuracy of the terrain representation provided by aDTM usually increases with the numbern of its vertices. On the other hand, a larger numberof vertices leads to higher costs for both storage and manipulation of the model. Terrainmodels based onsuitably selected subsetsof the available data can optimize the tradeoffbetween accuracy and cost of data storage and processing, according to the requirementsof each specific task.

An approximate terrain modelis a model that does not interpolate all data points available,but only a subsetV ⊂ S. Theapproximation errorErr(P ) at a pointP ≡ (x, y, z) ∈ S−Vis commonly estimated as the absolute value of the difference between the interpolatedelevation value in the digital model and the measured elevation valuez. Theapproximationerror associated with a DTMD, with respect to a data setS, is defined as the maximumdistance over all points ofS betweenG and the digital terrain:

Err(D) ≡ maxErr(P )|P ∈ S − V.The irregular structure of TINs makes these models capable of providing approximate

terrain descriptions at a variety of sizes and resolutions. On the contrary, there are fewpossibilities for obtaining an approximated model which maintains the regular structure ofan RSG. In general, a nested partition of the domain is used, which is obtained by recursivelyapplying a regular decomposition pattern, based on thequadtree[26].

A Triangulated Irregular Network(TIN), built on a setV of sampled points on a terrain,consists of a pairD ≡ (Σ,Φ), where:

1. Σ is a plane triangulation, having the set of pointsV ≡ (x, y) | (x, y, z) ∈ V as itsvertices;

2. Φ is a family of linear functions, such that every functionφi ∈ Φ is defined on aclosed triangleti of Σ and interpolates the measuredz values of the three data points(x, y, z) ∈ V, corresponding to the vertices ofti.

The surfaceGD described by a TIND consists of the union of the local graphs of allfunctionsφi ∈ Φ. Condition 2 implies that the values of functionsφi coincide on thecommon boundary of adjacent triangles, and thusGD is a continuous surface.GD can bethought as the graph of a piecewise-linear functionφD, defined over the union of trianglesof Σ and such thatφD(x, y) ≡ φi(x, y) if point (x, y) belongs to triangleti ∈ Σ. Thespatial complexity of a TIN withn vertices is a linear function ofn. In the reminder of thepaper, we will usually identify a TIN with the underlying domain triangulation.

222 DE FLORIANI AND MAGILLO

An approximation error is associated with each triangleti of a TIN D. Such error isdefined as the maximun approximation error measured at those points ofS − V whosevertical projection lies inside or on the boundary ofti:

Err(ti) ≡ maxErr(P )|P ≡ (x, y, z) ∈ S − V|(x, y) ∈ ti.

Building a TIN reduces to the problem of selecting a setV ⊆ S and constructing atriangulationwith vertices at the projections of the data points on thexy-plane.

Since a set of points admits more than one triangulation, a triangulation which is “optimal”according to some suitable criterion is desiderable. A common choice is aDelaunaytriangulation. This kind of triangulation is characterized by “fat” triangles, and shows agood behaviour in numerical interpolation [21]. Other optimality criteria, recently proposed,take into account the elevations of data points, instead of just their locations in the plane.The resulting triangulations, calleddata-dependent triangulations, provide better surfaceapproximation in some special cases where Delaunay triangulation fails [13], [25].

2.1. Hierarchical TINs

Hierarchical TINs (HTINs) organize several TINs at different levels of resolution in acompact structure. Letε0, ε1, . . . , εh be a predefined decreasing sequence of tolerances onthe approximation error (εi > εi+1 for all 0 ≤ i < h). A constructive idea of an HTIN isthe following: starting from an initial coarse TIND0, whose approximation error is withinε0, any triangletj of D0, with Err(tj) > ε1, is separately refined into a “local” TINDj ,whose domain coverstj , and such thatErr(Dj) ≤ ε1; the process is recursively iteratedon the triangles ofDj , until the finest resolution levelεh is reached.

More formally, given a setS of sampled points on a terrainG, and a decreasing sequenceε0, ε1, . . . , εh of positive real values, aHierarchical Triangulated Irregular Network(HTIN)is a treeH ≡ (N ,A), where:

1. every node inN is a TINsDi, having its vertices in a subset ofS and containing morethan one triangle (with the only possible exception of the rootD0);

2. for every arc(Di,Dj) ∈ A, the domain ofDj coincides with a triangletj of Di; Dj iscalled thedirect expansionof triangletj , andtj is called thedirect abstractionof Dj ;

3. for the TIND0 at the root ofH, Err(D0) ≤ ε0;

4. for every arc(Di,Dj) ∈ A, if εk+1 < Err(Di) ≤ εk thenErr(Dj) ≤ εk+1;

5. for every TINDi that is a leaf ofH, Err(Di) ≤ εh.

An example of an HTIN is shown in Figure 1.A triangle which is refined in the hierarchy is called amacro-triangle, otherwise it is

called asimple triangle. It has been shown that the total size of a hierarchical TIN is linearin the number of its simple triangles [10], [11]. Thus, HTINs do not introduce a seriousmemory overhead with respect to a simple TIN at the maximum resolution.

Every triangletj of an HTINH has abirth error and adeath error in ε0, . . . , εh.Intuitively, the birth error of a triangletj is εi if tj belongs to a TIN which has been

VISIBILTY COMPUTATIONS 223

ε1

ε2

ε0

ε3

t1t2

t3t4 t5

t6

t0

Figure 1. A hierarchical TIN, built on a sequence of four tolerance values for the approximation error.

“created” at thei-step of the recursive refinement process. The death error oftj is εk(k ≥ i) if tj has been refined at stepk + 1 of the process. More formally:

• the triangles of the root TIND0 havebirth error = ε0;

• let tj be a triangle belonging to a TINDk ∈ N , different from the root, and lettkbe the direct abstraction ofDk; then, thebirth error of tj is the toleranceεi such thatErr(Dk) ≤ εi andεi ≤ Err(tk) < εi−1;

• the simple triangles havedeath error= εh;

• let tj be a macro-triangle andDi ∈ N be its direct expansion; then, thedeath erroroftj is defined as the toleranceεm such thatεm ≤ Err(tj) < εm−1.

Note thatErr(tj) ≤ death(tj) ≤ birth(tj). The life of a triangletj is the closed rangeof tolerances between the birth and death error oftj : life(tj) ≡ [death(tj), birth(tj)]. InFigure 1,life(t0) = life(t1) = life(t2) = life(t4) = [ε1, ε1], life(t3) = [ε2, ε1] andlife(t5) = life(t6) = [ε3, ε1].

224 DE FLORIANI AND MAGILLO

2.2. Consistency Rules

In an HTIN, the refinement of a macro-triangletj is performed by adding new vertices,represented by data points ofS whose vertical projections lie either insidetj or on its sides.In order to guarantee the continuity of the interpolating surface on adjacent patches, trianglerefinement in an HTINHmust ensure that common edges of adjacent triangles are refinedin the same way. Two triangles of an HTIN are calledadjacentif they share an edge, even ifthey belong to different nodes. An HTIN isconsistentif, for each pair of adjacent trianglesti andtj ofH, sharing an edgee, one of the following conditions holds:

1. the death errors ofti andtj are equal, and bothti andtj are simple triangles (i.e.,tiandtj are both unrefined);

2. the death errors ofti andtj are equal, bothti andtj are macro-triangles, (i.e,ti andtj are refined at the same step), and the direct expansions ofti andtj insert the samevertices on edgee;

3. the death errorsεi andεj of ti andtj , respectively, are different (letεi < εj be thecase, i.e,ti refined beforetj , with tj possibly unrefined), and edgee is unrefined in thedirect expansion ofti.

In Figure 1, rule 1 applies for trianglest5 – t6, rule 2 applies for trianglest0 – t1, and fort1 – t2; rule 3 applies fort3 – t4, and fort4 – t5.

In the reminder of this paper, we deal withconsistent hierarchical TINs. The rule usedfor selecting and inserting points in a triangle, that is refined from leveli to level i + 1,characterizes the different types of HTINs proposed in the literature.

In heuristic hierarchical triangulations[27], a trianglet is refined by iteratively applyinga splitting rule. Four maximum-error points, related to the interior and to the three edgesof t, are computed, and, among them, the ones corresponding to an error greater thanεi+1

are inserted, by applying a predefined decomposition pattern. This process is repeated untilthe refinement of the original triangle satisfies accuracyεi+1.

In hierarchical Delaunay triangulations[11], every component is a Delaunay-based TIN.The local Delaunay triangulation expanding a trianglet is generated by incrementallyinserting the point of maximum error. To ensure consistency, first edge refinement isperformed, and, only when an accuracyεi+1 has been reached for every edge, points insidethe triangle are examined.

2.3. A Data Structure for Hierarchical TINs

For representing a hierarchical TINH ≡ (N ,A), we adopt the data structure proposed in[11], which is briefly described in this Subsection.

Each TIN in the hierarchy is separately represented through an individual data structure.A classical data structure for plane subdivisions or triangulations is used for such purpose[21]. In this way, adjacency relations between triangles belonging to the same TIN areexplicitly represented. The parent-child links of the tree definingH are encoded by storing,in each macro-triangletj , a reference to the TINDj , corresponding to the direct expansionof tj .

VISIBILTY COMPUTATIONS 225

ε1

ε2

ε0

Figure 2. Some of the “rope” links for the HTIN of Figure 1; parent-child links are not shown.

In addition, information about how adjacent triangles belonging to different TINs connectto each other are stored. We call an edgee of a TIN aboundary edgeif e lies on the boundaryof the domain; a triangletj is called aboundary triangleif some edge oftj is a boundaryedge. For each boundary triangletj of a TIN Di, the data structure stores a link to thetriangle having minimum birth error among the ones adjacent totj along the boundary edgee of tj (see Figure 2). This connection is called a “rope” since it allows to move up in thehierarchy. Note that rope links do not involve additional storage cost: the structure exploitsthe fact that a boundary triangletj of a TINDi has a “free” adjacency link along the edgee lying on the boundary ofDi, and uses such free link for implementing the rope.

3. Variable-Resolution Access to a Hierarchical TIN

A variety of TINs describing a terrain at different resolutions can be obtained from an HTINH. Each of such TINs is formed by a subset triangles ofH, combined in a consistent way.

An application task can extract from an HTIN a representation satisfying a desired levelof detail in each portion of the domain. We are expecially interested in levels of accuracyvariable over the domain: for example, a higher level of resolution may be required insome areas of interest, while lower resolution may be allowed elsewhere. Moreover, a taskmay be interested only in aspecific area, rather than on the whole terrain. For example,in rendering a surface from a viewpoint located on it, only the portions of the terrain lyingwithin the field of view are relevant.

Theresolution levelneeded by an application task is specified by a real-valued function,defining the maximum approximation error tolerated at each point of the domain. Suchfunction is called athreshold function, and denoted byT . A threshold functionT induces

226 DE FLORIANI AND MAGILLO

a boolean conditioncT , that we call anerror condition, which accepts or rejects a triangletj of an HTINH depending on whether its approximation error is smaller or greater thanthe minimum of the threshold function overtj :

cT (t) ≡ Err(t) ≤ minP∈t

T (P ).

Another boolean conditioncF defines thearea of interestof an application task. Suchcondition, that we call afocus condition, accepts or rejects a trianglet on the basis ofits spatial location. The focus condition must be such that, ifcF (t) = true andt ⊆ t′,thencF (t′) = true. In particular, this property implies that, if a triangletj in an HTINHsatisfiescF , then there exists a path inH which starts from the root and reaches the nodeDi containingtj by traversing only direct expansions of triangles which satisfycF .

Any operation, performed on an HTINH within a given application task, is invokedunder a certain threshold functionT , and a certain focus conditioncF . The operation isvirtually performed on a “local” TIN, composed of those triangles fromH which satisfyboth conditions, and not containing unnecessary refinements at levels of detail finer thanneeded for achieving the error conditioncT .

We mention two special cases of focus conditionscF , corresponding to important opera-tions on an HTIN:

• Extraction of a TIN at variable resolution over the whole domain. This is achieved bya focus conditioncF identically true on any triangle.

• Intersection queries at variable resolution. Intersection queries on a TIN consider theproblem of retrieving the portions of a terrain interfering with a given query entity (e.g.,a point, a segment, a region). A query is answered by reporting all trianglesti, suchthat ti is intersected by the query object. The focus conditioncF for an intersectionquery related to a given objectq accepts a trianglet only if it is intersected byq:cF (t) ≡ t ∩ q 6= ∅.

3.1. Expansions of an HTIN at Variable Resolution

LetH ≡ (N ,A) be a consistent HTIN, built on a sequenceε0, . . . , εh of error tolerances.The collection of all the simple triangles ofH defines a TIN representing thewholeterrainat themaximunresolutionεh. Such TIN is called theexpansionof H, and denoted byexp(H). A TIN at any intermediate resolution is obtained by “cutting” each branch ofH atsome intermediate node, and by collecting the simple faces of the resultingsub-hierarchyof H. Triangles which lie outside a focus area can possibly be removed from such a TIN.The reminder of this subsection is devoted to the formalization of such concept.

A sub-hierarchyof an HTINH is a subgraph ofH consisting of a tree, rooted at thesame root nodeD0 of H, and whose leaves are either leaves ofH or internal nodes ofH. Intuitively, the collection of the simple triangles of a sub-hierarchy provides a repre-sentation of the terrain at an intermediate, possibly variable, resolution. However, not allsub-hierarchies define consistent TINs.

Even ifH is consistent, a generic sub-hierarchy ofHmay not be consistent. The expansionof a sub-hierarchy that is not consistent is not a well-defined TIN, because the boundary

VISIBILTY COMPUTATIONS 227

(a)

A

BC

A

B

C

A

B

C_

_

_

(b) (c)

Figure 3. An inconsistent sub-hierarchy (a) and its expansion (b); note that the expansion is not a proper TINbecause a vertical gap occurs at edgeAB, shown dashed in (c).

edges of some triangles of the underlying domain triangulation may not match, thus leadingto vertical gaps between the corresponding patches in the three-dimensional surface (seeFigure 3). On the contrary, the expansion of a consistent sub-hierarchy is a TIN.

Given a threshold functionT and an HTINH, a TIN which satisfiesT is obtained fromthe expansion of a suitable consistent sub-hierarchy ofH. Such sub-hierarchy, that wedenote byH[[cT ]], is theminimalsub-hierarchy ofH, such that:

• H[[cT ]] is consistent,

• and the expansion ofH[[cT ]] satisfies the error conditioncT .

228 DE FLORIANI AND MAGILLO

D1 D2D3

Figure 4. Sub-hierarchyH[[cT ]] and its expansion; the error conditioncT is false on shaded triangles. Noticethat the expansion of the (inconsistent) sub-hierarchy equal toH[[cT ]] \ D1,D2,D3 (that is the one depictedin Figure 3 (b)) satisfiescT , but is not a TIN.

By a minimal sub-hierarchy we mean that, if a node is removed fromH[[cT ]], then theresulting sub-hierarchy is either not consistent or its expansion does not satisfycT . Anexample of a sub-hierarchyH[[cT ]] is shown in Figure 4.

Now, we consider the case in which both a threshold functionT and a focus conditioncF are given for an HTINH. The problem is finding alocal TIN, made of triangles thatsatisfy bothcT and cF ; in addition, such local TIN must avoid redundant refinements.Notice that the subset of triangles ofexp(H[[cT ]]), which satisfycF , is not a solution tothis problem: some triangle ofexp(H[[cT ]]) may be the result of a refinement enforced toachieve the desired resolution in a triangle lying outside the focus area, or to achieve surfacecontinuity along some edge that lies outside the focus area. Rather, the solution is providedby collecting the triangles satisfyingcF from the expansion of theminimalsub-hierarchyH[[cT , cF ]] ofH, such that:

• every triangle ofexp(H[[cT , cF ]]), which satisfiescF , satisfiescT as well, and

• therestrictionof exp(H[[cT , cF ]]) to triangles which satisfycF is a TIN.

In other words, we do not care of triangles that are not accurate enough, if these triangleslie outside the focus area, and we do not care of inconsistencies at edges lying outside thefocus area. As an example, compare Figures 4 and 5.

A constructivecharacterization ofH[[cT , cF ]] is provided by the following inductivedefinition of its nodes:

• the rootD0 ofH belongs toH[[cT , cF ]];

• if Di belong toH[[cT , cF ]], then, for everytj ∈ Di, with cF (tj) = true andcT (tj) =false:

VISIBILTY COMPUTATIONS 229

D1 D2D3

Figure 5.Sub-hierarchyH[[cT , cF ]], and its expansion, for the same error condition as Figure 4, and a focus condi-tion cF true for triangles intersecting the segment drawn. Notice thatH[[cT , cF ]] ⊂ H[[cT ]], exp(H[[cT , cF ]])is less refined thanexp(H[[cT ]]) and it is not a TIN on the whole domain.

1. the nodeDj , which is the direct expansion oftj , belongs toH[[cT , cF ]];2. if Dj adds vertices on a boundary edgee of tj , then, iftk is the direct abstraction

of other nodeDk of H refininge, if cF (tk) = true, thenH[[cT , cF ]] contains allnodes ofH on the shortest path from the rootD0 toDk.

Condition 1 ensures that the expansion satifies the error conditioncT within the focus area,while condition 2 ensures its consistency, restricted to the triangles in the focus area.

3.2. An Algorithm for Extracting a Local TIN at Variable Resolution

In this Subection, we present an algorithm, which extracts the expansionexp(H[[cT , cF ]]),restricted to the focus area, from a consistent HTINH, given any error conditioncT andany focus conditioncF . We recall that the extraction ofexp(H[[cT ]]) is a special case ofthis problem.

The algorithm descends the treeH and incrementally traverses the nodes ofH[[cT , cF ]],starting at the root. While visiting such nodes, it also updates the local expansion of thecurrently visited sub-hierarchy. The structure of the algorithm directly implements theinductive characterization ofH[[cT , cF ]] given in Section 3.1. It uses a stack to collect thetriangles which must be expanded and performs a loop until the stack is empty. Duringthe process, triangles which are candidates to belong to the solution are inserted into alist. Triangles which must be expanded (and which, thus, do not belong to the solution)are marked. At the end of the process, the unmarked triangles contained in the list are thetriangles of the output local TIN.

In more details, the algorithm performs the following steps:

1. For every triangletj of the TIND0 at the root ofH, such thatcF (tj) = true:

230 DE FLORIANI AND MAGILLO

a. if cT (tj) = true, then inserttj into the list of candidates;

b. otherwise, marktj as not belonging to the solution and pushtj onto the stack.

2. While the stack is not empty, extract the top triangleti from the stack (note thatti is atriangle marked as not belonging to the solution):

a. insert every unmarked triangle of the direct expansionDi of ti, which satisfiescF ,into the list of candidate triangles;

b. mark every unmarked triangle ofDi, which satisfiescF and notcT , and push itonto the stack;

c. for every unmarked triangletj , adjacent toti along an edgee, that is refined inDi,if cF (tj) = true then marktj and pushtj onto the stack.

3. Build the output TIN by collecting the unmarked triangles contained in the list ofcandidates.

At step 2.c, the triangles ofH adjacent to a triangleti along a given edgee are found byusing the “rope” links of the data structure. We now describe this operation in mode details.We must distinguish between two cases:

• if e is an internal edge of the TINDk containingti, then we consider the other triangletj adjacent toe in Dk;

• otherwise (i.e., ife is an edge of the boundary ofDk), we use the “rope” link to accessthe triangletj , which is the coarsest triangle adjacent toti alonge.

In both cases, starting fromtj , we recursively consider the triangle having edgee on itsboundary in the direct expansion oftj , until edgee is refined. The two cases are illustratedin Figure 6.

Adiacency finding takes a time linear in the number of adjacent triangles ofti, which isbounded from above by the numberh of levels of the HTIN.

Now, we evaluate the complexity of the algorithm. Step 1 examines all the triangles ofthe root TIND0. In steps 1 and 2, every macro-triangle of the sub-hierarchyH[[cT , cF ]] isstacked at most once, and every triangle ofH[[cT , cF ]], which satisfiescF , is added to thelist of candidates at most once. Retrieval of adjacent triangles at step 2.b costsO(h) = O(1)for every triangle popped from the stack. Thus, the total time complexity of the algorithmis linear in the size ofH[[cT , cF ]], which, in turn, is linear in the size of its expansion.

4. Visibility Computations on an HTM

In this Section, we introduce basic definitions, concepts and properties related to visibility onterrains. In particular, we define the two problems, namelyvisibility queriesandviewshedcomputation, which are addressed for HTINs in Sections 5, 6 and 7.

Let us consider a TIND ≡ (Σ,Φ), and the piecewise-linear surfaceGD described byD.Two pointsP1 andP2 are mutuallyvisibileonGD if and only if, for every pointQ ≡ (x, y, z)belonging to the open segmentP1P2, either(x, y) 6∈ D, or z > φD(x, y). In other words,

VISIBILTY COMPUTATIONS 231

(a)

t ti j

t’

(b)

ropet

ti

j

t’

Figure 6. Finding the triangles to be pushed onto the stack when a triangleti is expanded. In (a),ti is internal tothe triangulation containing it; in (b),ti is on the boundary. In both cases,tj andt′ are pushed onto the stack tobe expanded.

P1 andP2 are visible when the straight-line segment joining them lies above the terrain(and it touches it at most at its two endpoints). Note that a necessary condition for mutualvisibility of two points is that both points lie on, or above, the surface.

In visibility problems on a terrain, aviewpointV is given. Aninternal viewpoint, i.e., aviewpointV ≡ (x, y, z) with (x, y) ∈ D, only makes sense forz ≥ φD(x, y), and modelsan observer standing on the surface. This framework is typical of terrain analysis based onvisibility. A viewpoint whose vertical projection lies outside the terrain domain (possiblylying at infinity in some direction) is called anexternal viewpointand is commonly used inhidden surface removal problems on a terrain, in connection with terrain visualization.

We consider two major kinds of visibility problems on a terrain:

• visibility queries, in which some query object is given (a point, a line, a region) and theaim is determining the portions of such object visible from a given viewpoint;

• viewshed computations, which consist of the determination of portions of the terrainsurface visible from a given viewpoint.

A visibility queryrelated to a pointQ simply requires to determine whetherQ is visiblefrom V or not. For a non-point query objectq, a visibility query requires to compute apartition ofq into maximal connected portions, each of which is either entirely visible orentirely invisible fromV . Visibility query problems reduce to solving intersection queriesin order to find out which parts of the terrain can cast shadows on the given object (seeSection 5).

Computing theviewshedof a given viewpointV on a terrain consists of determiningwhich portions of the terrain are visible fromV . Viewshed computation can be seen as aspecial case of the problem of computing the visible surfaces in a three-dimensional scene.In this framework, an external viewpoint is considered and aviewplaneis defined as a plane

232 DE FLORIANI AND MAGILLO

lying beyond the scene, with respect toV ; if V lies at infinity in some direction, then theviewplane is normal to the direction ofV . Thevisible imageof a scene (possibly a terrain)is a partition of the viewplane into maximal connected regions, such that in each region oneface of the scene is visible, or no face is visible. Each region of the visibile image is labeledwith the face of the scene which is visible inside it, or with a special value if no face projectsonto it. To define the visible image of a terrain with respect to an internal viewpoint, theviewplane can be defined as a spherical surface centered atV and large enough to containthe whole terrain.

On a terrain, the viewshed can be encoded through a partition of the domain of thesurface instead of a partition of the viewplane. This is possible by exploiting the one-to-onecorrespondence between points on the domain and points on the terrain. On a TIN, theviewshed of a viewpointV can be encoded as a map, called avisibility map. Such mappartitions the domainD into maximal connected regions, such that region is either formedby visible points of a trianglet, or by points (belonging to any triangle) not visible fromV . Each region is labeled with the corresponding triangle, or with a special value meaninginvisibility, depending on the case.

The visibility map and the visible image of a terrain represent two different ways ofencoding the same information. Figure 7 shows the visible image and map of a TIN. Theworst-case space complexity of both structures is equal toO(n2) for a TIN withn vertices[4], and they can be converted into each other in linear time.

In the reminder of this Section, for any entitya in the 3D space, we always denote byathe projection ofa on thexy-plane. Before examining the algorithms, we briefly introducesome auxiliary definitions and properties related to visibility.

Intuitively, the horizonof a viewpointV on terrainG provides, in each direction, thefarthest point on the surface which is visible fromV . More formally, the horizon is thelocus of pointsP ≡ (x, y, φ(x, y)) of the surface such that:

• P is visible fromV , and

• for any pointQ ≡ (x′, y′, φ(x′, y′)), such that theQ belongs to the interior of segmentP V ,Q is not visible fromV .

On a TIN, the horizon is a chain of portions of terrain edges, radially sorted around theviewpoint.

The visible image of a TIN with respect to a viewpointV covers a simple polygon onthe image plane, bounded from above by a monotone chain of segments. This chain, calledtheprofileof the TIN, is precisely the projected horizon ofV (see Figure 7). Theprofileofa TIN is the same as theupper envelopeof the set of segments obtained by projecting theTIN edges onto the viewplane [4]. Exploiting such a characterization, a worst-case size ofΘ(nα(n)) can be proven for the profile (and thus for the horizon) of a TIN withn vertices.

The possibility ofordering the elements of a scene according to their distance from anarbitrary viewpoint is expecially relevant for viewshed computation. On sortable TINs,i.e, models where a consistent front-to-back order of triangles exist with respect to anyviewpoint, visibility information can be incrementally computed for each triangle by takinginto account only those triangles which come before in the order.

Given a viewpointV , a facefA of a scene is said to bein front of another facefB if aray emanating fromV intersectsfA before intersectingfB . If fA is in front of fB then

VISIBILTY COMPUTATIONS 233

3 2 3 3 4

9

11

6

9

8

6

6

5

11

10

12

57

119

99 10

x

y

0

z

x

Figure 7. The visible image and the visible map of a TIN, and the corresponding horizon and profile. Invisiblefaces are shaded, segments forming the profile/horizon are drawn in thick lines.

fB is behindfA. On a TIN, the in front/behind relation between triangles in 3D reducesto a similarily defined relation among the corresponding triangles of the underlying planetriangulation, with respect to thexy-projectionV of the viewpoint (see Figure 8).

A scene is calledsortableif the in front/behind relation defines a partial order of the faceswhich can be completed to a totalfront-to-back orderthrough topological sorting. In Figure8, feasible front-to-back orders aret1, t2, t3, t4 andt1, t3, t2, t4. Every TIN is sortable withrespect to a viewpoint whose vertical projection lies outside the domain. However, foran internal viewpoint this is not always true, since the before/behind relation may presentcycles. Delaunay-based TINs have been shown to be sortable with respect to any viewpoint[9].

An HTIN H is calledsortable if every node ofH is a sortable TIN. This propertyensures that every expansion obtained fromH is sortable [1]. HTINs based on Delaunaytriangulations are always sortable [11].

234 DE FLORIANI AND MAGILLO

V

t1

t2

t3

t4

V

Figure 8. The before/behind relation between triangles of a TIN and between triangles of its domain triangulation.Trianglet1 is in front of t2, t3 andt4, trianglest2 andt3 are in front oft4. Trianglest2 andt3 are not related.

5. Visibility Queries on an HTIN

As already mentioned, the solution of visibility queries on a terrain reduces to performingintersection queries.

Given a TIND, a query pointQ and a viewpointV , the visibility ofQ from V can bedetermined by finding the edges ofD intersected by the vertical projection of the segmentjoiningQ toV . At every such edgee, we check whether segmentQV lies above or belowe.If QV is above all tested terrain edges, thenQ is visible fromV , otherwise it is not visible(see Figure 9). Visibility tests are performed while processing the intersection query. Thus,as soon as the first edge obscuringQ is found, the process can stop. This approach involvestestingO(n) edges, in the worst case, on a generic TIN withn vertices.

On an HTIN, the triangles intersected byQV are found with the algorithm described inSection 3.2. In this case, the focus condition is defined ascF (t) = true if and only iftis intersected by the projection of segmentQV . The error information contained into themodel can be exploited in order to prune some branches of the tree, and possibly anticipatethe solution of the visibility query. Lettj be a triangle intersecting the query segment,

VISIBILTY COMPUTATIONS 235

V

VP

P

Figure 9. A visibility query related to a pointP and the corresponding segment intersection query.

which must be expanded in the algorithm of Section 3.2. If segmentQV passes undertjfor an height difference greater thanErr(tj), we can immediately conclude thatQ is notvisible, since the refinement oftj surely hidesQ fromV . Conversely, ifQV passes overtjat an height greater thanErr(tj), we can avoid examinating the expansion oftj , becauseno edge from the recursive expansion oft can obscureQ.

Given a TIND and a viewpointV , a visibility query related to a segmentsq ≡ Q1Q2

reduces to the computation of (the portions of) the edges ofD covered by the verticalprojection of the triangular regionQ1Q2V (see Figure 10). Such edges are those whichcan hide the query segmentsq. Determining the visibility of a polygonal regionRq from aviewpointV on a TIN also reduces to a region intersection query. The (portions of) terrainedges that can obscureRq to the viewpoint are those contained into the region defined onthexy-plane by the two tangent lines fromV to Rq, and by the portion of the boundary ofRq lying between the two tangent points and facingV (see Figure 10).

Once we have found the set of (portions of) terrain edges lying inside the region defined bya segment or region visibility query, we compute the profile (upper envelope) of such edgesand determine the visible and invisible parts of the given segmentsq (the given regionRq)by comparingsq (Rq) against such profile. The visibility test takesO(k log k) time, wherek is the number of segments reported by the intersection query. On an HTIN, segment andregion intersection queries are solved by applying the algorithm of Section 3.2, for a focusconditioncF defined ascF (t) = true if and only if trianglet is intersected by the queryentity.

236 DE FLORIANI AND MAGILLO

V

V

s

s

V

V

R

R

(a) (b)

Figure 10. (a) The visibility query related to a segments and the region defining the corresponding interferencequery, and (b), the visibility query defined by a query regionR and the corresponding interference query.

6. Issues in Computing the Viewshed on an HTIN

Visibility information under an error conditioncT on an HTINH can be computed in astraightforward way by extracting first from the hierarchical TIN the expansionexp(H[[cT ]])(using the algorithm of Section 3.2), and then applying one of the existing viewshed al-gorithm for TINs [24], [8], [16], [22], [20], [2], [5]. A more interesting approach is todefine viewshed algorithms that operate directly on an hierarchical TIN. Such an approachavoids reconstructing the expansion, and can possibly exploit the hierarchical structure ofthe model in order to speed up computations.

In [17] we have devised paradigms of viewshed algorithms which can be adapted to hi-erarchical TINs. There, we did not consider the issue of maintaining a consistent surfacerepresentation: vertical gaps were tolerated between patches taken from different resolutionlevels of the HTIN. Here, we impose the additional constraint that the model used for com-puting visibility must represent acontinuoussurface. We propose a hierarchical extensionof the front-to-back paradigm for viewshed computation, which meets such requirement.

The problem of determining the visible image of a polyhedral scene has been extensivelystudied in computational geometry. Apolyhedral sceneis a scene composed of objectswith planar faces. TINs are special cases of polyhedral scenes. Besides general algorithmsfor polyhedral scenes, specialized algorithms have been developed for computing eithervisible images or visibility maps on terrains. Other specialized algorithms compute the

VISIBILTY COMPUTATIONS 237

visible image of a set of triangles in space, and thus apply to TINs. Viewshed algorithmsproposed in the literature can be classified into:

• Static algorithms. For these algorithms a complete description of the surface must beavailable before the computation starts [18], [14], [16].

• Incremental algorithms. In these algorithms, the viewshed is computed incrementallywhile traversing the terrain.On-line algorithmsprocess TIN triangles one by one, inany order [2], [5]; insweep-linealgorithms, a terrain is explored left-to-right [28], [19];in the front-to-back approach, triangles are processed in an order consistent with thefront/behind relation defined by the given the viewpoint [24], [8], [20]. Incrementalalgorithms, at each step, need to know only the portion of surface currently underprocess.

Static algorithms cannot be applied to an HTIN unless an expansion is pre-computed, andthus are not interesting for our purposes.

In order to make algorithms based on incremental paradigms work directly on HTINs,some mechanism must be defined to extract the triangles ofexp(H[[cT ]]) in the same orderin which they must be processed by the viewshed algorithm.

The main problem in extracting the triangles of the expansionexp([[cT ]]) according toa predefined order is the following: the need of guaranteeing a continuous surface makesit impossible to decidelocally whether a given trianglet belongs to the expansion or not.The decision of excluding a trianglet, with cT (t) = true, from the expansion (and, thus,of refining t) may be caused by triangles located anywhere in the domain. This, meansthat, while traversing an HTIN within an incremental algorithm, we may discover that thetriangle currently under examination causes the refinement of a triangle examined before.For its incremental nature, the algorithm cannot backtrack, and thus it must accept aninconsistency (i.e., a vertical gap in the surface).

Here, we show that, in a special and interesting situation, this undesiderable fact neverhappens. We consider the front-to-back approach to viewshed computation and a thresholdfunctionT , such that the error tolerance imposed byT at a generic pointP increases withthe distance ofP from the viewpointV . T is of the form:

T (P ) = g(d(P, V ))

whereddenotes the Euclidean distance andg is a non-decreasing function. For convenience,threshold functions of this form will be calleddistance-dependentthreshold functions.Distance-dependent threshold functions are expecially important in viewshed computations,as we mentioned in Section 1.

7. A Front-to-Back Approach to Viewshed Computation on an HTIN

Front-to-back viewshed algorithms consist of two conceptually distinct phases:

• a sorting phase, which computes a front-to-back order of the triangles with respect tothe given viewpoint, and

238 DE FLORIANI AND MAGILLO

• avisibility determination phase, in which such triangles are processed in front-to-backorder, and the visible portions of each of them are computed.

In practice, the two phases can be implemented together in a cycle where, at each step, thenext triangle in the front-to-back order is found and processed immediately. The interleav-ing of the two phases avoids the need of building a complete sorted list of the triangles.Algorithms allowing an interleaved execution of the two phases [8], [24], [20] are suitable tobe extended to HTINs, while algorithms where the sorting phase is used a as preprocessing(e.g., [16]) arestatic(see Section 4), and thus not extendible.

The application of a front-to-back algorithm in a hierarchical context involves a modi-fication of the sorting phase, which must output a sorted sequence of the triangles of theexpansion under the given error condition. The visibility determination phase itself can beoptimized by taking account the approximation errors stored in the model.

7.1. Front-to-Back Sorting on an HTIN

Since front-to-back viewshed algorithms have a modular structure, a sorting module and avisibility module, coming from different algorithms, can be combined together into into a“new” distance-based algorithm. Thus, it is sufficient to define one sorting procedure forHTINs, which can then be combined with the visibility computation module of any existingfront-to-back algorithm.

In this Subsection, we first provide a detailed description of the triangle sorting proce-dure used in [8], and then describe its hierarchical extension. The HTIN sorting methoddescribed here improves the algorithm previously proposed in [17], because it guaranteesthe continuity of the extracted surface.

In [8], a front-to-back order of the triangles of a sortable TIND (for example, a Delaunay-based TIN) is found by incrementally visiting the triangles ofD, while maintaining theproperty that no visited triangle isbehinda non-visited triangle. This reduces to growing astar-shaped polygon around the viewpointV , starting from the triangle containingV andadding one adjacent triangle at a time, until all triangles have been visited.

Given a TIND ≡ (Σ,Φ) and a viewpointV , the algorithm sorts the triangles of triangula-tion Σ with respect to the vertical projectionV of V . A front-to-back order of the trianglesof Σ from V determines a front-to-back order of the triangles ofD fromV . Therefore, in thefollowing description we will not distinguish between a triangle ofΣ and its correspondingtriangle ofD.

We call a chainC of edges ofΣ star-shapedwith respect to aV if every ray emanating fromV intersectsC at most in one point (the name is due to the fact that, if the vertical projectionof V lies inside the terrain domain, then a star-shaped chain is indeed a star-shaped polygon,with the projection ofV lying in its kernel). The sorted sequence of triangles ofΣ is foundby incrementally visiting triangles in such a way that, at a generic step, the chain of edgeswhich separates already visited and not yet visited triangles is star-shaped with respect toV . The sortability ofΣ ensures that at each step we can always add a new triangle whilemaintaining the star shape ofC. The method is described in details below.

• At the beginning, we visit the triangle(s), having minimum distance fromV , and ini-tialize the star-shaped chainC with the edge(s) it (they) share with not visited triangles.

VISIBILTY COMPUTATIONS 239

Y

N

Y

Y V

Y

Y

N

N

Figure 11. An intermediate step of the algorithm for sorting the triangles of a sortable TIN. Already visitedtriangles, forming the current star-shaped polygon, are shaded. Triangles externally adjacent to the star-shapedpolygon, which are candidate for inclusion, are labelled with the result (OK or NO) of the inclusion test.

• At each step, an edgee of the boundary of the current chain is selected, and the trianglet externally adjacent toe is tested:

– if t can be visited without loosing the star shape ofC, thent is visited, andC isupdated accordingly;

– otherwise, edgee is simply deleted fromC; in this way, trianglet can be examinedagain only when another of its edges appears onC, i.e., whent can be included.

Figure 11 shows an example of a star-shaped polygon, and of triangles that can or cannot beadded to it. Every triangle is examined at most twice, and the time complexity of the sortingprocedure isO(n). The chainC is implemented as a list of edges, where each edgee storesthe triangle externally adjacent toe. By using any data structure for plane subdivisions ortriangulations, adjacency relations between triangles and edges can be retrieved inO(1)time.

The HTIN sorting algorithm is obtained by combining the TIN sorting procedure of [8]and a traversal of the tree describing an HTINH. Such algorithm extracts, at each step, thenext triangle ofexp(H[[cT ]]) in a front-to-back order fromV . As we said before, the maindifficulty is in guaranteeing that, at each step, the local TIN defined by already processedtriangles (i.e., triangles lying inside the current star-shaped polygon), can be consistentlycompleted over the whole domain. We can ensure this property based on an an approachsimilar to the one used in [3], [11] for extracting an expansion under a distance-dependenterror condition.

Let us consider any two trianglesti andtj of a sortable HTIN, such thatti is beforetjwith respect to a viewpointV , and letT be a distance-dependent threshold function withrespect toV . Sinceti is beforetj , d(ti, V ) ≤ d(tj , V ), and thus, for equal approximation

240 DE FLORIANI AND MAGILLO

errorscT (ti) = true impliescT (tj) = true. Within a front-to-back traversal of an HTIN,we have that the refinement of a trianglet, with cT (t) = true, can only be enforced bytriangles precedingt in the order, and, thus, already processed.

We will use the definitions of birth error, death error and life of a triangle in an HTIN, whichhave been introduced in Section 2.1. We recall that, for a trianglet,Err(t) ≤ death(t) ≤birth(t). In a consistent HTIN, ifεk ∈ life(t) ande is an edge oft not lying on the domainboundary, thent has at least one adjacent trianglet′ alonge with εk ∈ life(t′). We calltherestricted lifeof a trianglet the intervalεk|εk ≤ minP∈t T (P ) ∩ life(t). It is easyto see that, ift has a non-empty restricted life, thencT (t) = true.

We say that a local TIN, formed by triangles of a consistent HTINH and containingV inits interior, issafeif the restricted lives of the boundary triangles of such TIN intersect in anon-empty subset ofε0, . . . , εh. For a safe local TIND, the following property holds:

For any boundary edgee of D (except, of course, those lying on the boundary of thedomain), there exists a trianglet′, externally adjacent toe, such that, ift′ is added toD, then resulting local TIN is still safe.

This property ensures that a safe local TIND can be completed consistently over the wholedomain, while satisfying the given threshold function.

Let εk be a value in the intersection of the restricted lives of all boundary edges ofD.In order to prove the above property, we claim that we can simply take the trianglet′,externally adjacent toe, which belongs to levelεk ofH. Let t be the triangle ofD adjacentto e. For the safety ofD we know thatεk ∈ life(t) andεk ≤ minP∈t T (P ). We alsoknow thatεk ∈ life(t′). Moreover, sincet′ is equally or more distant fromV thant, andTis a distance-dependent threshold function, we have thatminP∈t T (P ) ≤ minP∈t′ T (P ).Therefore,εk ≤ minP∈t′ T (P ) and the local TIND′ ≡ D ∪ t′ is safe. This concludesthe proof.

The hierarchical extension of the TIN sorting method performs an incremental traversalof triangles aroundV by maintaining the invariant property that, at each step, the local TIND, formed by already visited triangles, is both safe and star-shaped. In order to coarsenDas soon as allowed byT while moving away fromV , a good method is trying to enlarge itfrom the boundary triangle having minimum birth error [3], [11].

The edges of the star-shaped chainC are stored in a priority queue (instead of a list),according to the birth error of their internal adjacent triangle. The intersection of therestricted lives of boundary triangles is also maintained. The steps of the method areillustrated below.

1. First, a point location query is performed to find the trianglet0 closest to (and, possibly,containing) thexy-projection of the viewpointV , and such thatcT (t0) = true. Suchquery is answered by the algorithm of Section 3.2. Note thatt0 is the triangle on whichthemaximum resolutionis required. The current star-shaped chain is initialized withthe edges oft0.

2. At each step, the edgee, having minimum birth error, is extracted from the queue. Lett be the triangle of minimum birth error among those externally adjacent toe, and suchthat visitingt maintains the safety of the current local TIN:

VISIBILTY COMPUTATIONS 241

– if t can be added to the current local TIN while preserving the star-shape of itsboundary, thent is visited;

– otherwise, edgee is simply deleted from the queue.

Note that the extracted TIN, built in this way, necessarily satisfiescT . In fact, we have that,for every trianglet,Err(t) ≤ εk for all εk ∈ life(t), and (from the algorithm) at least onevalueεk in life(t) is such thatεk ≤ minP∈t T (P ). It follows thatErr(t) ≤ minP∈t T (P ),i.e.,cT (t) = true.

With respect to the original TIN sorting algoritm, the time complexity of access and updateoperations on the star-shaped chain is increased by a logarithmic factor, due to the priorityqueue. Trianglet in step 2 is found by applying the same method for adjacency retrievaldescribed in Section 3.2, with a cost equal toO(h) = O(1). Thus, the total complexityof the HTIN sorting algorithm isO(n log n), wheren is the size ofexp(H[[cT ]]). Thelogarithmic factor in the time complexity is not relevant within a front-to-back viewshedalgorithm, because all such algorithms have a time complexity greater thanΩ(n log n).

7.2. Front-to-Back Visibility Computation on an HTIN

The procedure for sorting hierarchical TINs, described in Section 7.1, can be applied withinany front-to-back viewshed algorithm [8], [24], [20], in a straightforward way. The execu-tion of the HTIN sorting module is simply interleaved with the execution of the visibilitymodule of the specific viewshed algorithm, in the same way as the non-hierarchical sortingmodule was originally interleaved with the visibility module.

Now, we examine how the error information stored in an HTIN can be used to optimizethe visibility computation phase. First, we briefly describe the approaches to visibilitycomputation used in the various algorithms.

In [8], [24], the visible portions of each new triangle, provided by the sorting phase, aredetermined by comparing it with the current horizon or profile (i.e., the horizon/profilecomputed for the subset of TIN triangles already visited). In [8] the current horizon ismaintained as a circular list of portions of terrain edges. The visible portions of a trianglet are determined by projecting the relevant part of the horizon ont (see Figure 13). Then,the horizon is updated by considering the distal edges oft, i.e., the edges which lie on theboundary of the new star-shaped polygon, aftert has been included. The time complexityof the visibility phase is equal toO(n2α(n)) since, in the worst case, every triangle mustbe tested against every edge of the current horizon.

The method used for visibility determination in [24] is similar. The basic feature ofReif and Sen’s algorithm is in the data structure used for storing the current profile. Thisstructure, developed for representing monotone polygons, allows computing intersectionsand updating the current profile inO((m+k) logm) time, wherem is the size of the profileandk the number of intersections. Because every vertex, which has been on the profile atsome stage, is a vertex of the final visible image as well, the amortized time complexity ofthe algorithm is output-sensitive, and equal toO((n+ d) log2 n), wheren is the number ofterrain vertices andd is the size of the computed visible image.

A different technique is used for visibility computation in [20]. Such algorithm computesthe visible image of a set of triangles, with an output-sensitive complexity, by adding

242 DE FLORIANI AND MAGILLO

1

1

1

1

1

1

0

0

0

3

3

3

2

2

3

4

4

25

V

Figure 12.The current horizon at the stage corresponding to Figure 11: vertices are labelled with their elevations,horizon segments are drawn as thick lines, the current star-shaped polygon is shaded.

V

t

horizon

projected horizon

Figure 13. Visibility computation for a trianglet: the current horizon is projected on the plane oft, the portionof t lying above the projected horizon (shown shaded) is visible, the horizon is updated by considering the visibleportions of the distal edges oft (shown in thick lines, dashed).

VISIBILTY COMPUTATIONS 243

triangles from front to back in groups. At a generic steph, the contour of the visible imageof already processed triangles has complexity equal toch. Then,

√ch new triangles are

selected, according to the front-to-back order, for being processed in steph+1. The visibleimage of such new triangles has size at mostO(ch), and can be computed in optimal time[14], [18]. The updated visible image after steph + 1 is obtained by adding to the oldimage those portions of the new one which lie outside the contour. In the case of a TIN, thecurrent contour is the same as the profile. Thus, this step reduces to finding the intersectionsbetween a plane subdivision a monotone chain of segments, which can be done in lineartime in the sizech of the input plus the numberkh of intersections. Note that

∑h

√ch = n,

and∑h kh ≤ d; moreover, for a TIN,maxhch = O(nα(n)). Thus, the time complexity

isO(n√nα(n) + d) for a TIN with n vertices.

On a hierarchical TIN, we can exploit the approximation errors associated with eachtriangle to infere visibility properties of triangles contained into the expansion of a macro-trianglet before (and, hopefully,without) expandingt. Given a macro-triangletj , we knowthat any triangle in the direct expansion oftj can be at mostErr(tj) units higher thantj .Therefore, ittj , raised byErr(tj), is lower than the horizon, then the expansion oftj willbe totally invisible. Based on the above observation, we can “cut off” branches of the tree,which do not need to be explored.

In step 2 of the HTIN sorting algorithm of Section 7.1, trianglet is found by startingfrom the triangle pointed by the rope link of the selected edgee ∈ C and descending downin the hierarchy. In order to optimize a front-to-back viewshed algorithm, we modify thesearch fort. During such search, we stop at every trianglet′, adjacent toe, and performthe following operation:

• if t′ maintains both the star-shape and the safety of the current local TIN, andt′ isbelow the current horizon for more thanErr(t′), then we includet into the star-shapedpolygon without testing visibility on it, and terminate the search;

• if we reach triangletwithout having applied the previous case, we test whethert can bevisited, as explained in Section 7.1; ift can be visited, then we “pass”t to the visibilitydetermination phase.

Figure 14 illustrates and compares the optimized and the non-optimized version of thealgorithm.

In the approach of [8] and [24], “passing a triangle to the visibility phase” means com-puting its visible portions by comparing it against the current horizon. In the algorithm of[20], “passing a triangle to the visibility phase” means considering such triangle in the newgroup of triangles whose visible image must be computed and added to the old image.

The test oft′ against the horizon can be too time consuming if performed exactly. There-fore, we adopt an heuristic. We subdivide the horizon into a constant number of radialsectors and, in each sector, keep track of the minimum elevation of the horizon within thatsector. Trianglet′ is compared only against the stored minimum horizon heights relatedto the sectors relevant fort′; in any case, a constant number of operations is performed.This optimization leaves the asymptotical complexity of a front-to-back viewshed algorithmunchanged, but can practically speed up the computation.

244 DE FLORIANI AND MAGILLO

t

t’

Ve

t1t2

rope

(a)

e tV

t’V

e

(b) (c)

Figure 14. Optimization of a front-to-back viewshed algorithm. (a) shows the current star-shaped polygon andthe edgee, selected to enlarge the polygon. In the non-optimized version, the triangles externally adjacent toe aretested while descending into the hierarchy and finally trianglet is visited and added to the polygon (b); trianglest1 andt2 will be examined in a subsequent step. In the optimized version, trianglet′, encountered during thetraversal, is found lying below the current horizon for more thanErr(t′): t′ is set as not visible and added to thepolygon; trianglest1 andt2 will not be examined.

8. Experimental Results

Based on hierarchical TINs, we have developed a prototype system for the multiresolutionrepresentation, analysis, and visualization of topographic surfaces, where the techniquesillustrated in this paper have been implemented. Such prototype, calledHierarchical TerrainManipulator and Analyzer(HTMA), runs on a workstation HP750, under the X-windowsystem, and includes an interactive graphic interface, developed by using the MOTIF toolkit

VISIBILTY COMPUTATIONS 245

Table 1. Results related to the computation of the viewshed for two HTINs built from the data set representingMount Marcy. Two sample HTINs are considered: (1) an HTIN built on a sequence of three tolerance values, equalto 200, 40 and 10 meters; (2) an HTIN based on eleven tolerance values from 200 to 10 meters. All values showncorrespond to ratios between the value obtained from viewshed computation at a distance-dependent resolutionand the value obtained at uniform, maximum resolution. The average, minimum and maximum value of the ratioare shown: (a) number of visible polygons; (b) number of triangles considered in the visibility phase; (c) numberof HTIN triangles traversed by the algorithm; (d) area of the viewshed.

(a) (b) (c) (d)visible processed traversed area of the

polygons triangles triangles viewshed

avg/min/max avg/min/max avg/min/max avg/min/max

(1) 0.84/0.44/1.00 0.26/0.22/0.31 0.25/0.22/0.30 1.08/0.85/1.56

(2) 0.65/0.40/1.00 0.19/0.14/0.25 0.20/0.15/0.26 1.00/0.69/1.28

Table 2. Results for the visibility test between two points, both lying at twometers from the ground, at different resolutions; the two points are not visiblefrom each other.

accuracy level 200 74 27

intersected triangles 6 10 15

height comparisons 2 3 11

and the PHIGS graphic standard. The hierarchical terrain models used within the systemare HTINs based on Delaunay triangulations. The system currently integrates the followingmodules:

• A kernelmodule containing the data structure of [11], its access primitives, and theconstruction algorithm, which is based on a refinement technique (also described in[11]).

• A visualizationmodule supporting different rendering modalities: perspective views,wire frame triangulations, and contour plots.

• An analysismodule integrating the following functionalities:

– the extraction of a representation at an arbitrary level of accuracy;

– interference query processing;

– visibility computations of various types. Visibility queries are supported for pointsand segments, while the algorithms for determining the visibility of a region is underimplementation. The computation of the visibility map is performed through ahierarchical extension of the algorithm in [8], according to the technique describedin Section 4; moreover, the system allows computing the horizon at a used-definedlevel of resolution.

246 DE FLORIANI AND MAGILLO

In the following we present some experimental results. The data used in these experimentshave been provided by the United States Geological Survey, and are related to a portionof about 1

10 × 110 of the Earth surface, located between the States of Vermont and New

York. This area presents a variety of features, including areas with rough topology such asthe Adirondack Mountains and Mount Marcy. The data are originally encoded into regulargrids of128 × 128 points, where elevations are represented as integer values (in meters)ranging from 599 to 1591.

We run experiments to compare the results obtained from our viewshed algorithm atvariable resolution with those obtained from viewshed computation at uniform resolution.Table 1 shows the results of some of these experiments. They consider two Delaunay HTINs:the first one is built according to a sequence of three tolerance values, equal to 200, 40 and10 meters, respectively; the second HTIN spans a continuous range of resolutions between200 and 10 meters. For both models, we performed viewshed computation at uniformresolution, equal to the maximum resolution available in the model, and at a variabledistance-dependent resolution. These experiments were run for a large set of viewpoints,and table 1 shows the average and the maximum/minimum values obtained. Column (a)shows the ratio between the number of visible polygons obtained at variable resolution withrespect to the number of polygons at maximum resolution. Column (b) shows the ratiobetween the number of triangles considered in the visibility phase at variable and uniformresolution, respectively. Column (c) shows the ratio between the total number of trianglesof the HTIN visited by the algorithm (i.e., including triangles which have been expanded),at variable and uniform resolution. Finally, column (d) provides a measure of the accuracyof the viewshed computed at variable resolution with respect to that computed at maximumresolution, by showing the ratio between the total area of the viewshed at variable and atuniform resolution.

We note that computing the viewshed at a variable, distance-based resolution reducesthe number of triangles processed by the algorithm to about 20% – 30% with respect toviewshed computation at maximum resolution. The complexity of the computed viewshed(i.e., the number of visible polygons) is also reduced to about 56% – 85% on the average.At the same time, the extension of the viewshed obtained at variable and at uniform highresolution is about the same on the average. Thus, the loss of accuracy is not relevant. Inthe special case of viewpoints located at bottom of valleys, with a relatively small and closevisible area, we obtained the same results with both algorithms, but the variable-resolutionalgorithm took much less time. Figure 15 compares the viewsheds computed at variableand at uniform, maximum resolution, for the same viewpoint. We also noticed that a betterperformance is obtained for HTINs built on several resolution levels, relatively close toeach other. This allows the algorithm to coarsen the resolution gradually while movingaway from the viewpoint.

Table 2 shows the efficiency of the hierarchical structure in the solution of spatial queries.A query related to the mutual visibility between two points is considered. Note that thenumber of visited triangles is a very small fraction of the total, because the structure of themodel allows to prune unrelevant parts of the data in upper levels of the hierarchy.

VISIBILTY COMPUTATIONS 247

(a)

(b)

Figure 15.Two viewshed computed for the same viewpoint at uniform resolution, equal to 10 meters (the maximumresolution available in the model) (b) and at a variable, distance-dependent resolution (a). The computed viewshedconsists of 321 and 249 visible polygons in (b) and (a), respectively. The ratio of the visible area is 1. Trianglestraversed and processed at variable resolution were the 22% of those traversed and processed at uniform resolution.

248 DE FLORIANI AND MAGILLO

9. Concluding Remarks

We have presented practical algorithms for performing visibility computations at variableresolution on a terrain. The proposed methods work on hierarchical TINs, which aremultiresolution models based on the idea of decomposing the domain of a topographicsurface into a collections of nested triangulations.

Other approaches to multiresolution modeling of terrains, different from the hierarchicalone, are currently gaining the attention of the research community (see, for example, [7],[6], [3], [23], [12]. These models try to overcome a certain “rigidity” of hierarchicalmodels: the nested structure of an HTIN enforces the maintainment, through all finer levelsof resolution, of region boundaries defined at coarser levels, thus loosing in adaptivity. Theidea behind such new multiresolution terrain models is encoding a set of local updatesperformed on an initial DTM during an iterative process of refinement or simplification.

The issue of computing visibility information on these models seems to be much moredifficult than on hierarchical models. Visibility computations at variable resolution on non-hierarchical multiresolution terrain models must be performed by preliminarily computinga complete terrain representation at the desired resolution and then applying classical al-gorithms for DTMs. In fact, an incremental approach to viewshed computation cannot beapplied directly to a non-hierarchical multiresolution model, due to the following problem.Suppose that a certain stage we have already computed the viewshed for a subset of theterrain, by using a representation made of a certain subset of faces taken from the multires-olution model. Now, we consider a new trianglet, lying in the portion of terrain not yetexamined. LetcT (t) be false. Then, in order to refinet in the model we perform an updatewhich, unlike in the hierarchical (nested) case, it may involve terrain portions outsidet,possibly already examined.

Acknowledgments

The work was partially supported by the project “Models and Systems for Handling En-vironmental and Land Data” of the Italian National Research Council under contract N.95.01057.CT12, and by the National Project, funded by Ministry of University and ScientificResearch, on ”Development of a Multimedial Workstation with Parallel Architecture”.

References

1. Bertolotto, M., Bruzzone, E., De Floriani, L., “Acyclic Hierarchical cell complexes”, inProc. 5th CanadianConference on Computational Geometry, Waterloo, Ontario, Canada, pp. 279–284, 1993.

2. Boissonnat, J.D., Dobrindt, K., “On-Line construction of the upper envelope of triangles inIR3,” in Proc. 4thCanadian Conference on Computational Geometry, St.John’s, Newfoundland, C.A.Wang (ed.), Memorial,Newfoundland, pp. 311–315, 1992.

3. Cignoni, P., Puppo, E., Scopigno, R., “Representation and visualization of terrain surfaces at variable reso-lution,” in Proc. Scientific Visualization ’95, R.Scateni (ed.), World Scientific, Singapore, pp. 50–68.

4. Cole, R., Sharir, M., “Visibility Problems for Polyhedral Terrains,”Journal of Symbolic Computation, Vol.17, pp. 11–30, 1989.

5. De Berg, M., Ray shooting, Depth Orders and Hidden Surface Removal, Lecture Notes in Computer Science703, Springer Verlag, New York, 1993.

VISIBILTY COMPUTATIONS 249

6. De Berg, M., Dobrindt, K., “On levels of detail in terrains,” inProc. 11th ACM Symposium on ComputationalGeometry, Vancouver, BC (Canada), pp. c26–c27, 1995.

7. De Floriani, L., “A pyramidal data structure for triangle-based surface description,”IEEE Computer Graphicsand Applications, pp. 67–78, 1989.

8. De Floriani, L., Falcidieno, B., Nagy, G., Pienovi, C., “Polyhedral terrain description using visibility criteria,Technical Report 17, Institute for Applied Mathematics, National Research Council, Genova, Italy, 1989.

9. De Floriani, L., Falcidieno, B., Nagy, G., Pienovi, C., “On sorting triangles in–Delaunay tesselation,”Algorithmica 6, Springer Verlag: New York, pp. 522–532, 1991.

10. De Floriani, L., Puppo, E., “A Hierarchical Triangle-based Model for Terrain Description,” in Theories andMethods of Spatio-Temporal Reasoning in Geographic Space, 1992, pp. 236–251, 1992.

11. De Floriani, L., Puppo, E., “Hierarchical Triangulation for Multiresolution Surface Description,ACM Trans-actions on Graphics, Vol. 14 (4), pp. 363–411, 1995.

12. De Floriani, L., Puppo, E., Magillo, P., “A Formal Approach to Multiresolution Modeling,” in Theory andPractice of Geometric Modeling, W. Straßer, R. Klein, R. Rau (eds.), Springer-Verlag: Berlin, 1996.

13. Dyn, N., Levin, D., Rippa, S., “Data dependent triangulations for piecewise linear interpolation,”IMAJournal of Numerical Analysis, vol. 10 (5), pp. 137–154, 1990.

14. Edelsbrunner, H., Guibas, L.J., Sharir, M., “The upper envelope of piecewise linear functions: algorithmsand applications,” Discrete and Computational Geometry 4, Springer International: New York, pp. 311–336,1989.

15. Felleman, J.P., Griffin, C., “The role of error in GIS-based viewshed determination —problem analysis,”Technical Report EIPP-90-2, Institute for Environmental Policy and Planning, State University of New York,New York, 1990.

16. Katz, M.J., Overmars, M.H., Sharir, M., “Efficient hidden surface removal for objects with small union size,”in Proc. 7th ACM Symposium on Computational Geometry, ACM Press: New York, pp. 31–40, 1991.

17. Magillo, P., De Floriani, L., “Computing Visibility Maps on Hierarchical Terrain Models,” inProc. 2nd ACMInternational Workshop on Advances in Geographic Information Systems - ACM-GIS’94, Gaithersburg, MD,pp. 8–15, 1994.

18. McKenna, M., “Worst case optimal hidden surface removal,”ACM Transactions on Graphics, Vol. 6, pp.19–28, 1987.

19. Nurmi, O., “A Fast Line-Sweep Algorithm for Hidden Line Elimination,BIT, Vol. 25, pp. 466–472, 1985.20. Overmars, M., Sharir, M., “A simple output-sensitive algorithm for hidden surface removal,”ACM Trans-

actions on Graphics, Vol. 11, ACM Press, New York, pp. 1–11, 1992.21. Preparata, F.P., Shamos, M.I., Computational Geometry: An Introduction, Springer Verlag: Berlin New York,

1985.22. Preparata, F.P., Vitter, J.S., “A simplified technique for hidden-line elimination in terrains,” Lecture Notes

in Computer Science 577, Springer Verlag: Berlin New York, pp. 135–144, 1992.23. Puppo, E., “Variable resolution terrain surfaces,” in Proc. Canadian Conference on Computational Geometry

’96, pp. 202–210, also available as Technical Report 6-96, Institute for Applied Mathematics, NationalResearch Council, Genova, Italy, 1996.

24. Reif, J.H., Sen, S., “An efficient output-sensitive hidden-surface removal algorithm and its parallelization,”in Proc. 4th ACM Symposium on Computational Geometry, Urbana, 1988, ACM Press, New York, pp.193–200, 1988.

25. Rippa, S., “Minimal roughness property of the Delaunay triangulation,”Computer Aided Geometric Design,Vol. 7 (7), 1990, pp. 489–497, 1990.

26. Samet, H., The design and anaysis of spatial data structures, Addison-Wesley: Reading, MA, 1990.27. Scarlatos, L.L., Pavlidis, T., “Hierarchical triangulation using terrain features,” inProc. IEEE Conference

on Visualization, San Francisco, CA, 1990, pp. 168–175, 1990.28. Schmitt, A., “Time and space bounds for hidden line and hidden surface algorithms,”in Proc. Eurographics

’81, North Holland, Amsterdam, pp. 43–56, 1981.

DE FLORIANI AND hIAGILL0

Leila De Floriani is professor Computer Science at the University of Genova, Italy. She received anadvanced degree in Mathematics from the University of Genova in 1977. From 1997 to 198 1, shewas a research associate at the Institute for Applied Mathematics of the Italian National ResearchCouncil in Genova, and from 198 1 to 1982 an Assistant Professor at the Department of Mathematicsof the University of Genova. From 1982 to 1990, she as been a senior scientist at the Institute ofApplied Mathematics of the Italian National Research Council. She is leading several national andEEC projects on algorithms and data structures for representing and manipulating geometric data.She has written over 90 technical publications on the subjects of computational geometry, geometricmodeling, algorithms and data structures for spatial data handling and graph theory. She is a member

of the Editorial Board of the journals International Journal of Geographic ZGformation Systems andGeolnfirmatica. Her present research interests include geometric modeling, computational geometry,spatial data handling for geographic information systems. She is a member of ACM, IEEE ComputerSociety, and International Association for Pattern Recognition (IAPR).

Paola Magillo received an advanced degree in Computer Science at the University of Genova, Italy,in 1992. In 1993, she attended a stage at the “Institute National de Recherche en Informatique etAutomatique” (INRIA), Sophia Antipolis (France), working with the research group of J.D. Bois-sonnat. Since December 1993, she has been working as a researcher at the Department of Computerand Information Sciences (DISI) of the University of Genova, where she got a permanent position in1996. Since November 1994, she is enrolled in a Ph.D. program at the same Department.Her research interests include computational geometry, geometric modeling, geographic informa-tion systems and computer graphics. She is a member of the International Association for PatternRecognition (IAPR).