Visibility Algorithms on Triangulated Digital Terrain Models Leila De Floriani Paola Magillo Dipartimento di Informatica e Scienze dell'Informazione Universit a di Genova Viale Benedetto XV, 3 16132 Genova (Italy) Phone: +39-10-3538033 Fax: +39-10-3538028 Email:
[email protected]
Abstract In the paper, we address the problem of computing visibility information on digital terrain models. We present rst a general introduction to digital terrain models. Visibility problems on terrains are classi ed, according to the kind of visibility information they compute, into point visibility, line visibility and region visibility. A survey of the state-of-the-art of the algorithms for computing the dierent kinds of visibility information is presented, according to the previous classi cation. A new algorithm for computing the horizon on a digital terrain model is described as well.
1
1 Introduction Describing a terrain through visibility information, such as, for instance, the portion of the terrain surface visible from a selected point of view, 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 an entire region, the computation of paths with speci ed visibility characteristics (e.g., hidden paths with respect to a prede ned set of observers, scenic paths from which large portions of the terrain can be viewed), the computation of optimal locations for television transmitters [5, 7, 18, 24]. In terrain navigation problems the pro le of the horizon is an ideal tool which can be used from an observer to locate his/her position on a map. Visibility considerations can also suggest the points which can be eliminated from a digital terrain model, while maintaining the same visibility properties. In this paper, we address the problem of computing visibility information on models of natural terrains. A terrain can be described by a continuous function z = f (x; y), de ned over a connected domain D. Two points on a terrain are considered mutually visible when they can be joined by a straight-line segment lying above the terrain (and intersecting it only at its two extreme points). We de ne rst visibility problems on a mathematical model of a terrain. In practice, a mathematical terrain model is approximated through a digital model, usually built from a nite set of points belonging to the terrain. Visibility algorithms developed in the literature operate on digital terrain models (DTMs) and, usually, on polyhedral models (i.e., planar-faced approximations of the terrain). We present a new classi cation of visibility problems, which is based on the visibility information they compute. We consider point visibility problems, which consist of computing intervisibility between pairs of points, thus producing discrete visibility models. A discrete visibility model consists of a collection of points selected in a candidate set which are visible from a prede ned set of observation points. Then, we examine visibility problems related to the computation of lines with speci ed visibility characteristics, like the horizon. Moreover, we introduce a new randomized algorithm. Finally, we consider the problem of computing continuous visibility models, which are based on the computation of that portion of a terrain visible from a point of view located on the terrain. In particular, we describe an algorithm for computing a continuous visibility model on a DTM based on a triangulation. Visibility problems considered in this paper operate on the basis of a point of view located on the terrain (which will be termed visibility on a terrain) to distinguish them from problems related to the hidden surface removal of a terrain, that we will call visibility of a terrain. In this latter case, the point of view lies outside the domain of the terrain (possibly at in nity) and a projection plane (called a view plane) is given. Visibility problems of a terrain are related to the problem of computing the visible surfaces in a three-dimensional scene, which has been extensively studied in the literature [32, 14, 31, 23, 30, 25, 26, 8]. In this survey, we will focus the attention on algorithms for computing visibility on a terrain and on those algorithms for visibility of a terrain which could be adapted to solve the former problem and have a practical interest. The reminder of this paper is organized as follows. In Section 2 we introduce the concepts of mathematical terrain model and of digital terrain model. Section 3 presents a brief overview of algorithms for computing the visibility of a terrain. In Section 4 we introduce a classi cation of visibility problems on terrains, as brie y outlined above. In Section 5 we present algorithms for computing point intervisibility. In Section 6 we present algorithms for horizon computation, and we introduce a new randomized incremental algorithm. Finally, in Section 7, we describe algorithms for computing continuous visibility models. 2
(a)
(b)
Figure 1: (a) A Delaunay triangulation, and (b) an arbitrary triangulation.
2 Mathematical and digital models of a terrain A natural terrain can be described as a continuous function z = f (x; y), de ned over a simply connected subset D of the x 0 y plane. Thus, a Mathematical Terrain Model (MTM), that we simply call a Terrain, can be de ned as a pair M (D; f ). The notion of digital terrain model characterizes a subclass of mathematical terrain models which can be represented in a compact way through a nite number of data. A Digital Terrain Model (DTM) is de ned based on a plane subdivision P of the domain D into a collection of plane regions R= fR1; R2; . . . Rmg and on a family F of continuous functions z = fi(x; y), i = 1; 2; . . . m, each de ned on Ri and such that, on the common boundary of two adjacent regions Ri and Rj , fi and fj assume the same value. Thus, a DTM can be expressed as a pair D (P; F ). We will call face of a DTM the graph of each function fi , edge and Pvertex of the DTM the restriction of each function fi to an edge and a vertex, respectively, of . For simplicity, we will denote by o the projection on the x 0 y plane of a generic geometric entity o in the 3D space. Since a plane subdivision with n vertices is composed of O(n) edges and regions, the spatial complexity of a DTM with n vertices is a linear function of n [28]. DTMs can be classi ed into Regular Square Grids (RSGs), and Polyhedral Terrain Models (PTMs). In an RSG, the domain subdivision is a regular rectangular grid, while each function fi is a piecewise linear, quadratic or cubic function obtained by linear interpolation along the edges of the subdivision. PTMs are characterized by a domain subdivision consisting of a straightline plane graph and by linear interpolating functions. The graph of a polyhedral terrain model consists of a network of polygonal plane faces. Several visibility algorithms developed in the computational geometry literature operate on polyhedral terrain models (that we simply call polyhedral terrains). A special class of PTMs is the class of Triangulated Irregular Networks (TINs), which are characterized by a triangular subdivision of the domain. RSGs and TINs are usually built from a nite set of data points Pi (xi; yi; zi) de ning the terrain. RSG are often used to describe gridded data and are internally represented as arrays. TINs are used to deal with irregularly distributed data, having the capability of adapting to the roughness of the terrain and of including features like special points (peaks, pits, or passes) or special lines (ridges or valleys). Building a TIN reduces to the problem of computing a triangulation of the domain with vertices at the projections of the data points on the x 0 y plane. A Delaunay triangulation [28] is often used as domain subdivision for a TIN because of its good behaviour in numerical interpolation. P Given a set S of points in the plane, a triangulation of S is a Delaunay triangulation if and 3
e2 e1
e3 V
Figure 2: Dierent situations of before/behind relation: edge e1 is before e2; e1 and e3 are not related.
only if the circumcircle of each triangle t of P does not contain points of S inside (see Figure 1). A Delaunay triangulation has also an important property related to visibility computation. It belongs to the class of acyclic subdivisions of the plane, i.e., subdivisions on which it is possible to de ne a partial order relation (called the before/behind relationP ), with respect to any point inside the domainPof the subdivision [10]. Given a plane subdivision and a point O in the plane, an edge e1 of is said to be before an edge e2 (and e2 behind e1) with respect to O if and only if there exists a ray r emanating from O and intersecting both e1 and e2, such that the intersection of r and e1 lies nearer to O thanPthe intersection of r and e2. The before/behind relation is also de ned between the regions of , in analogous way. Figure 2 shows dierent situations of the before/behind relation. A plane subdivision P, in which the before/behind relation is a partial order relation is called an acyclic subdivision with respect to point O; otherwise, it is called a cyclic subdivision. A subdivision P is simply acyclic if it is acyclicPwith respect to any point O. Given a point P in the 3D space, a digital terrain model D ( ; F ) is said to be an acyclic digital terrain model with respect to P if and only if P is P an acyclic subdivision with respect to point P. An acyclic P digital terrain model is a DTM D ( ; F ) such that is acyclic. Acyclic models have a special interest related to visibility application, since their faces and edges can be radially sorted around any xed point of view. We will call a distance order, for an acyclic terrain model, any complete order relation, consistent with the before/behind relation (which is a partial order relation). Given a distance order, visibility information can be incrementally computed for each face or edge by taking into account only the con guration of that portion of the terrain formed by those faces and edges which come before in the order. A cyclic polyhedral model, however, can always be transformed into an equivalent acyclic model (i.e., a model describing the same surface) by a suitable subdivision of its faces. This leads to additional problems if the polyhedral model is a TIN, since the face subdivision may create nontriangular faces, which must be triangulated. Moreover, the subdivision produced is acyclic only with respect to the speci c point of view, and thus depends on the position of the observer.
4
3 Hidden surface removal on a terrain In this Section, we present a brief overview of algorithms for computing the visibility of a terrain, i.e., for hidden surface removal on polyhedral terrains. The visibility problem of a terrain has been extensively studied in computational geometry and interesting algorithms have been proposed [32, 14, 31, 23, 30, 25, 26, 8]. The algorithms for hidden surface elimination in a 3D polyhedral scene (possibly a polyhedral terrain) compute the visible portions of each object of the scene projected on the view plane. We call the collection of such visible portions the visible image of the scene. The worst case space complexity of the visible image, as shown in [23], is O(n2) for a polyhedral scene with n vertices, but, in practical cases, its size can be much smaller. For this reason, output-sensitive algorithms (i.e., algorithms whose time complexity depends on the size d of the computed information) are more convenient than worst-case optimal ones. In the following, we focus on some output-sensitive algorithms for hidden surface elimination in polyhedral terrains, which can be adapted to the computation of a visibility model (see Section 4.3). Except for the algorithm of Preparata and Vitter [28], such algorithms are more of a theoretical interest than of practical applicability. Reif and Sen [30] propose an output-sensitive algorithm for hidden line elimination on acyclic polyhedral terrains, whose time complexity is equal to O((n + d) log2 n), where n is the number of vertices of the DTM, and d is the size of the computed visible image. The point of view is located at in nity in the y direction, and the x 0 z plane is used as view plane. The algorithm consists of two basic steps: (i) The edges of the terrain are grouped to form O(n) monotone chains with respect to the y axis; such chains are then ordered according to their distance from the point of view (i.e., in increasing order of y coordinate). (ii) The chains are projected on the view plane one at a time, in increasing distance order. During this process, the current horizon Hor, formed by the upper envelope1 of the chains projected so far, is maintained. When a chain is projected, the intersections between and Hor are found, and two operations are performed: a visibility determination and an update. The visibility determination consists of marking all the portions of , that lie above the current horizon Hor, as visible from the viewpoint. Those portions of faces adjacent to the visible portions of the edges of , and lying on the nearer side to the observation point are also visible. The update operation consists of computing the new horizon. The basic feature of the algorithm is in the data structure used for storing the current horizon. This structure has been developed for representing monotone polygons, and makes it possible to compute intersections and perform subsequent updates in O((m + k) log m) time, where m is the number of edges of Hor and k the number of intersections. The same approach is followed by Preparata and Vitter [28], who, however, use a dierent and simpler data structure for storing the horizon. The structure proposed by Preparata and Vitter is easier to implement, and consists of a two-levels binary tree. Again, the structure allows intersections and updates in O((m + k) log m) time, where m is the number of edges and k the number of intersections, thus leading to an O((n + d) log2 n) algorithm. De Berg, Halperin, Overmars,pSnoeyink and Van Kreveld [8] propose an output sensitive algorithm which works in O(n1+" d) time, where d is the output size, and " is any arbitrary 1 the
The upper envelope of a set S of segments in the plane is a piecewise linear curve, monotone with respect to y axis, such that, for any x value, it is the segment in S , which assumes the maximum y value at x (see Section
6 for more details).
5
Z
r
Y
π/2−α
_ r
θ
V
X
Figure 3: Spherical coordinate system. integer value. The algorithm computes the visible image of a generic 3D scene composed of quasidisjoint triangular faces; in particular, it can be applied to a TIN. A distance order is not required. The observation point is located at z = 01. The algorithm operates according to a sweep-line technique [28] by moving a horizontal line bottom-up through the projection plane. At a generic step, in the lower half-plane, the visible image has already been constructed, while in the upper half-plane the visible image is still to be determined. The events are represented by the projected vertices of the terrain, which are a priori known, plus the vertices of the visible image, which are dynamically inserted. The approach proposed by Katz, Overmars and Sharir [21] is more a "schema" of an algorithm, which can be applied to three-dimensional scenes formed by quasi-disjoint objects sorted by increasing distance from a point of view (which can be in any position with respect to the scene: inside, outside or at in nity). In particular, the schema can be applied to an acyclic polyhedral terrain model, with viewpoint located on it. The algorithm is expecially convenient for scenes for which the complexity of the union of the projections on the x 0 y plane of m randomly selected objects, that we denote by U (m), is almost linear. The time complexity of the algorithm is proportional to (U (n) + d) log n, where d is the size of the visible image. For a polyhedral terrain, the time complexity is O((n(n) + d) log n), since in that case U (m) = O(n(n)).
4 Classi cation of visibility problems on terrains In this Section, we introduce a classi cation of visibility problems on terrains. Given a mathematical terrain model M (D; f ), we call a candidate point any point P (x; y; z) belonging to or above the terrain, i.e., such that (x; y) 2 D and z f (x; y). Two candidate points P1 and P2 are said to be mutually visible (or intervisible) if and only if, for every point Q (x; y; z) = tP1 + (1 0 t)P2, with 0 < t < 1, z > f (x; y). In other words, two points are mutually visible when the straight-line segment joining them lies above the terrain (and it touches it at most at its two extremes). We call observation point (or viewpoint) any arbitrarily chosen candidate point, and visual ray any ray emanating from a viewpoint. Given a viewpoint V and a spherical coordinate system centered at V , a visual ray r is identi ed by the pair (; ), called view direction, where is the angle between the projection r of r on the x 0 y plane and the positive x-axis, and is the angle between r and the positive z-axis (see Figure 3). 6
13
15
7
5 10
21
9 6 10
V
12
4 1
Figure 4: An example of a discrete visible region on a TIN: V is the viewpoint; visible and invisible vertices are marked in white and black, respectively. We classify visibility problems on a terrain, on the basis of the dimensionality of their output information, into point, line and region visibility problems. Point visibility problems compute the set of points, chosen in a candidate set, visible from a prede ned observation point. Linear visibility problems compute curves on the terrain with special visibility characteristics with respect to an observation point. Region visibility problems consist of the determination of portions of the terrain visible from an observation point. The three categories are de ned in the following subsections. 4.1
Point visibility
Given a terrain M, a viewpoint and a nite set Q of candidate points, we want to compute the subset Q of Q containing all the points visible from V . Q is called the discrete visible region of V in Q (see Figure 4). In practical applications, we consider a DTM, and the candidate points usually form a subset of the vertices of the terrain. A generalization of the problem stated above consists of computing a discrete visibility model of a terrain, which encodes in a discrete way information on the portions of the terrain visible from a speci ed set of observation points. Given a terrain M, a nite set S1 of observation points, and a set S2 of points belonging to M, the discrete visibility model of M with respect to S1 and with respect to S2 is a collection of sets Qi , each corresponding to a point Vi in S1, and de ned as the set of points belonging to S2 that are visible from Vi. 0
4.2
0
Line visibility
An example of a line visibility problem is the extension to terrain visibility of the well-known visible-line reconstruction problem for general 3D scenes [17]. Such problem can be formulated as a line visibility problem for a DTM by taking a point of view inside the domain, and requiring the computation of the visible portions of the edges of the terrain. A line visibility problem of practical relevance in geographic applications consists of computing 7
9
12
8
6
8
9
4 5
7
11 10 6
7
Figure 5: Horizon of an observation point on a polyhedral terrain, projected on the x 0 y plane. Each vertex is labeled with its elevation; the location of the viewpoint is marked; the segments forming the horizon are drawn in thick lines. the horizon of an observation point on a terrain. Given a terrain M (D; f ) and a point of view V , the horizon of the terrain with respect to V is a function = h(), de ned for 2 [0; 2 ], such that, for every radial direction , h() is the maximum value such that each ray emanating from V with direction (; ), with < , does not intersect the terrain. Such de nition corresponds to the intuitive notion that the horizon of the terrain provides, in each radial direction, the minimum elevation which must have a visual ray emanating from the point of view in the given direction to pass above the surface. In a polyhedral terrain, the horizon is a radially sorted list of labeled intervals [1; 2]. If an interval [1; 2] has label s, then the visual ray de ned by a direction (; h()) with 1 < < 2 hits the terrain at a point belonging to edge s. An example of horizon on a polyhedral terrain is presented in Figure 5. 4.3
Region visibility
Given a terrain M (D; f ) and a point of view V , we de ne visible region of V the subset D of D formed by the points (x; y ) 2 D such that (x; y; f (x; y )) is visible from V . The invisible region of V is the complement of D in D. An example of visible and invisible region is shown in Figure 6. In a DTM D (P; F ), visibility with respect to a point of view can be coded as a map, called a continuous visibility map, which consists of a partition of the domain D into maximal connected regions, each of which is labeled as invisible, if it is a subset of the invisible region, or with a face of the terrain in such a way that, if a region R is labeled with face f , then all points of f whose vertical projections belong to R are visible from the point of view. A continuous visibility model is a partition of the terrain domain, and thus is dierent from a partition of the viewplane computed by hidden surface removal algorithms [26]. Given a set S of observation points, we call the collection of visibility regions of the points in 0
0
8
15
13
7
5 10
21
9 6 10
V 12
4 1
Figure 6: An example of visible and invisible region on a TIN (the invisible region is shaded).
S a continuous visibility model of the terrain with respect to S .
5 Algorithms for point visibility Point visibility computations can be reduced to determining the mutual visibility of two candidate points. In this Section, we present a "brute-force" approach as well as an approach based on a preprocessing of the terrain, which builds a hierarchical query structure. To compute the discrete visibility region of a point of view V with respect to a candidate set S , we need to determine the mutual visibility of V and the points belonging to S . To solve this problem, we can apply an algorithm which tests the mutual visibility of each pair (V; P ), where P belongs to S , with a computational cost of O(nk), where k denotes the cardinality of set S . Given a DTM D (P; F ) and two candidate points P1 and P2 on D, the mutual visibility of P1 and P2 through a "brute-force" approach reduces to computing the intersection of the projection on the x 0 y plane of segment s PP1P2, denoted s, with the edges of P. At each intersection point P between s and an edge e of , we test whether s lies above the edge of D corresponding to e. If s is above the corresponding terrain edge at any such intersection point, then P1 and P2 are mutually visible (see Figure 7). In general, this process has a linear time complexity, in the worst case, in the number of edges of D, which is O(n), where n is the number of vertices of D. p For a regular square grid, the time complexity reduces to O( n). The second approach preprocesses the terrain model with respect to the point of view V , and builds a data structure on which the problem of computing the visibility of a point P from V can be solved in logarithmic time. Despite the \brute force" method described above, it requires a polyhedral terrain model. The data structure has been proposed by Cole and Sharir [7] to solve a ray shooting problem on a polyhedral terrain. Given a polyhedral terrain D (P; F ), a point of view V and a view direction (; ), the ray shooting problem consists of determining the rst face of D hit by a ray emanating from V with direction (; ). The mutual visibility of two points V and P reduces to solve a ray shooting problem, since we have just to consider as view direction the one de ned by segment V P and, when the rst face of D hit by the corresponding visual ray has been obtained, we have just to determine whether P and V lie on the same or on opposite 9
e1 P1
e2 P2 e3
Figure 7: Determination of the mutual visibility of two points P1 and P2. The elevation of segment P1 P2 must be tested against that of edges e1 , e2 , e3 , at their intersection points. sides of the plane of such a face (see Figure 8). The data structure of Cole and Sharir, that we call a horizon tree, has size O(n(n) log n), where (n) is the inverse of Ackermann's function (which, in practice, is a constant). Ray shooting queries can be answered in time O(log2 n) on such structure. Given a point of view V , the horizon tree can be built for any acyclic polyhedral terrain, since the edges of the terrain must be sorted around the viewpoint. The horizon tree is a balanced binary tree, with a depth which is logarithmic in the number of terrain edges. In the in uence tree, every node corresponds to a subset of edges and stores a partial horizon; the root corresponds to the whole set of edges of the terrain. Each left child corresponds to the half of the edges associated to its parent, that are closest to the viewpoint V , and each right child corresponds to the other half. Every node v stores the partial horizon, denoted hv , computed on the edges associated with the left child of a node v. An example of a horizon tree is illustrated in Figure 9. A horizon tree can be computed in optimal O(n(n) log n) time, since each partial horizon can be computed by a single application of the algorithm of Atallah [2] for determining the horizon of a point of view on a polyhedral terrain (see Section 6.1). A ray shooting query, represented by a view direction (; ), can be answered by descending the horizon tree, starting at the root. For any node v visited, the value = hv (), is computed and compared with . If > , then the visual ray r, identi ed by (; ), passes above the current horizon, and the search continues in the right subtree of v; otherwise, r passes below the current horizon, and the search continues in the left subtree. At the end of the process, two consecutive horizons have been found such that the visual ray r passes above the rst one, but below the second. Thus, two edges e1 and e2 of the terrain are identi ed such that r passes above e1 , but below e2 . It can be proven that e1 and e2 are on the boundary of the same face f , and that f is the rst face encountered by r. An example of this search is illustrated in Figure 10. In descending tree T one node is visited at each level. For each node v the interval of the horizon associated with v containing ray r must be located. This leads to a time complexity of O(log2n). Computing the discrete visible region of a model D with respect to a point of view V and a set S of k candidate points is thus equivalent to computing the horizon tree, with a computational cost equal to O(n(n) log n), plus performing k intervisibility computations with a cost of O(klog2n), which is clearly less than a direct intervisibility computation, if k = O(n). 10
V
f2 r2
Q1
Q2
f1 r1
Figure 8: Reduction of a point intervisibility query to a ray shooting query, on a 2D section of a polyhedral terrain. A point Qi, is visible from V , if it lies on the same side as V with respect to face fi; fi is the rst face hit by ray ri, emanating from V and passing through Qi. In the drawing, Q1 is visible from V , Q2 is not.
6 Line visibility algorithms In this Section, we focus on a speci c line visibility problem, i.e, the computation of the horizon of a point of view on a polyhedral terrain. This problem reduces to the computation of the upper envelope of a set of possibly intersecting segments in the plane. Given p segments in the plane, i.e., p linear functions y = fi(x), i = 1 . . . p, each de ned on an interval [ai; bi], the upper envelope of such segments is a function y = F (x), de ned over the union of the intervals [ai; bi], and such that F (x) = maxi x [a ;b ](fi(x)). In other words, the upper envelope maps any x value, in the segment having maximum y value over x (if such segment exists) (see Figure 11 for an example of upper envelope). To reduce the horizon on a polyhedral terrain to the upper of a set of segment, we express the edges of the terrain in a spherical coordinate system centered at the viewpoint and consider only the two angular coordinates. This transformation produces a set of segments in the 0 plane. By computing the upper envelope of such segments, we obtain a function which associates, with each direction , the segment (if it exists) having maximum azimuth in direction , i.e, the horizon (according to the de nition introduced in subsection 4.2). Figure 12 shows an example of horizon on a polyhedral terrain and the corresponding upper envelope of segments. It has been shown [16] that the complexity of the upper envelope of p segments in the plane is O(p(p)), and, thus, the complexity of the horizon of a polyhedral terrain with n vertices is equal to O(n(n)). The upper envelope of p segments in the plane can be computed either by a static divide-and-conquer approach leading to a O(p log p) worst-case time complexity, or by a dynamic incremental one, with a complexity equal to O(p2(p)). In Section 6.3, we brie y describe a randomized version of the dynamic algorithm, having an expected time complexity, in the worst case, equal to O(p(p) log p). All these algorithms consider the upper envelope as a collection of labeled intervals on the x-axis. j 2
i
i
11
e7
0
1
e6 5
e8
e3
3
V
e2
e5 2
e4 e1 4 (a) e7 e8
e6
e3 V
e2
e5
e4 e1
e7 e3 V
e6
e8 e2
V
e5
e4 e1
e7
e6 e8
e3 V
e2
V
V
e5
V
e4 e1
(b)
Figure 9: (a) An acyclic polyhedral terrain with eight edges (numbered e1; . . . ; e8, in a distance order from the viewpoint V ), and (b) the corresponding horizon tree (the set of edges and the partial horizon (in thick lines) associated with each node are represented).
12
e7
0
1
e6 5
e8
e3
3
V
P e2
e5 2
e4 e1 4 (a) e7 e8
e6
r passes above e2
e3 V
e2
e5
e4 e1
e7
V
e6
r passes below e6
e8
e3 e2
V
e5
e4 e1
e7
e6 e8
e3 V
e2
V
V
e5
V
e4 e1
r hits the face bounded by e2 and e6
(b)
Figure 10: Processing a ray shooting query on the horizon tree: (a) The visual r hits the point P on the terrain. (b) The corresponding path on the horizon tree.
13
Figure 11: A set of segments and its upper envelope (in thick lines). C B
D
(a)
A E V
F G B D
α
E
(b)
C A F G 0
90
180
270
360
θ
Figure 12: Reduction of the horizon on a polyhedral terrain to the upper envelope of a set of segments. (a) Horizon, with respect to o viewpoint V , on a polyhedral terrain model. (b) The set of segments in the 0 plane, obtained by projecting the terrain edges, and the corresponding envelope. 14
A
C
A B
D
I
B B
C
C e
last e
D
D
A e
last e
(a)
e
last e
(b)
(c)
A C
D I
B
I B D
C A last e
e
u
last e
(d)
e
u
(e)
Figure 13: Processing an event e during Atallah's merging procedure: the event may be an intersection point (a), a right endpoint (b,c), or a left endpoint (d,e). 6.1
A divide-and-conquer approach
The rst divide-and-conquer algorithm for computing the upper envelope of a set of segments in the plane is due to Atallah [2], and achieves a worst-case time complexity of O(p(p) log p). The algorithm recursively splits the set of segments into two halves, and pairwise merges the results. Merging two envelopes is performed through a sweep-line technique for intersecting two monotone chains of segments. The sweep-line algorithm moves a vertical line r from left to right through the plane in such a way that at each step the resulting upper envelope restricted to the left half-plane of r has already been computed, while in the right half-plane it is still to be determined. The events are represented by the vertices of the two given envelopes, plus the intersection points between them. The current status of the sweepline is represented by the pair of segments, one each partial envelope, that are intersected by the sweep line, ordered according to their height. At any event, the status, and, possibly, the resulting envelope are updated, depending on the kind of event (see Figure 13). If the event is an intersection point (Figure 13 (a)), then the current segments in the sweepline status are swapped; the interval between the last event and the current one is also inserted in the resulting envelope. If the event is the right endpoint of a segment in the status (Figure 13 (b,c)), then that segment leaves the status; if the exiting segment is the upper one (Figure 13 (b)), then the interval between the last event and the current one is also inserted in the resulting envelope. If the current event is the left endpoint of a new segment s on one of the partial envelopes (Figure 13 (d,e,)), then s is inserted in the current status, in the right position according to its height; the intersection between the new pair of status segments is also tested and eventually inserted in the event queue. The time complexity of the merging phase is linear in the size of the two envelopes to merge, that is O(p(p)) in the worst case. The pseudocode of the merging phase is described below. Algorithm MERGE 15
input Env1; Env2: upper envelope; output Env : upper envelope; begin
fInitialization:g
Env empty list; fresulting envelopeg EV empty list; fevent listg for i = 1; 2 do for every [a; b] in Envi do Insert a in EV , marked as left endpoint; Insert b in EV , marked as right endpoint; end for end for ;
ST = (ssup ; sinf ) (null; null); fstatusg fssup = current segment on upper partial envelopeg fsinf = current segment on lower partial envelopeg last e 01; flast eventg
fMain loop:g
EV = 6 empty list do pick next event e from EV ; case event type of intersection point: insert [last e; e] in Env, with label ssup ; last e e; swap ssup and sinf ; right endpoint: if e right endpoint of ssup then insert [last e; e] in Env, with label ssup ; last e e; ssup sinf ; sinf null; null; else sinf
while
end if
left endpoint: snew segment whose left endpoint is e; if snew over ssup ftrue if ssup = nullg then ssup snew ; else sinf
ssup ; ssup
snew ;
end if if ssup
e sinf intersect then (x; y) ssup \ sinf ; insert x in EV , marked as intersection point;
end if end case end while end Algorithm .
The algorithm proposed by Hershelberg [22] is still based on a divide-and-conquer strategy, but it computes the upper envelope of a set of p segments in optimal O(p log p) time. The basic idea is to subdivide the given set of segments in such a way that the upper envelope of any subset of the generated groups is linear in the number m of segments. Thus, it can be computed in time O(m log m) by using the algorithm previously discussed. Given a set S of n segments, the algorithm builds a balanced binary tree with O(log n) levels, whose nodes correspond to the 2n extreme point of the segments in S , according to their left-to-right order. Thus, each node k represents a vertical line x = xk , where xk is the x-coordinate of the extreme points corresponding 16
x4
y
P3
P6
s2
x2
P2 P4
s1
x2 x3
x4
{s4}
s3 s4
P5 x1
x6
{s1}
P8
P7
P1
{s2,s3}
x5
x1 x6
x7
x8
x3
x5
x7
x
x8
(a)
(b)
Figure 14: A set of four segments (a), and (b) the tree built by Hershelberg's algorithm. to k. Each segment s in S is then associated to a node k such that s intersects x = xk and does not intersect any other vertical line at the same level. An example of such a tree, for a set of four segments, is illustrated in Figure 14. A segment PiPj is associated with the node v that is the nearest common ancestor of the two nodes representing the x-coordinates of Pi and Pj . For example, in gure 14 segment s4 P5P8 is associated with the node labeled x6. All segments associated with the same node intersect the same vertical line, giving a linear size for their upper envelope. Moreover, segments associated with dierent nodes at the same level of the tree lie in disjoint vertical slabs. The algorithms thus computes the upper envelope of the segments associated with the single levels of the tree, i.e., O(log n) upper envelopes. Then, Atallah's algorithm is used to merge all partial envelopes pairwise, according to a divide-andconquer approach. This operation again has an O(p log p) time complexity, thus leading to an O(p log p) time complexity for the entire algorithm in the worst case. 6.2
A dynamic approach
The upper envelope of a set of segments can be incrementally built by starting from an initially empty structure and adding one segment at a time to it, in any order. For each new segment s, we locate those x-intervals, related to the envelope, which properly intersect the x-interval de ned by s, and update the upper envelope in each of these intervals. An example of update is shown in Figure 15. The worst-case time complexity of such algorithm is equal to O(p2(p)), since adding the i-th segment can cause the update of each of the O(i(i)) intervals of the current envelope. A pseudocode description of the algorithm is reported below. Algorithm INCREMENTAL input S : set of segments in the plane; output Env : upper envelope; begin
fInitialization:g
Env empty list; fMain loop:g while there are segments not yet examined in S do s a segment not examined 2 S ; [a; b] x-interval occupied by s;
17
y
y
s3
s3
s4
s1
s4
s1
s5
s5 s6
s2 s6
x x1
x
x3
x2
(a)
s3
x5 x6
(b) s
y
x4
s
y
s
s3
s4
s1
s4
s5
s1
s5
s6
s6 x x1
x2
a x3
x4
x x1
b x5 x6
(c)
x2
a
k x4
b x5 x6
(d)
Figure 15: Incremental update of the upper envelope of a set of segments: the set of segments already processed (a); their upper envelope (b); the new segment s, and the intervals which are relevant for update (c); the resulting upper envelope (d).
18
fInternal loop:g
interval [c; d] in Env, with label l, such that [c; d] \ [a; b] = 6 do delete [c; d] from Env; [i; j ] [a; b] \ [c; d]; if l and s do not intersect in [i; j ] then insert [i; j ] in Env, labeled with the upper segment, between l and s, over [i; j ];
for every
else
(x; y) s \ l; insert [i; x] in Env, labeled with the upper segment, between l and s, over [i; x]; insert [x; j ] in Env, labeled with the upper segment, between l and s, over [x; j ]; end if ; if i > c then insert [c; i] in Env , with label s; end if ; if j < d then insert [j; d] in Env , with label s; end if ; end for ; fRe-arranging step:g for every pair of adjacent intervals [a; b] and [b; c] in Env , with label s do merge [a; b] and [b; c];
end for end while end Algorithm . 6.3
A randomized algorithm
In this Section, we describe a new algorithm for computing the upper envelope, which is modi ed version of the dynamic algorithm, described in Section 6.2. A randomized analysis of such algorithm gives a time complexity of O(i log i) for the insertion of the i-th segment, thus leading to an O(p(p) log p) expected time complexity, in the worst case, for the entire process [DeF93]. The algorithm is similar to the one by Boissonnat and Dobrindt [4] for the upper envelope of a set of triangles in the space (see Section 7.1). The main dierence with the incremental (brute force) approach is the introduction of a con ict graph. A con ict graph is a directed acyclic graph, which stores the current upper envelope Env, plus the \history" of its construction. Each node of the graph corresponds to a labeled interval that has been an interval of Env at any stage of the algorithm. The leaves correspond, in left-toright order, to the intervals of the current upper envelope. The root represents the upper envelope of the empty set of segments, that we had at the beginning of the computation. The graph is then built in such a way that, for each node v, the associated interval is contained in the union of the intervals associated with the parent nodes of v. An example of con ict graph is reported in Figure 16. We say that a labeled interval Ii is in con ict with a segment s if s is over the segment labelling Ii in any subpart of Ii. The algorithm we propose starts with an empty envelope and updates it by inserting a new segment selected randomly in the given segment set. At a generic step, the algorithm performs the following computations (see Figure 18): (i) Localization of the intervals Ii of Env that are in con ict with the newly inserted segment s (i.e., the intervals that need to be updated after the insertion of s). The localization 19
s1 s2
s1
s2
s1
a1 a2
c
b2 b1
x
a1 a2
(a)
c
b2 b1
x
(b) [-inf+inf],null
[-inf,a1],null
[a1,b1],s1
[a1,c],s1
[b1,+inf],null
[c,b2],s2
[b2,b1],s1
(c)
Figure 16: A set of two segments (a), their upper envelope (b), and the corresponding graph (c), constructed by inserting segments s1 and s2 in sequence.
l
s
I
Figure 17: Subdivision of an interval I , labeled l, in con ict with s, in three new intervals.
20
s1
s2
[-inf,+inf],null s s1
a1 a2
c
[-inf,a1],null
b x
a b2 b1
[a1,b1],s1
[a1,c],s1
(a)
[a1,c],s1
[-inf,+inf],null
[a1,b1],s1
[c,b2],s2
[b2,b1],s1
(b)
[-inf,+inf],null
[-inf,a1],null
[c,b2],s2
[b1,+inf],null
[b1,+inf],null
[-inf,a1],null
[b2,b1],s1
[b2,b1],s
[b1,b],s
[a1,c],s1
[a1,b1],s1
[c,b2],s2
[b,+inf],null
[b1,+inf],null
[b2,b1],s1
[b2,b],s
(c)
[b,+inf],null
(d)
Figure 18: Insertion af a new segment s into the upper envelope of the previous gure. The new segment s (a). Localization of the leaves in con ict with s (the traversed path is marked with thick lines) (b). Subdivision of the con icting intervals (the newly created leaves are highlighted in thick lines) (c). Merging of the adjacent intervals with same label (d). step is performed descending the graph starting at the root and, for every visited node v, continuing the traversal in each child of v whose associated interval is in con ict with s, and that has not yet been reached from other paths. The leaves detected in a such way represent the intervals of Env that are in con ict with s (see Figure 18 (a,b)). (ii) Updating the upper envelope. Every interval Ii of Env, in con ict with s, is split into at most three new intervals (see Figure 17). For each new interval, a leaf is created and linked as a child to the node representing Ii (see Figure 18 (c)). Finally, adjacent intervals with same label (= s), that may have been created from the subdivision of dierent intervals Ii, are merged together. This makes the corresponding leaves to collapse, generating convergent paths on the graph (see Figure 18 (d)). The complexity of the algorithm has been determined with a randomized analysis: the results are related to the average case for the order of insertion of the given segments (by considering all the possible permutations equally likely). For the size of the upper envelope, the worst care is instead considered. While inserting the i-th segment, the expected size of the graph is equal to O(i(i)), and the expected number of visited nodes is O((i) log i). The expected number of intervals to update (i.e., the number of visited leaves) is also bounded by (i) log i. Since the update step takes a linear time in the number of updated intervals, a time complexity of O((i) log i) is expected for the insertion of the i-th segment. The whole algorithm works thus in O(p(p)) expected space, and O(p(p) log p) expected time for a set of p segments, in the worst case.
21
t3
t1
t2
t3
Figure 19: A set of triangles, numbered t1; . . . ; t3 in increasing height order, and its lower envelope, as a labeled plane subdivision.
7 Algorithms for region visibility In this Section, we describe two approaches to the computation of the continuous visibility map of a point of view on a digital terrain model. The rst approach is based on the determination of the lower envelope of a set of triangles and thus it can be applied to TINs. The second approach has been speci cally developed for acyclic TINs (like those based on a Delaunay triangulation of the domain) by one of the authors. A third approach, consisting in the determination of the visible image, has been already discussed in Section 3. The visible image, computed by hidden surface removal algorithms (see Section 3), can also be de ned in the case of a point of view located inside the scene, by rede ning the projection plane as a sphere centered at the given viewpoint. In the case of a polyhedral terrain, the visible image can be converted in linear time into the visibility map. 7.1
Computing the lower envelope of a set of triangles
In this approach, the problem of computing a continuous visibility map transforms into the problem of computing the lower envelope of a set of disjoint triangles in the space. The lower envelope of a set T of triangles in the 3D space de nes a partition of the x 0 y plane into maximal connected regions, each of which is labeled with a triangle of T in such a way that, if a region R is labeled with triangle t, then t is the triangle with minimum height over R (see Figure 19). It has been shown [16] that such partition has an O(n2) complexity (since all the triangles are disjoint). When computing the visibility map with respect to a point of view V , we associate as "height" to a triangle ti a function i(x; y) that maps into a point P (x; y) in the plane the distance from V of the point P on ti whose projection on the plane is P. The same approach could be used for hidden surface removal on a terrain, provided that the projection plane is the view plane. The algorithms, which compute the upper envelope Env(T ), compute rst a ner subdivision, denoted A(T ), obtained by projecting all the triangles on the x 0 y plane and extending the projected segments to in nity (see Figure 20). A(T ) has still an O(n2) complexity and is formed only by convex regions. Env(T ) can be computed from A(T ) in O(n2) time. This 22
t3
t3 t3 t3 t3
t1 t3
t3
t2
t3
t3 t3
t2 t2
t3 t3 t2
Figure 20: The A(T ) subdivision for the set T of triangles depicted in Figure 19. complexity is optimal, since O(n2) is the complexity of the visibility structure of a polyhedral terrain [7]. A \brute-force" approach to determine A(T ) consists of computing, for each region R, the triangle whose \height" is minimum with respect to the values of all the \height" functions associated with the triangles overlapping R. The worst-case time complexity would be O(n3), since the projection of n triangles can cover a single region. An optimal approach to computing the lower envelope of a set of triangles has been proposed by Edelsbrunner, Guibas and Sharir [15]. Such algorithm is based on the classical divide-andconquer paradigm: it recursively partitions set T in two equally-sized subsets T1 and T2, it separately builds A(T1) and A(T2), and, nally, merges A(T1) and A(T2) into A(T ) by reassigning the labels to the regions at which A(T1) and A(T2) intersect. The pseudocode description of the algorithm is reported below. Algorithm TRIANGLE ENVELOPE input T : set of triangles in the space; output A(T ): labeled plane subdivision; begin
fSubdivision step:g Partition T in two disjoint equally-sized subsets T1 e T2 ; fRecursive step:g A(T1) TRIANGLE ENVELOPE(T1 ); A(T2) TRIANGLE ENVELOPE(T2 ); fMerging step:g A(T ) superimposition of A(T1 and A(T2), with white labels; for every R region in A(T ) do R1 region in A(T1) such that R R1; R2 region in A(T2) such that R R2; 23
t1
t1 t1
t2
t2
t2
t1
t1
t1 t1
t3
t3
t3 t3
(b)
(a)
Figure 21: Trapezoidal decomposition of the lower envelope of a set of three triangles: the lower envelope subdivision (a) and the trapezoidal decomposition (b). label of R1 in A(T1); label of R2 in A(T2); label R with the lower triangle, between t1 e t2, over R;
t1 t2
end for end Algorithm
.
The worst case time complexity is equal to O(n2). An incremental randomized algorithm has been recently proposed by Boissonnat and Dobrindt [4]. The algorithm inserts a triangle at a time in the lower envelope constructed for the already examined triangles. Instead of the current lower envelope Env(T ), a ner subdivision, called the trapezoidal decomposition of Env(T ), denoted T rap(T ), is maintained. Env(T ) contains two types of vertices: projected triangle vertices and intersection points between projected triangle edges. T rap(T ) is obtained from Env(T ) by drawing through every vertex of the rst type a vertical segment to the rst edge above and below this point, and repeating the same process for every vertex of the second type, but only in one direction (see Figure 21). T rap(T ) has the same space complexity as Env(T ), but it is formed by trapezoidal regions, i.e., regions with a xed number of edges. T rap(T ) is stored in a special data structure which allows an easy localization of the regions which are properly intersected by the projection of the new inserted triangle on the x 0 y plane. The data structure maintains the current trapezoidal decomposition plus the \history" of its construction in a directed acyclic graph, whose nodes correspond to trapezoids that have been regions of T rap(T ) at some stage of the algorithm, and whose leaves are the trapezoids of the current T rap(T ). When we insert a new triangle t, we perform a localization step and an update step. The procedure is illustrated in Figure 22. The localization step is performed descending the graph from the root to the leaves whose associated trapezoids have non-empty intersection with t, and such that t has maximal height over them (see Figure 22 (a)); such trapezoids are called trapezoids 24
B
(a)
C
D
F
G
_ t A
B2 B3
(b)
B4
C1
C2
_ t
G
E
F
G
A
B
C
D
E
F
G
E
A3
D2
A1
C2
A2
A3
B1
B2
B3
B4
C1
C2
D
F
_ t
A
G
B
C
D
E
F
G
A2 A1
E
D1
D2
(d)
D
E
A1
B2 B3
C
A2
B1
(c)
B
D
F
B2 B3
A
E4 E5 E3 E2
A1
C2
A2
D1
B2
B3
D2
C2
D
F
A2 E1
A
G
A1
B
C
D
E
F
G
E
D1
A1
A2
E1
D1
E2
E3
B2
E4
B3
D2
C2
E5
Figure 22: Update of T rap(T ) when inserting a new triangle t. Location of the leaves whose associated trapezoids are in con ict with t (a); the shaded portion will not be modi ed. The part not covered by t of each trapezoid R in con ict with t is split in at most ve new trapezoids (b). Adjacent trapezoids created by splitting dierent regions and having the same label are merged together (c). Trapezoidal decomposition of the part of plane on which t has the maximal height (d). 25
in con ict with t.
The update step is performed in such a way that, for every node, the associated trapezoid is contained in the union of the trapezoids associated with its parents. First, the part of each trapezoid R in con ict with t, not covered by t, is split into at most ve new trapezoids; the newly created trapezoids become children of those trapezoids which they properly intersect (see Figure 22 (b)). Then, adjacent trapezoids created by splitting dierent regions R and having the same label are merged together, leading to convergent paths on the graph (see Figure 22 (c)). Finally, the part of plane on which t has the maximal height is decomposed in trapezoidal regions; again, the new trapezoids become leaves, that are linked to the properly intersecting trapezoids (see Figure 22 (d)). The time complexity of the algorithm is determined with a randomized analysis (i.e., worst case for the given set of triangles and average case for the order of insertion). Given a set of nonintersecting triangles, the i-th triangle can be inserted in O(i log i) randomized expected time, leading to a O(n2 log n) complexity for the entire algorithm [4].
7.2
An algorithm based on acyclic TINs
In this Subsection, we describe an algorithm for the computation of the visible region on acyclic D, the TINs [9, 20]. More precisely, given an acyclic TIN D (P; F ), and a point of view V on P algorithm determines the invisible portion of each face of D, i.e., for every triangle ti of , the subset IRi containing the points (x; y) 2 ti such that (x; y; fi(x; y)) is invisible from V . The algorithm operates in two steps:
(i) Sorting the triangles of P by increasing distance with respect to the projection V of the point of view V on the x 0 y plane (radial sorting phase). (ii) Computing the visible portions of each triangle of D with respect to V (visibility computation phase).
Radial sorting is performed by building a star-shaped polygon 5 around V Pby incrementally adding a triangle at a timePto an initial polygon formed by the triangles of incident in V . The acyclicity property of ensures that at each step we can always add a new triangle while maintaining the star shape of the resulting polygon. Initially, 5 consists of the union of the triangles of P containing V inside or on the boundary. At any stage, an edge l of the boundary of 5 is chosen, and the triangle t adjacent outwards to l is examined. Two situations may arise (see Figure 23):
if t is adjacend to 5 along two edges, then it can be added to 5. if t is adjacend to 5 along a single edge ( l), then it can be added to 5 if and only if the opposite vertex of t lies in the radial sector de ned by V and l . In the implementation, we maintain the boundary C of polygon 5. After having examined an edge l of C , we delete l from C , both in case the corresponding triangle t has been added to 5 or not. In this way, a rejected triangle t will be examined again only when another edge l Pof t will have been included in C , i.e., when it will be possible to add t to 5. Every triangle t of is thus examinedPat most twice, and then the radial sorting operates in linear time in the number of triangles in . The pseudocode description of the radial sorting algorithm is reported below. 0
26
0 3 1
1
0 3
2 0
t1 2 t2 4
3
4
1
5 t3 2
1
3 1 1
Figure 23: Test for the inclusion of a new triangle in 5: 5 is the shaded polygon; t1 e t2 can be added to 5, t3 cannot. Algorithm input
RADIAL SORT
P: acyclic plane triangulation with respect to point O; P O: point inside the domain of ;
output
L: ordered list of triangles;
begin
fInitialization:g P case position of O in : P O vertex of : L the triangles incident in O, in any order; C the edges not incident in O of the above triangles; P O on an edge e of : L the two triangles adjacent to e, in any order; C the four edges 6= e of the above triangles; P O inside a triangle t of : L [t]; C the three edges of t; end case ; fMain loop:g while there are triangles not included in L do l an edge in C ; t the triangle not in L adjacent to l; if t may be included then concatenate t to L; delete from C the edges of t that are in C ; famong them lg insert in C the edges of t not yet considered; else delete l from C ; end if
27
b V t2
t1
Figure 24: Triangle t1 is face-up, triangle t2 is face-down, and b is a blocking edge, with respect to viewpoint V . end while end Algorithm .
The visibility computation step consists of incrementally computing successive horizons, each horizon being restricted to the set of edges of the terrain examined so far. The horizon sequence is determined by examining the triangular faces of the model according to the ordered sequence produced by the radial sorting algorithm. To describe the second step in more detail we need to introduce some de nitions. A face fi of D, de ned by a linear function z = aix + biy + ci, determines two (open) half-spaces, i.e., an upper half-space (locus of the points (x; y; z) such that z > aix + biy + ci) and a lower half-space (locus of the points (x; y; z) such that z < aix + biy + ci). A face fi is said to be face down with respect to a viewpoint V if V lies in its lower half-space, it is called face up if V lies in the upper half-space. We say that an edge e of D is a blocking edge when, if f1 denotes the closest face incident in e and f2 the furthest, then f1 is face up and f2 is face down. Figure 24 shows an example of a blocking edge. The visibility algorithm constructs an active sequence of blocking edges, called Active Blocking Edge Segment Sequence (ABESS). ABESS contains all those portions of blocking edges belonging to triangles already visited which can cast a shadow on triangles not yet examined (see Figure 25). At the beginning of the computation, ABESS is initialized as an empty list of intervals. Then the triangles of P are processed one at a time, according to the radial order. Processing the current triangle t involves two kinds of operations:
Determining the visible portions of t: if t is face down with respect to V , then t is totally invisible. Otherwise, we consider all segments in ABESS intersected by any visual ray which hits t (called the relevant segments of ABESS for t). For example, in Figure 26, the relevant segments for triangle t are a and b. We compute the portion of t hidden by each segment and insert it into the set of the invisible portions of t. Updating ABESS: for every edge b of t which has not yet been examined and is a blocking edge, we update ABESS with a procedure similar to the incremental updating of the upper envelope. The pseudocode description of the whole visibility computation algorithm is reported below. Algorithm TIN VISIBILITY input
28
0 3 1
1
0 2
3
0 2
3
4
1
5 4 2
1
3 1 1
Figure 25: Con guration of ABESS at an intermediate step of the algorithm (the viewpoint is the marked vertex; the triangles already examined are shaded).
b
t a
Figure 26: Relevant ABESS segments for a triangle: a and b are the relevant segments for the triangle t.
29
D = (P; F ): acyclic TIN model with respect to V , where P = (V ; E ; T ); V : viewpoint;
output
fIRi j ti 2 T g: family of plane regions;
begin
fRadial sort:g P L RADIAL SORT ( ,V ); fVisibility determination:g for every triangle ti of T do IRi ; end for ; ABESS empty list; fMain loop:g while L 6= empty list do pick the rst triangle ti from L; if ti face down then IRi ti ; fti totally invisibleg else for every
b 2 ABESS relevant for ti do Aux portion ti obscured by b; IRi IRi [ Aux;
end for end if ; for every edge l of ti not yet considered do if l is blocking edge then update ABESS end for end while end Algorithm .
by inserting l; end
if
;
The visibility computation step has an O(n2(n)) worst-case time complexity, since O(n(n)) is the size of ABESS in the worst case, and O(n) triangles are examined. Implementation issues and experiments on real data are discussed in [20].
8 Concluding Remarks We have considered the problem of computing visibility information on terrains, and we have presented a survey of algorithms for solving such problems. We have classi ed visibility computations into point, line and region visibility, and we have followed such classi cation in the description of the algorithms which compute them. We have presented a new algorithm for computing the horizon of a terrain, which achieves a good performance by using a con ict graph to store the history of the computation performed. This algorithm has the advantage of being computationally simple and of having a good expected time complexity, as shown by a randomized analysis [DeF93]. Algorithms for computing a discrete visibility model are extremely useful in the applications, since several problems related to visibility (for instance, terrain navigation, line of sight problems) would be computationally intractable on a continuous model. An example of a line-of-sight problem solved on a discrete visibility model is described in [13]. This example shows how a visibility problem can be formalized as a graph-theoretic problem. The design and development of ecient and \practical" algorithms for computing a continuous visibility model is still an open research issue. Incremental algorithms are suboptimal, but still 30
easier to implement. The incremental randomized algorithm for computing the lower envelope of triangles and the algorithm for acyclic TINs presented in Section 7 seem to be interesting because of their practical applicability Both algorithms have been successfully implemented and experimented). While algorithms for hidden surface removal on a terrain could be in principle generalized to computing a continuous visibility model by considering a sphere centered at the viewpoint, most of the algorithms developed in the computational geometry literature are more of a theoretical interest than of a practical impact. Algorithms used in computer graphics [17] are image precision algorithms, i.e., algorithms operating at the resolution of the image and not of the objects in the scene. Such algorithms cannot be extended to solve the continuous visibility problem. Finally, an open research issue consists of computing visibility information on hierarchical terrain models. Such models (see, for instance, the hierarchical TIN de ned in [11]) have encountered a lot of interest in the GIS community because of their capability of representing a topological surface at increasingly higher level of detail. A fundamental goal of our research is to develop ecient algorithms for point, line and region visibility on hierarchical TINs.
Acknowledgement The support of the Italian National Research Council (CNR) under a contract on \Data Structures and Algorithms for Representing and Manipulating Geometric Entities" is gratefully acknowledged.
References [1] Allen, D.L., 1986, Visibility in two-and-half dimensions, Master's thesis, Rensselaer Polytechnic Institute, Troy, New York. [2] Atallah, M., 1989, Dynamic computational geometry, In Proceedings 24th IEEE Symposium on Foundations of Computer Science (Baltimora: IEEE Computer Society), 92-99. [3] Aho, A.V., Hopcroft, J.E., and Ullman, J.D., 1974, The Design and Analysis of Computer Algorithms (Reading, MA: Addison-Wesley). [4] Boissonnat, J.D., and Dobrindt, K., 1992, On-Line construction of the upper envelope of triangles in