203
Applications
Triangular Irregular Network Generation and Topographical Modeling Yih-ping H u a n g Department of Civil Engineering, Feng-chia Unwersity, Taichung. Taiwan A triangular irregular network (TIN) is created by linking triplets of nodes to form non-overlapped triangles and is suitable for modeling natural complicated topography. This paper presents an efficient network generation method which decomposes a domain into small cells (rectangular grids) to avoid exhaustive searching of points or lines (i.e.. avoid any global process), and minimizes process steps by using a shape parameter to avoid triangles with extreme angles. A shape correction method is then imposed to optimize the network, Using different size of cells and shape parameter will result in the effect on the final mesh quality. CPU time required, and errors induced are studied. This methodology can also handle constrained problems with prespecified segments, holes, and boundaries in a model; furthermore, the functions of user-defined cell size and shape parameter can result in different outcomes and provide alternatives for an user to process a problem.
Kevwords: CAD. Cell, DTM, Mesh generation, Shape parameter, Topographical modeling. Triangular irregular network,
Yih-ping Huang was born in 1953 in Taiwan and is now the chairman of i the Department of Civil Engineering of Feng-Chia university. Taichung. Taiwan. He attended the Cheng-Kung : university at Tainan, Taiwan. received his BS degree from the Department of Civil Engineering in 1975, and his MS degree from the same department in 1977. In 1979, he entered the Departb ment of Civil Engineering at Cornell University, Ithaca, NY, U.S.A., where he earned a PhD degree in 1983. He returned to Taiwan and became an associate professor at Feng-Chia university since then. Huang's research interests include computer-aided geometric design and modeling, finite element analysis, and geotechnical problems, ~/
Elsevier Science Publishers B.V. Computers in Industry 12 (1989) 203-213 0166-3615/89/$3.50 .~ 1989 Elsevier Science Publishers B.V.
1. Introduction A wide variety of computer methods are available for constructing irregular computational grids and are reviewed by Thacker [13]. In triangle generation, the Voronoi diagram is both an extremely versatile tool for the solution of some fundamental proximity problems and an exceptionally attractive mathematical object in its o w n [12]. In many cases the triangulation problems are o f a constrained nature, t h a t is, a set o f edges, holes, and boundaries may be prespecified in the problem statement, which may frustrate many existent triangulation methodologies. In constrained triangulations, it can be decomposed into simpler polygonal regions that can be easily triangulated [5]. To have human intervention in the choice of a proper path for triangulation generation is s o m e times desired. In digital terrain model (DTM) techniques. there are t w o primary forms of representation. One is that of rectangular grids which are generated by rounding off known data points to the nearest grid point and then interpolating to all unassigned grid positions. The other one is the triangular irregular network (TIN) which is created by linking triplets of nodes and maintaining pointers from each triangle to its three neighbors. The advantages of using TIN have been described by Mirante and Weingarten [11]. e.g., being able to produce a m o r e a c c u r a t e surface representation with less data storage, and also being capable of describing almost any complex surface, Traditional manual work has to rely on manmade contour maps to interpolate topographically related information. This process does not easily provide a c c u r a t e and consistent results and is also a time-consuming process. The use of TIN in topographic modeling is to access original data directly from the generated triangles, and then the
204
Applications
Computers in Industry
topographically related information can be i n t e r polated from the TIN model. Those procedures concerning slope, area, cut/fill volume computation, and 3-D object representation will be described in this paper. The Taipei Zoological Garden site at Muh-Cha (170 hectares with 1000 surveyed points) is used as a benchmark problem for demonstration and study.
/input
: c o o r d i n a t e s of P o i n t s , bounda~'.v /
lines, n u m b e r o f cells and Y-direction
/
/
along
X-direction/
/
1 II
[
divide
I cells
the w h o l e
domain
into
homogeneous
and s e t u p d a t a - b a s e
| parameter to guarantee an acceptable triangle is selected in a cell
2. M e s h Generation Methodology
|
Triangulations of a given set of points are not unique. Usually, the following steps are included (see the work done by Little [101, Lawson [8],
shape c o r r e c t i o n : to optimize t h e shape or a ~ e n e r a t e d TIN m e s h mesh evaluation : to compute the quality of a model
Barnhill and Little [2], etc.): (1) Specify the boundary and interior points, a n d / o r constrained conditions. (2) Create an initial triangulation (with or without preprocessing) (3) Optimize the whole mesh. One can use Lawson's exchange algorithm with the criterion to minimize the maximum angle in a triangle over all triangulations and maximize over all angles in a triangulation network, The methodology proposed in this paper is to use the range search concept [3] to set ranges in a domain in order to narrow down required searching areas. Then one can start from a base line to
.............. i
~I
prespecified
I
points
I
I~,
t
L
,./- / " /
1~ _ .-
/,'~L~
!
7
~
~
. . . . .
......
,r . . . . . .
,!
i 1"~-/prespecified
'
T
----
, -
't,
I
I
~-
,'-
,
I
:
:
i
-Ti
find an available point to generate an acceptable triangle quickly by using a user-defined shape parameter. A final mesh is accomplished by optimizing the generated mesh with shape correction, Figure 1 is the flow chart of the procedures for this methodology. The procedures may be described as follows: (1) Divide the whole domain into equal-size cells (see Fig. 2, where six by six cells are assigned). The assumption made here is that in general a base line is located within the cell and an
.
/I
~'/'
-.,-,'- . . . . . .
,I /
-
Fig. 1. Flow chart of the proc,edures used in this stud'<.
lines
--
',,
7 L - -
,~-
,
.I
I
',
i~[~"----~
. . . . . . .
4
t
~
?
,-,
-
,
prespecified
',
boundaries
_ _
r'-F !-7-i
-
"-
-- "'-~',.',~'I"I-- --
I I £
i
i
I prespecified
I
I
I
hole~" !
",, i-
I
//
-~
-
__I
Fig. 2. Problem with predefined boundaries, points, lines and holes; a six by six grid of homogeneous cells is assigned (dotted lines).
Computers tn Industo'
Y. "P. Huang / Triangular Irregular Network
205
bounded angle~
Fig. 3. Shape parameter. From a base line AB an available point is sought to form a triangle. The bounded angle ACB of this triangle has to be larger than a preset value: the shape parameter.
/ /
t
~
/ Fig. 5. Two acceptable triangles (rightl versus one good and one very bad triangle (left).
"available" point can be found for this base line to form an acceptable triangle whose quality is better than a pre-set value (i.e. the shape parameter). Otherwise one can select the point within the cell which can be used to form the "best" quality triangle with this line. In case no point in a cell can be used for the base line, one can enlarge the search area to the nearby cells until at least one available point can be selected. Then one can pick the point which can form the best triangle with this base line. (2) Generate triangles by connecting a base line (starts from a boundary segment) with a point to form a triangle without any other point inside it and without intersecting with any existing line segment. A general rule used for determining "active" base lines (i.e., those that can be used to search a point to generate a triangle) is that a boundary segment must be occupied by a triangle, A line segment inside the domain should be shared by two triangles, while predefined segments are not used as base lines for the generation of triangles. Predefined segments can be specified in a domain to simulate ridges or break lines, etc. A polygon formed by predefined segments can represent a hole in a domain, In order to select one of the nearest neighbor points of a base line to form an acceptable triangle quickly, a shape parameter (see Fig. 3) is used to guarantee that the angle bounded by a base line and a point be greater than a certain value. The influence of different shape parameters and cell c a
sizes on triangulation generation will be discussed in the next section. (3) Shape correction. Mirante and Weingarten [11] introduced a method to optimize the shape of a mesh. Figure 4 shows two triangles (ABC and ABD) that form a convex quadrilateral. If the distance between the two common nodes (AB) is greater than the distance between the two unique nodes (CD), then the triangle indices are switched (changed to ACD and BCD). This process is repeated until an entire pass through the data base produces no changes. However. a checking has to be included in the above process to avoid changing two acceptable triangles into one "good" and one "very bad" triangle as in Fig. 5. The reason for this is that in the former case (right-hand side in Fig. 5 ) t h e interpolation, using the shape function as described in equation (3), from the three nodes of a triangle to an interior point will be more evenly weighted. Note that the boundary and prespecified segments should be ignored in the shape correction process. (4) Network evaluation. In this paper the quality of a triangle is defined as the ratio of its area versus the area of an equilateral triangle with the same total edge length. This value is used to see how far away a triangle is from an equilateral triangle. Equation (1) is introduced to evaluate the quality of a triangle and the equation (2) is used to represent the quality of a TIN model in a domain. Quality of a triangle = (the area of an equilateral triangle with the same total edge length as the triangle)/(area of the triangle). (1)
~'
Quality of a model = ~".(quality × area of a triangle)/(total area of a domain). (2)
Fig. 4. Shape correction process. Starting from two triangles ABC and ABD0 if CD > AB then switch the indices of the triangles to form two new triangles ACD and BCD.
The comparison of the resulting quality of a model with errors induced in this model is made in the following section.
206
Applications
Computers in Industry
3. Network Evaluation
creases search time in the triangle generation. Similar behavior can be expected in TIN model generation as one sets different cell sizes in process. Figure 7 shows the results of using different numbers of cells (5 x 5, 8 x 8, 11 × 11, and 15 x 15) and shape parameters (0.05, 0,1, 0.2, 0.3, 0.4 and 0.5 rad) to generate TIN models for the Taipei Zoological Garten site. Among the cell sizes used, the 11 x 11 case requires the least CPU time. With a preset cell size, using a small shape parameter (greater than 0.05 rad) can result in a minimum processing time and higher quality (worse triangle network) for the final model. However, if a much smaller shape parameter (say less than 0.05 rad) is introduced in TIN model generation it will push up CPU time and quality. In general, the quality of the final TIN mesh is proportional to the number of cells used; i.e., the use of a small cell size (small area for each cell during triangle generation) can turn out to decrease the quality of the final model. With a preset cell size, the use of a different
Based on the topographical model used in this study, several experimental tests are performed to study the relationships among CPU time, error, cell size, mesh quality, etc 1. The test set for this study is shown in Fig. 2 with boundary lines, surface points, prespecified segments and holes. Figure 6 shows a histogram of elevation points. To achieve the best performance in TIN network generation, a compromise has to be made in the size of the threshold angle for the shape parameter. If one does not control the quality of the generated triangles (i.e., use a small angle for the shape parameter) during mesh generation, very thin triangles will be created. This would result in increasing search time in later triangulation processing, and may introduce truncation errors, On the other hand, if one uses a high value (i.e., a large angle) for the shape parameter, then it inJ The host computer used in this study is a IBM P C / A T compatible machine 10 MHz zero wait state with 80287-10 accelerator, and output graphics created through an EGA card and monitor. MS-DOS and MS-FORTRAN is used as
shape parameter (larger than 0.1 rad) s e e m s t o have no obvious influence on the quality o f t h e final model. This suggests that in order to achieve
O/S system,
/~
5x5
/
{minutes}CPU
.-"
~/
~ .'" ...-"
52
t - t o 15x15
."
48
/\ ~ /
." 8x8
.., °
. - ."
-
o.~./
/" i oi
°
36 [
Quality
I
t 0.05 valuel: 1.5 ~'~
I
I
0.I
I
0.2
0.3
i
,
0.4
I
0.5
J
(radius)
shade parameter
| • |
1 2
/
°-'~° "*/
" " - ..~"f~-'-"--.
l ~
.....
0.05 0.I
0.2
Fig. 6. Variation of the elevation at each data site.
~". . . . . .
0.3
--
...... A. . . . . .
0.4
411xll ~ 8x8
0.5
L
Computers tn Industry
Y.-P. Huang / Triangular Irregular Network
207
elevation" (meters)
....
leG.oo-
1 ,t.~. OO ,
.
.
.
..
., ;
102.00-
•
°
', :" ' . ,
,
BO.O0-
"
." .
•
'
1B.O0
'
O0
.
'
'~,t,.
'."
:
,
" ,'
I~
. ,
'' 1' ' ' 275.00
,
,'
'
'
'
,
•
'
,
'
,
,
•
.
'
,. '
'
~,
".
.'
; ' .
"
."
,
,
.
.
o"
.
' '1' 550.00
825.100
I 1100.00
..
•
.
•
.
.
.
.
.
o
'
.
.
.
. '
o.
,
,
~. °
1375.]00
",
'
'
..:,:.I,
"
'"..
'
. ,
I 1850.00
. ' . .
°
°
"
'
' '
,
'.
' ' t
.
.
't '
~ $
.
,".".' :" ' ..'t.,
" "
,
,
.~" •
.
•
.,
, '.
.
.
. .,.,';, "': "'°
'/ ,' - '_':.;",."...",',
,
0
.
: . ..~
,,
.
•
t '
,
'' i.
...
.
',
•
. . . . .
?..'
o
.
;.','..
' °"
" "~,"
,
.','
'. , '
'.
,
' .~
''
.
'.', o'
,,
,,,:, '
..'
.
. , .
:
'
: '
°
'
.
~'
'
..
'
.
,'
.
.. .
:'1.t °
";.'
. .,
t
.',"
r,
,
°
;.,.,t. ~.t, ",'
~ ''"'"
.
.
•
C , . ' ,
'
t.
• '
.
.%
't..,. e'~
o •
.
'
'
o,
t"."
° .
......'...
, .t , • ''
'I' 0t
,
,.,. . , ' ' " :, ' '..
,
." . . . . . . . . .
''.;,, .
•
.
,
o-,
. ir
,
~ o
A-CIIST.S,
1 1925.00
nce
I 2200.00
F i g . 7. R e s u l t s o f u s i n g d i f f e r e n t n u m b e r s o f c e l l s a n d s h a p e p a r a m e t e r s t o g e n e r a t e t h e T I N m o d e l o f t h e T a i p e i Z o o l o g i c a l G a r t e n site.
better performance in both CPU time and quality, one can use a smaller shape parameter. However one should take caution that it cannot be too small (say less than 0.1 rad). For an 11 X 11 cell size with a shape parameter of 0.1 rad, Fig. 8 shows the TIN model (a) before, and (b) after shape optimization, For three fixed values of the shape parameter (0.1, 0.2 and 0.5 rad), Fig. 9 indicates the influence of cell size on CPU time and quality• The best choice of cell size is between 10 x 10 and 16 × 16; i.e., to have on average about eight to ten data points in a cell could serve as a guide line for selecting a proper cell size. Many criteria have been proposed as to what constitutes a "good" triangulation for numerical purposes [6]. It is obvious that in modeling a natural surface which cannot be represented by any mathematical model, a good way to demonstrate the quality of a generated TIN model is to compare it with a professionally surveyed DTM of the same area [15]. Equation (2) is used to test its suitability in representing the quality of a TIN mesh for the benchmark problem in this study.
Several cases are chosen and their quality values and resulting error are plotted in Fig. 10. The errors shown in this figure have been measured by computing the average value of the elevation difference along three arbitrary profiles in a professionally surveyed D T M of an area, whose height values can be assumed as " t r u e " values, versus the corresponding positions in a TIN model. The plot demonstrates that (2) is suitable for representing the quality of a TIN model for the case used in this study• The computational complexity for this method is not only a function of cell size and shape parameter but is also affected by the data distribution and the number of data points. Six different cases are used to study the effect of the number of data points on CPU time. The data sites for those cases are selected randomly (according to the field topography). For each case, the representative cell sizes and shape parameter are chosen by using an optimized value from a series of tests. Figure 11 shows that the computational growth rate versus the number of data points ( N ) is a N25 relation.
208
Applications
Computers m Industry
a
b
Fig. 8. TIN network of the benchmark problem (a) before (quality value 2.9) and (b) after shape optimization (quality value 1.3).
Computers tn Industry
K-P. Huang / Triangular Irregular Network
209
\
\
CPL (m i n u t e s
,\
\ 60
\
'0.5 \
't \0 0.2
X •
j,o
\
40
/
~ •
,
value
number
of c e l l s
alon~
X- and ~'- d i r e c t i o n s
1.4 0.I .A - > '
1.3 o0. 5
1.2
.'t-.
-*~
Fig. 9. Influence of shape parameter and number of cells on CPU time and quality value.
4. Contour Map Generation Several formulas for generating smooth surfaces over arbitrarily spaced data points have been developed [1,4,14], which all emphasize the smoothness and continuity in a triangle network. In general, natural topography is too complicated to be described by any mathematical equations because
they assume too much about the smoothness of a given terrain. Furthermore, for a problem with prespecified segments, boundaries, and holes, it turns out even more difficult to use any existent mathematical formulas for modeling.
CPU (minutes)
error (metersl
150
5
x x
4
//
100
x
x/
X
/
3
/
/
//
//
2
x
50
x" s/
1
x
~" S x s
'
1.2
'
'
1.3 1.4 Quality value
Fig. 10. Error versus quality value.
' "
1.5
400
bo
12 number of data points
L_
1600-
Fig.ll. C P U time versus the n u m b e r of data points used.
210
Applications
Computers in lndust~
'~ ~ ~ ~ e o ~
270.00 --
21o.1o
°° -- 31°' i]o.11 --
17o.oo
Po.oo ~.&~.[-
I
:
1108.
Fig. 12. Contour map.
In this system, any information for a model is presented by its TIN model. In a triangle with the three known vertix values, any contour line with a specific value can be found by linking the corresponding positions on the edges; these positions axe obtained by linear extrapolation from the two known nodal values at the extremes of the edge.
Figure 12 shows a contour map of the example case used in this study. Figure 13 shows a profile cut, the process of generating a profile is similar to that of creating a contour map. One can first specify a line in a map, and then the intersection points (and their corresponding elevation values) of this line with
k Fig. 13. Profile cut.
Fig. 14. Slope indication.
Computers tn lndust~." ......
Y. -P. Huang / Triangular Irregular Network
_
211
,~¢ t ~*,* " ~'
~41
,3(0,~/~ ~
.~.
. .
1 (0,0)
.
.
.
.
.-o-$
2( 1.0)
Fig. 16. Testing the relationship between a point and a triangle (points 1, 2 and 3 are known; point i is a grid point).
• - -, ~' ................ Fig. 15. Direction indication, the line segments in a TIN model can be computed. Those intersection points are then connected in sequence to produce a profile cut. Figure 14 is a map (the original is in color) with slope indication, which is interpolated from the triangle elements in a TIN. The average slope of a model can be obtained by summing the products of the slope value in a triangle and its area, and then dividing the sum by the total area of the model. Equally, representation can be extended to direction indication as shown in Fig. 15.
of complex terrains. But this type of model assumes too much about the smoothness of a given terrain, and cannot reach accurate numerical resuits in information interpolation, such as slope, profile cut, etc. For a 3-D object representation, this study uses a rectangular grid for modeling and for obtaining information in each grid position from a generated T I N model. An interpolation method is used for this process; first the triangle is found where the grid point is located, and then the values of the three vertices of this triangle are used to compute the required information. The following equations are used in computation: P, = P1 + s( P 2 - P~ ) + t( P 3 - P1 ), [ P2 - PI -1 (s, t) = (P, - PI )" t 1'3 Pi
(3) (4)
value, = value 1 • (1 - s - t)
5. Three-Dimensional Object Representation An advantage of the rectangular grid representation is that it can produce realistic impressions
Fig. 17. Three-dimensional model.
+ value 2 • t + value 3 • s,
(5)
where P, is the vector of point i; s, t are the natural coordinates (0 < s, t < 1); and "value" is
212
Appfications
Computers in lnduato'
•
t
,i
1
..................
,ak
J
Fig. 18. Original model (left) and land-grading model (right).
the value (often elevation) of a point to be cornputed, As shown in Fig. 16, (4) can be used to test whether a point is within, on a boundary, or outside a given triangle. For a point P, to be inside a triangle, the following conditions must be satisfied 1.0 > s > 0.0 1.0 > t > 0.0 s + t < 1.0
The 3-D model in Fig. 17 is a perspective projection from a user-specified location.
6. Map overlay Modeling The difference between an original model and a designed model of a terrain is often important in land-grading design, which can be represented by the elevation difference between them. A new map
r
L~
.
_
_
_
Fig. 19. Map showing the elevation difference between the ori$inal model and the land-grading model.
Computers tn IndustD'
is generated for this purpose by the following process. An original and a land-grading model are shown in Fig. 18 [7]. A new map can be created as shown in Fig. 19 by using the T I N mesh of the original model but with the elevation value at each vertex changed to the elevation difference between the original model and the interpolation value from the T I N mesh of the land-grading model by using (5). This new map can be used to illustrate cut/fill area and volume changes. The interior lines in Fig. 19 represent balance lines, i.e. no difference in elevation along these lines.
7. Conclusions This study proposes an efficient mesh generation methodology for automatically generating T I N from scattered data points with or without constrained conditions in a terrain. Range search concept is included in this study to set cells in a domain in order to search for a point to form an "acceptable" triangle with a base line, which can avoid global processing, and a shape parameter is introduced to further speed up the searching process. After a T I N model is formed, a shape correction is introduced to optimize the mesh quality. By using a benchmark problem, the evaluation of a T I N model including the relationships among cell sizes, shape parameter, mesh quality, CPU time, and e r r o r s a r e studied, The interpolation of topographical related information from a T I N model is discussed in this study which includes contour map generation, profile cutting, 3-D object representations, slope and direction indication and computation, and map overlay modeling, etc. With user-defined cell size and shape parameter, this study can create different T I N meshes for a problem. Because the triangulation process is confined in a cell, this method can be further improved by using a parallel process in triangle generation.
Y..P. Huang / Triangular Irregular Network
213
References [1] L. Bacchelli-Montefusco and G. Casciola. "' Using interacrive computer graphics for fitting surfaces to scattered data". I E E E Trans. Comput. Graph. Appl.. July 1984, pp.
43-45. 12] R.E. Barnhill and F.F. Little. "'Three and four-dimensional surfaces". Rocky Mountain J. Math, Vol. 14. 1984, pp. 77-102. [31 I. Carlbom, "An algorithm for geometric set operations using cellular subdivision techniques". IEEE Trans. Cornput. Graph. Appl., May 1987. pp. 44-55. 14] Z.J. Cendes and S.H. Wong. "C quadratic interpolation over arbitrary point sets", IEEE Trans. Comput. Graph. AppL. November 1987. pp. 8-16. [5] M. Garay, D.S. Johnson, F.P. Preparata and R.E. Tar'jar, "'Triangulating a simple polygon", Inf. Process. Lett., Vol. 7. No. 4. 1978. pp. 175-180. 16] J.A. George. "Computer Implementation of the Finite Element Method". Technical Report STAN-CS-71-208. Computer Science Department. Stanford University. Stan-
ford, CA, 1971. 171 Y.P. Huang, "Topographical modeling and applications". Pr,~. Int. Computer ,~vmpostum. Taiwan. 1986. pp. 113-119. [8] C.L. Lawson, "'Software for C surface interpolation", in: J.R. Rice, ed., Mathematical So/tware 111. Academic Press, New York. 1977. 19] T. Liszka, "'An interpolation method for an irregular net of nodes", Int. J. Numer. Method~ Eng.. Vol. 20, 1984, pp,
1599-1612. IlO] F.F. Little, "'Convex combination surfaces", in: R.E. Barnhill and W. Boehm, Sur/aces m Computer Aided
Geometrw Design,
North-Holland, Amsterdam.
[11] A. Mirante and N. Weingarten, "'The radial sweep algorithm for constructing triangulated irregular networks". IEEE Trans Comput. Graph. Appl.. July 1984. pp. 11-21. [12] F.P. Preparata and M.I. Shamos. Computer Geomett3'. Springer-Verlag. New York. pp. 219-257. [13] W.C. Thacker, "'A brief review of technique for generating irregular computational grids", Int. J. Numer. Methods Eng., Vol. 15, 1980. pp. 1335-1341. [14] C.Y. Wong, "'C rational interpolation over an arbitrary. triangle". Comput. Aided Des, Vol. 15. No. I. Janua.ry
1983, pp. 33-36. [151 P. Yoeli. "Computer executed production of a regular
grid of height points from digital contours". Am. Cartographer, Vol. 13. No. 3. 1986, pp. 219-299.