Horizon computation on a hierarchical triangulated terrain model

6 downloads 30 Views 1MB Size Report
on a hierarchical triangulated terrain model. Leila De Floriani, Paola Magillo. Department of .... expected time and space complexity when aver- aging on all ...
The

T~

--L isual { ornputer

Horizon computation on a hierarchical triangulated terrain model Leila De Floriani, Paola Magillo Department of Information and Computer Science, University of Genoa, Viale Benedetto XV, 3, 16132 Genoa, Italy

Hierarchical terrain models describe a topographic surface at different levels of detail, thus providing a multiresolution surface representation as well as a data compression mechanism. We consider the horizon computation problem on a hierarchical polyhedral terrain (in particular, on a hierarchical triangulated irregular network), which involves extracting the horizon of a viewpoint at a given resolution and updating it as the resolution increases. We present an overview of horizon computation algorithms on a nonhierarchical polyhedral terrain. We extend such algorithms to the hierarchical case by describing a method which extracts the terrain edges at a given resolution, and proposing a randomized algorithm for dynamically updating a horizon under insertions and deletions of terrain edges Key words: Digital terrain models - Hierarchical models - Visibility - Dynamic algorithms - Randomized algorithms e-mail: {deflo, magiUo} @ disi.unige.it Correspondence to: L. De Floriani

134

1 Introduction A topographic surface can be mathematically modeled by a continuous bivariate function z = qS(x, y), defined over a domain D. Since the surface of a natural terrain is too irregular to be expressed in an analytic form, in practice digital terrain models are used, which are based on a finite set of elevation values measured on the terrain. In such models, the domain of the terrain is partitioned into a collection of faces, and in each face the terrain surface is approximated through an analytic function. Usually, linear or bilinear interpolating functions are used. The tessellation of the domain into rectangular or triangular patches induces a classification of digital terrain models into regular square grids (RSGs) and triangulated irregular networks (TINs). Despite its simplicity, the regularity of the grid structure makes RSGs not adaptive to terrain features. The irregular structure of a TIN, on the other hand, can adapt to topography, thus providing a suitable approximation of a surface by using only a restricted amount of data. While RSGs and TINs are used in commercial packages for terrain representation, organizing terrain representations at different levels of detail into a hierarchical structure is still a research issue. Hierarchical terrain models (HTMs) provide not only a data compression mechanism, but also a variable resolution method for representing a surface according to an accuracy-based criterion. A hierarchical organization simplifies the implementation of searching and other geometric operations, such as finding surface intersections or zooming when visualizing the surface. Moreover, it makes real-time simulation and visualization possible for those applications in which describing less important areas with fewer details is a relevant issue. HTMs are based on a recursive decomposition of the terrain domain into a sequence of increasingly finer tessellations. In early HTMs, such as quadtrees (Samet 1990) and quaternary triangulations (Gomez and Guzman 1979), the domain decomposition follows a predefined regular geometric pattern, with rectangles or equilateral triangles as basic elements. In ternary triangulations (De Floriani et al. 1984), the domain decomposition is driven by a fixed topological pattern with variable geometry. Recently, H T M s in which the domain decomposition is driven by accuracy and not by geometry The VisualComputer(1995) 11:134-149 9 Spriuger-Verlag1995

22v~'lS~

:ompu.ter

have been proposed. Such models provide a multiresolution description of the terrain in a strict sense, i.e., by explicitly encoding a sequence of surface descriptions at increasing resolution. Adaptive hierarchical triangulations (Scarlatos 1990; Scarlatos and Pavlidis 1992) and hierarchical Delaunay triangulations (De Floriani and Puppo 1992) rely on these concepts, combining the advantages of a TIN with those derived from a hierarchical description. Describing a terrain through visibility information has a variety of applications, such as geomorphology, navigation, terrain exploration. Problems which can be solved based on visibility are, for instance, the computation of the minimum number of observation points needed to view a region, the computation of paths with specified visibility characteristics (e.g., hidden paths with respect to a predefined set of observers, scenic paths from which large portions of the terrain can be viewed), the computation of optimal locations for television transmitters (Cazzanti et al. 1991; Cole and Shark 1989). In terrain navigation problems the profile of the horizon is an ideal tool for an observer to locate his/her position on a map. Two points on a terrain are considered to be mutually visible when they can be joined by a straight-line segment lying above the terrain. Visibility problems on a terrain can be classified, according to the type of visibility information they compute, into point visibility problems, which are based on the computation of intervisibilities between pairs of points, line visibility problems, which are related to the computation of lines with specified visibility characteristics (like the horizon), and region visibility problems, which are based on the computation of areas of a terrain visible from a particular viewpoint. Algorithms for visibility computation operate on polyhedral models, i.e., planar-faced digital models; essentially, polyhedral models used in practice have triangular faces (see De Floriani and Magillo 1994a for a survey). On a polyhedral model, the horizon consists of a chain of portions of terrain edges. It has been proven (Cole and Sharir 1989) that, after a suitable coordinate transformation, the problem of computing the horizon of a point on a polyhedral terrain reduces to the problem of computing the upper envelope of segments in the plane.

In this paper, we address the problem of computing the horizon, with respect to a fixed viewpoint, on an HTM, and, in particular, on triangle-based hierarchical models, which we generally call hierarchical TINs (De Floriani and Puppo 1992; De Floriani et al. 1993; Scarlatos 1990; Scarlatos and Pavlidis 1992). The problem of computing visibility information on an HTM has two aspects. First, we need to extract, from the multilevel hierarchical terrain representation, the required visibility information related to a certain level of precision level that depends on the application. Then, we need to dynamically update the already computed visibility information when the required resolution level changes. The horizon at a certain level of resolution on a hierarchical triangulated model can be computed by extracting from the hierarchy an expanded terrain model that represents the surface at the required precision, and applying one of the algorithms for upper envelope computation proposed in the literature (Atallah 1983; Hershberger 1989). If the reconstruction of an expanded terrain model is not required by the application for other purposes (e.g., for visualization), this method is too expensive in terms of space and construction time. An alternative approach, presented in this paper, consists of the direct extraction of the horizon at the required precision value by traversing the hierarchical structure. For the task of dynamically updating an already computed horizon, in order to produce a horizon at a finer level of resolution, we need an algorithm which maintains an upper envelope under deletions and insertions of segments: passing from one level to another of the terrain representation means replacing a subset of terrain edges with new edges. To this end, we describe a randomized dynamic algorithm for maintaining the upper envelope of a set of segments, and we show its application to the solution of the specific problem of maintaining the horizon on an HTM. The algorithm uses a data structure called the influence direct acyclic graph, developed for the design of geometric algorithms (Clarkson and Shor 1989; Boissonnat et al. 1992; Boissonnat and Yvinec, unpublished material, 1994). This technique provides bounds for the expected time and space complexity when averaging on all possible permutations of the input data. The expected cost for a random insertion or deletion is O(~(n)log n).

135

isual . omputer

"Ihe

The reminder of this paper is organized as follows. In Sect. 2, we introduce the definition of mathematical, digital, and hierarchical terrain models, and present a brief overview of HTMs. In Sect. 3, we discuss the relation between the horizon of a viewpoint on a terrain and the upper envelope of a set of segments in the plane, and we present an overview of algorithms for horizon computation. In Sect. 4, we describe the dynamic algorithm for horizon computation, and we summarize some results obtained through a randomized analysis of its time and space complexity. In Sect. 5, we discuss the horizon computation problem on hierarchical triangulated terrain models, at different resolutions, and show the application of the algorithm described in Sect. 4 in this context.

2 Terrain models A natural terrain can be described as a continuous function z--q~(x, y), defined over a subset D of the x - y plane, called the domain of the terrain. Thus, a mathematical terrain model (MTM), which we simply call a terrain, can be defined as a pair ~ - (D, q~). In practice, a finite set 5~ --- {P1, ...,Pn[Pi =- (xi, Yi, zi) and zi = r y~)} of data points is selected, whose elevation values are given by sampling, and a discrete terrain representation is built upon such points. The concept of digital terrain model relies on this idea, thus providing an approximation of a natural terrain. Let Z be a plane subdivision of the domain D, having the set ~ = { (xi, yi) ](xi, Yi, zi) =- Pj ~ 5p } as its set of vertices, and let @ be a family of bivariate continuous functions such that 9 Every function qSie q) is defined on a faceJ~ of Z, 9 For every (x~, yj, zj)e5" with (xj, yj) e ~, 4)i(xj,yj) = zj (wheref~ denotes the closure of face f ) , and 9 For every pair of adjacent faces j~ and J), q~(x, y) = q~j(x, y) for all (x, y)ef~c~fj. The pair ~ - (Z, ~) defines a digital terrain model (DTM). Since a plane subdivision with n vertices is composed of O(n) edges and faces, the spatial complexity of a D T M with n vertices is a linear function of n.

136

Polyhedral terrain models (PTMs) are D T M s characterized by a domain subdivision consisting of a straight-line plane graph and by linear interpolating functions. Visibility algorithms developed in the computational geometry literature, including horizon computation algorithms, operate on polyhedral terrain models (which we simply call polyhedral terrains), since they exploit the planarity of their faces. A special class of PTMs is that formed by triangulated irregular networks (TINs), which are characterized by a triangular subdivision of the domain. Building a T I N reduces to the problem of computing a triangulation of the domain with vertices at the projections of the data points on the x - y plane. Often, a Delaunay triangulation is used as domain subdivision for a T I N because of its good behavior in numerical interpolation. Given a set ~ of points in the plane, a triangulation Z of ~U is a Delaunay triangulation if and only if the circumcircle of each triangle t of Z does not contain any poin t of ~ inside. As shown by Rippa (1990), among all possible triangulations, the Delaunay triangulation is the one that minimizes the roughness of the approximating surface. In many practical cases, a large number of elevation values is available for a topographic surface, often distributed on a regular grid. Since building a D T M based on the whole set of data points would be too expensive in terms of storage space, usually a D T M is built on a smaller subset of the original dataset, which is selected according to a suitable mechanism. We call approximate a model that does not interpolate exactly all points of dataset 5P, but only a subset 5z'. The approximation error at a point of 5 z - 5z' is evaluated as the difference between the interpolated and the measured elevation value: for every Pj -- (xj, yj, zj)~ 5p Izj - ~b~(x~,Yj)I,

-

5 P',

E(Pj)

=

where ~i(xj, y j) is the interpolated elevation value at point Pj. For each subset of the domain D' ___D (e.g., an edge, a face), we define the error on D' as the maximum error of points in 9 ~ - 5 z' whose

Th;ll ~

|

v|SUal t omputer vertical projection belongs to D':

E(D') = max { E( Pj)[Pj - (x~, yj, zj)e 5~ - 5e' and (x~, yj) ~ O'}. The quantity E(Z)( = E(D)) provides a measure of the accuracy of the DTM: the model is said to approximate a terrain at level e of accuracy (or precision) if and only if E(E) < e. Organizing terrain representations at different levels of detail into a hierarchical structure is fundamental to achieving multilevel accuracy. For several applications, it is useful to refine the terrain representation only where necessary and describe less important areas with fewer details. For this purpose, HTMs have been introduced. An HTM is based on a hierarchical subdivision of the domain. Intuitively, given a subdivision Z, a facefof Z can be seen as an individual entity and refined into a subdivision Z f, whose domain covers f The refinement of f is performed by adding new vertices either inside f o r on its sides. Recursive application of this refinement process leads to a hierarchy of subdivisions. More formally, let ~ = {Zo, ... ,Z,,} be a collection of subdivisions. ~ satisfies the hierarchy rule if, for every j > 0, Zj has more than one face, and there exists exactly one i < j such that the domain of Z i is a face of E~. A hierarchical subdivision ~ is a tree in which the subdivisions satisfying the hierarchy rule are linked together. The nodes of H are the subdivisions Eo, ..., E~. Zo is the root. The parent of a node Ej with j > 0 is the unique node 2;i containing the facefwhich is the domain ofZi. Arc(Zi, E j) is labeled with facef An example of a hierarchical subdivision is shown in Fig. 1. Each subdivision in the hierarchy, except for the root, contains more than one face, and is the refinement of a face belonging to some other subdivision in the hierarchy. A facefwhich is refined in the hierarchy (i.e., it is a label of some edge) is called a macroface. Conversely, a face that is not a macroface is called simple. The total number of faces in a hierarchical subdivision has been shown to be linear in the number of simple faces (De Floriani et al. 1993). A hierarchical terrain model (HTM) is built on a hierarchy of subdivisions by associating with each subdivision Ei in the hierarchy a DTM (Z~, 9 ~). The HTM built on a hierarchical subdivision

YF can be represented as a tree isomorphic to the tree representing • . In a hierarchical subdivision, the refinement of a macroface can cause a split of one of its edges into chains of edges through insertion of new vertices. Inconsistent refinement of an internal edge e can have undesirable effects on the terrain model supported by ~(f, because the continuity of adjacent patches cannot be guaranteed. Two subdivisions Zi and Zj are said to be adjacent along a straight-line segment 1 if their domains intersect only along I. Zz and Ej are matching along l if they are adjacent along l and their boundary edges along l are pairwise coincident (Fig. 2). In order to ensure that two adjacent macrofaces are always refined by inserting the same vertices on their common edge, and that this property is maintained through the whole hierarchy, the following matching rule must be satisfied: 9 For each pair of subdivisions Y~i, Ej e ~, adjacent along a straight-line segment l, either Ei and Zj are matching along l, or one of them (let it be Z~) is matching with a subdivision Zh in the subtree rooted at and E~. 9 For every simple face f of some subdivision Ei e 2, the edges off a r e never refined further in the hierarchy. According to the refinement criterion, existing HTMs (Fig. 3) can be classified into quadtreebased models and hierarchical triangulated models. In quadtree-based models, such as quadtrees (Chen and Tobler 1986; Von Herzen and Barr 1987; Samet and Sivan 1992) and quaternary triangulations (Barrera and Vaquez 1984; Gomez and Guzman 1979), the hierarchical decomposition of the domain follows a predefined regular geometrical pattern, with rectangles and equilateral triangles, respectively, as basic elements. For these models, data points must be sampled at the vertices of a regular grid. Hierarchical triangulated models, on the contrary, are based on a nongeometrically fixed hierarchical decomposition, in which faces are arbitrary triangles. Ternary triangulations (De Floriani et al. 1984; Ponce and Faugeras 1987) represent a first attempt to produce an adaptive model, using a fixed topological pattern with variable geometry, but they have the disadvantage of producing long and

137

s 2b

2a

Fig. 1. A hierarchical subdivision Fig. 2. a Two matching subdivisions; b two nonmatching subdivisions

/k v

a

b

Fig. 3 a-d. Different schemes of domain decomposition in existing a quadtree; b quaternary triangulation; e ternary triangulation; d Hierarchical triangulated irregular network

thin triangles, and thus a less efficient approximation of the surface. Irregularly triangle-based models seem to provide a more appropriate and flexible description of topographic surfaces than quadtree-based ones.

138

In fact, since they can be built on any distribution of data points, they can adapt to the roughness of the terrain by including surface-specific points and lines, which characterize the surface independently of the data sampling.

"rh~N

1~

;omp ter Hierarchical triangulated irregular networks (HTINs) are H T M s based on a hierarchy of triangulations, in which the recursive refinement process is driven by an accuracy-based criterion. Given a sequence eo, ...,e,, of decreasing tolerance values, each level in the hierarchy represents the terrain surface at one of the predefined values e~. The top level corresponds to the coarsest description, satisfying the largest tolerance e0. Passing from a level i to the next level i + 1, every triangle t is expanded into a finer subdivision by iteratively inserting points in its interior or on its sides, until the accuracy e~+ 1 is reached. The number of points in the refinement of a triangle (and, thus, the n u m b e r of faces in its expansion) is not a priori defined. The rule used for selecting and inserting points in a triangle characterizes the different types of HTINs. In all cases, the criterion is based on a m a x i m u m - e r r o r evaluation, and ensures that the matching rule is satisfied. In an adaptive hierarchical triangulation (Scarlatos 1990; Scarlatos and Pavlidis 1992), the refinement of a triangle t is performed by iteratively applying a splitting rule, based on the evaluation of four m a x i m u m - e r r o r points related to the interior and to the three edges of t. A m o n g these four points, the ones corresponding to an error greater than e~+ 1 are selected for insertion. In hierarchical Delaunay triangulations (HDTs) (De Floriani and P u p p o 1992; De Floriani et al. 1993), each element of the hierarchical structure is a Delaunay-based TIN. Notice that, while the subdivision inside every macrotriangle is locally a Delaunay triangulation, the global expanded subdivision of the whole d o m a i n generally is not. The refinement of a triangle t at level e~ of accuracy is performed by an iterative application of the Delaunay selector, until the tolerance value ei + 1 is reached. At each step, the Delaunay selector updates the current Delaunay triangulation by inserting the m a x i m u m - e r r o r point. To ensure matching between adjacent triangulations, the Delaunay selector is applied in two steps: first, only points on edges of t are considered for insertion; then, when precision e~+ 1 has been reached for every edge, points inside the triangle are examined. In this way, the refinement of an edge does not depend on the refinement of the triangle it belongs to, thus m a k i n g sure that every pair of adjacent triangles at level e~ insert the same points on their c o m m o n edge.

3 Horizon on a terrain Given a mathematical terrain model ~ - (D, ~b), we call a candidate point any point P = (x, y, z) belonging to or above the terrain, i.e., such that (x, y ) e D and z >_ O(x, y). In what follows, V is a fixed candidate point, which we call observation point or viewpoint. We consider a spherical coordinate system centered at V. A point P in space is identified, with respect to V, by three coordinates (0, c~, r), where, denoted by It the oriented line segment V~P, 0 (radial direction) is the angle between the projection of I on the x - y plane and the positive x-axis, c~ (elevation) is the complementary of the angle between I and the positive z-axis, and r is the length of l (Fig. 4). A ray emanating from V, called a visual ray, is identified by the coordinates (0, ~) of the point lying on the ray itself at distance r = 1 from V. The pair (0, e) is called a view direction. The horizon of a terrain J / w i t h respect to a viewpoint V is a function c~ = h(O), defined for 0 ~ [0, 2rc], as follows: for every radial direction 0, h(O) is the m i n i m u m value e such that each ray emanating from V with direction (0, fl), with fl > ~, does not intersect the terrain. Such a definition corresponds to the intuitive notion that the horizon of the terrain provides, in each radial direction, the m i n i m u m elevation which a visual ray emanating from the viewpoint in the given direction m u s t have to pass above the surface. O n a polyhedral terrain, every visual ray (0, h(O)) hits the terrain surface at an edge. By collecting the maximal radial intervals in which the ray hits the same terrain edge, we obtain a representation of the horizon as a radially sorted list of radial intervals [0i, 0j], each labeled with an edge of the P T M . If an interval [Oi, 0j] has label s, then the visual ray defined by a direction (0, h(O)), with Oi < 0 < Oj, hits the terrain at a point belonging to edge s (Fig. 5). C o m p u t i n g the horizon of a viewpoint on a polyhedral terrain reduces to the c o m p u t a t i o n of the upper envelope of a set of possibly intersecting segments in the plane. Given a set 5~ of p segments in the plane, i.e., p linear functions y = si(x), i = 1, ... p, each defined on an interval [ai, bi], the upper envelope of such segments is a function y = upper(x) defined over the union of the intervals [a~, b~], and such

139

"~.~,~

omp , er

'S v

G

O ~.

i

". !

y>

AI

"'-. "..

.7.,/` i F

N.."

E

Fig. 4. A spherical coordinate system centerd at a viewpoint V Fig. 5. Horizon o f a viewpoint V on a polyhedral terrain, projected on the x-y plane: segments forming the horizon are drawn in thick lines

that upper(x) = max{si(x)[x e [ai, hi] }. In other words, the upper envelope maps any x value into the segment having maximum y value over x (if such a segment exists). By collecting the maximal intervals Ii on the x-axis, in which the graph of the upper envelope coincides with the graph of the same segment si, we obtain a representation of the upper envelope of s as a list Env(2') of labeled intervals I1, ..., Ik. Each interval Ii is labeled with the segment sj of the given data set 5 ~ such that the upper envelope on Ii is the same as segment sj (Fig. 6). In order to reduce the horizon computation problem on a polyhedral terrain to the problem of building the upper envelope of a set of segments, we express the edges of the terrain in a spherical coordinate system centered at the viewpoint and consider only the two angular coordinates 0 and ~. This transformation produces a set of segments

140

in the 0 - ~ plane. The horizon is obtained by computing the upper envelope of such segments (see Fig. 7 for an example of reduction). It has been shown (Cole and Sharir 1989) that the complexity of the upper envelope of p segments in the plane is | and, thus, the complexity of the horizon of a polyhedral terrain with n vertices is equal to O(nc~(n)). The upper envelope ofp segments in the plane can be computed either by a static divide-and-conquer approach with a O(p logp) worst-case time complexity, or by an incremental one, with a complexity equal to O(pZc~(p)). The first divide-and-conquer algorithm for computing the upper envelope of a set of segments in the plane came from Atallah (1983). This algorithm, which exhibits a worst-case time complexity of O(pc~(p)logp), recursively splits the given set of segments into two halves, and merges the

$3

I I I

I

Suggest Documents