Вы находитесь на странице: 1из 14

Computer-Aided Design. Vol. 27. No. 3. pp. 209-222, 1995 Cowriaht % 1995 Elsewer Science Ltd Printedk &eaiSritain.

All riphts reserved 0010-44.95/95 $1o.oo+o.M)

Quadrilateral in polygonal
Barry Joe

mesh generation regions

A method for generating quadrilateral

polygonal algorithms generator. polygonal

finite element meshes in regions is presented. The method uses geometric and is based partially on a triangular mesh After a 2-stage convex polygon decomposition of the region has been obtained and the quadrilateral size

to be used in each convex polygon has been determined, a boundary-constrained quadrilateral mesh is constructed in each convex polygon starting from the interior of the polygon. Experimental results for quadrilateral meshes in three regions

are provided.
Keywords mesh generation, finiteslement method, computational geometry

Mesh generation is an important step in the finite element method for the numerical solution of partial differential equations (PDEs). In 2D, the domain or region over which the PDE is defined is subdivided into finite elements, usually triangles or quadrilaterals. Many triangular mesh generation methods have been developed, for example see the survey paper by Ho-Le or some of the other references listed at the end of this paper. There has been less work on quadrilateral mesh generation, since good quadrilateral meshes are harder to generate than good triangular meshes. However, because of the approximation error in the finite element method, quadrilateral meshes are sometimes preferred over triangular meshes2. In general, simple quadrilaterals may be strictly conuex (i.e. all four interior angles are less than 1807, triangularshaped (i.e. one interior angle is 1807, or nonconuex (i.e. one interior angle is larger than 180). Only strictly convex quadrilaterals are desired for quadrilateral mesh generation, and so, for simplicity, when we refer to a quadrilateral (with no adjective) we mean a strictly convex quadrilateral. We also introduce the word quadrilate as a short form of the phrase divide into quadrilaterals; this is analogous to the word triangulate. Recently, a few papers on quadrilateral mesh generation have appeared in the engineering literature. One approach is based on converting a triangular mesh into a
Department

of

Computing

Science,

University

of Alberta, Edmonton,

Alberta, Canada T6G 2Hl


Paper received: 21 June 1994. Revised: 14 September 1994

quadrilateral mesh by combining pairs of adjacent triangles (see, for example, Reference 3). However, even if there is an even number of triangles in the mesh, it is possible that the union of two triangles is a nonconvex quadrilateral or that isolated triangles remain (see Figure 1). It is not clear that the heuristic procedures described in Reference 3 are always successful in producing a quadrilateral mesh. A more common approach is based on the advancing front technique where, given mesh points generated along the boundaries of the region (or subregions), quadrilaterals are generated from the boundaries inwards (see, for example, References 2 and 4-6). The construction of each quadrilateral in this approach can be quite inefficient because of the need to check for a well shaped quadrilateral and determine that it does not intersect the different fronts. From the nonalgorithmic heuristics used in these methods, it is not clear whether a valid quadrilateral mesh can be produced for all inputs. A third approach uses the medial axis transform to subdivide a region into simple subregions having 3-5 sides, an integer programming technique to determine the number of mesh edges to put on each subregion side, and mapping algorithms to generate the quadrilaterals in each subregion 7V8.Since the mapping algorithms are not geometric and a subregion may be nonconvex and have curved sides, it is not clear whether nonconvex quadrilaterals can be generated for some inputs. In this paper, we describe a quadrilateral mesh generation method for polygonal regions which uses efficient geometric algorithms and is based partially on our earlier triangular mesh generator*. We believe that the use of geometric algorithms leads to a faster method and makes it easier to see that a valid quadrilateral mesh is generated for arbitrary polygonal regions. The input to our 3-stage method consists of the polygonal boundary curves of the region plus the desired number of quadrilaterals in the mesh and other scalar parameters. The polygonal regions may contain different types of internal interfaces as described in Reference 11. The first stage decomposes the region into convex polygons such that small angles are avoided. The second stage automatically constructs a mesh distribution function from the length scales of the subregions (alternatively, a user-defined mesh distribution function may be specified, for example to allow for smaller elements near singularities of a PDE problem), and

Computer-Aided

Design

Volume

27 Number

3 March

1995

209

Quadrilateral

mesh

generation

in polygonal

regions:

B Joe

vertices, E, boundary edges, Ei interior edges, and Q quadrilaterals. Let V= V, + Vi, E = E, + E,, and H be the number of holes in the polygonal region containing 9. By Eulers formula for connected planar graphs12, V-E+(Q+H+1)=2 From the simple observations13 Q = (2Ei + E,)/4
Figure 1 Example of combining triangles [The union of Ac6cgc,, Ar,r,r7 is a nonconvex quadrilateral; the union of Ac,o,r, with one of its three adjacent triangles leaves either Ar, t 4t2 or AL~L~v~ both) as isolated triangles.] (or

that

E, = V,

it follows that E = 2(V+ H - 1) Q=


VfH-

Vi,/2

further subdivides the convex polygons into smaller convex parts based on this function, so that a uniform quadrilateral size can be used in each part. In the third stage, mesh vertices are generated on each edge of the convex polygon decomposition, and then, in each convex polygon, quadrilaterals are generated in a shrunken version of the polygon and then in the strip between the boundary of interior quadrilaterals and the boundary of the convex polygon. The first two stages are the same as the triangular mesh generator described in Reference 9, and so this paper only describes the algorithmic details of the third stage. The third stage is a quadrilateral version of the algorithm in Reference 10; it requires a few extra steps because of the greater difficulty of tiling convex polygons with quadrilaterals. Our algorithm is designed so that any convex polygon with an even number of mesh edges on its boundary can be quadrilated (without splitting any boundary mesh edges), and the quality of the quadrilaterals in a convex polygon improves as a smaller quadrilateral size is used, since the quadrilaterals in the shrunken interior are guaranteed to be well shaped. This paper is organized as follows. In the second section, some preliminary results are given; we show that any convex polygon with an even number of boundary mesh edges can be quadrilated, and inroduce a quadrilateral shape measure. In the third section, an algorithm is given for generating mesh vertices on the edges of the convex polygon decomposition. In the fourth section, an algorithm is given for generating mesh vertices, mesh edges, and quadrilaterals in a shrunken interior portion of a convex polygon. In the fifth section, an algorithm is given for subdividing the strip between the shrunken interior quadrilation and the convex polygon boundary into convex subpolygons. In the sixth section, an algorithm is given for subdividing a convex subpolygon into strictly convex or triangular-shaped quadrilaterals without adding extra vertices on the boundary. In the seventh section, we describe how to modify any triangular-shaped quadrilaterals generated by the algorithm in the sixth section. In the eighth section, experimental results for three polygonal regions are provided. In the ninth section, concluding remarks are given.

1 - Vi,/2

A consequence of these formulae is that a quadrilateral mesh must have an even number of boundary edges. We now examine whether an even number of boundary edges is sufficient. In other words, given a simple polygon (possibly nonconvex) with an even number of mesh edges on its boundary, is it always possible to quadrilate the polygon (without splitting any boundary mesh edges)? References 5 and 8 seem to claim without proof that such a quadrilation is always possible, but it is not clear whether they allow splitting of given boundary mesh edges. For example, is it possible to quadrilate any nonconvex quadrilateral without adding extra vertices on the boundary? We believe that the answer to this latter question is yes, and that this can be used in the proof for the general case of a simple nonconvex polygon. For our method, we only need to prove that a quadrilation is always possible in the case of convex polygons; this is done in Lemma 1 and Theorem 1.
Lemma I: Any convex

without

adding

qualilateral P can be quadrilated extra vertices on its boundary.

Proof: If P is strictly convex, then the quadrilation consists of P itself. Suppose P is triangular-shaped. Let pl, z;~, I:~, cq be its vertices in counterclockwise order with the angle at vq being 180. It can be shown that P cannot be subdivided into four or fewer quadrilaterals, but P can be subdivided into five quadrilaterals as follows (see Fipre 2). Let 0 < fl < 1 be defined by vq = flol + (1 - B)v,, 1 = min( l/4, p/2), c(~ = l/4, cl3 = min( l/4, (1 - /?)/2), and

(1)

PRELIMINARIES We first look at the relationship between the number of vertices, edges, and quadrilaterals in a quadrilateral mesh 2. Suppose 3 has V, boundary vertices, Vi interior
u3 v4 Vl

Figure 2 Subdivision of triangular-shaped quadrilateral c~L~c~~~ into quadrilaterals ~~t~~~r~. P~~~c,L~. L~L~P~~,, c~~,P~c~, LI~V~C,L~~

210

Computer-Aided

Design

Volume

27 Number

3 March

1995

Quadrilateral

mesh

generation

in polygonal

regions: B Joe

By construction, Av,v,v, is a counterclockwise-oriented triangle in the interior of P, with edge v506 parallel to v1v2, v6v7 parallel to vZv3, and u7vg parallel to v3v1. Also, vg is in the interior of Av,v,u,. This implies that the two angles at each of vl, v2, v3, v4 and the three angles at each of v6, us are all less than 180, and Lv,v,v, < 180, Lv,v,&j < 180, Lv,U,v, < Lv,v,U, < 180, and L usv,v3 < L ugv.,v3 < 180. Simple algebraic manipulation yields v8 = [(Sfl + l)v, + v2 + (6 - 5&,1/S Since (6 - 5/3)/8 > (1 - /?)/2 >, tlJ, it follows from the barycentric coordinate corresponding to v3 that vg and v3 are on the same side of the line through vgvg, and so L usvgvg < 180. Similarly, LV~V~V~< 180. Therefore quadrilaterals u1u2v6u5, 2)2v3u7ug, v3U4VsV7ru4ulc5U8 and vgv6v,vg are each strictly convex. 0 Theorem I: Any convex polygon P with an even number of boundary edges (consecutive edges may be collinear) can be quadrilated without adding extra vertices on its boundary. Pro& Let P have 2n edges, n >, 2. By Lemma 1, it suffices to show that P can be subdivided into convex quadrilaterals, possibly triangular-shaped. The case of n = 2 follows from Lemma 1. Suppose P has 2n edges, n b 3, and let the vertices of P be vO, vl,. . . , uZn_ L in counterclockwise order. Without loss of generality, suppose the vertices are labelled so that vOv, is the diameter of P (the longest line segment inside P). Then 0 < m < 2n and the interior angles at v0 and v, are each smaller than 180. If m > 2 and 2n - m 2 2 then the edge v2v2n _ 1 subdivides P into a convex quadrilateral v~v~v~v~~_ 1 and a convex subpolygon P with 2n - 2 boundary edges. If nt = 2 (and 2n - m > 2) then the edge subdivides P into a convex quadrilateral UlOZn-2 v,,v~v~~-~u~,,_ 1 and a convex subpolygon P with 2n - 2 boundary edges. Similarly, if m = 1 or 2n - m = 1, an edge can be chosen to subdivide P into a convex quadrilateral and a convex subpolygon P with 2n - 2 boundary edges. If m = 1, choose edge v1~2n-2 if L1,t:2,. . . , cZn_ , are not collinear; else choose edge u0v3. If 2n - m = 1, choose edge v2v2,,_ 1 if v2, vj, . . . , vZn- 1 are not collinear; else choose edge u,,vZn _ 3. In all cases, the subdivision produces a convex polygon P with positive area and 2n - 2 boundary edges. By recursively repeating this process with P (in place of P), a subdivision of P into convex quadrilaterals is obtained. 0 Note that the proof of Theorem 1 shows that a quadrilation of P exists; the construction in the proof does not yield a good quadrilation. Algorithms for constructing better quadrilations are given in later sections. However, the construction of Equations 1 and Figure 2 will be used later. We use the following data structure for a quadrilateral mesh. The coordinates of the mesh vertices are stored in an array 1/C where VC[i]. x and VC[i] .y are the coordinates of the ith vertex. The quadrilaterals are stored in a 2D array QUAD where QuAO[i,j], 1 d j < 4, are the indices in I/C of the four vertices of the ith quadrilateral in counterclockwise order. We now introduce a quadrilateral shape measure ,u.

Let P be a strictly convex quadrilateral with vertices v,, and vd in counterclockwise order. Simply taking lb>Cc, the minimum of the four angles of P is not a good measure since all the rectangles have an optimum measure value and a quadrilateral with an angle near 180 can have a good measure value. We need a measure which also takes into account the lengths of the edges and the largest angle. Our measure p is defined as follows. There are two ways to triangulate P; either diagonal v,G,or vbvd can be added. If the four vertices are not cocircular, then one of the two triangulations is a Delaunay triangulation and has a larger minimum triangle angle than the other triangulation14; let .y be the nonDelaunay triangulation. If the four vertices are cocircular, then both triangulations are Delaunay triangulations and have the same minimum triangle angle; let y be either triangulation. We define p to be the minimum triangle angle in .?. Suppose the vertices have been relabelled so that u,,vd is the diagonal in .y. Then p can be calculated as

180 -

L I:,L,,v~ -

L c,,vdva,180 - L v,,u,,v, -

L v,v,,v~) (2)

Note that a square has a p value of 45, the p value of a rectangle or quadrilateral approaches 0 as one or two edges become much shorter than the other edges, and a quadrilateral with an angle near 0 or 180 has a p value near 0. The maximum p value of 45 is uniquely attained by the square, since any rectangle which is not a square clearly has a ~1value of less than 45, and if a quadrilateral has an angle of less than 90, then the diagonal splitting this angle yields a triangle angle of less than 45. If the formula in Equation 2 is extended to triangular-shaped and nonconvex quadrilaterals, i.e. the diagonal is chosen to produce an invalid triangulation, then the ,u value of a triangular-shaped quadrilateral is 0 and the P value of a nonconvex quadrilateral is less than 0 (assuming LV,,V~V~ taken as larger than 180 is if Av,v,,v,, is oriented clockwise).

GENERATION VERTICES

OF

BOUNDARY

MESH

The output of the first two stages of our method, consists of a decomposition of a given polygonal region into convex polygonals P,, P,, . . . , P, plus a quadrilaterai size hi for each Pi (see Figure 3 for an example). The hi are determined from a mesh distribution function and the desired number of quadrilaterals No in the entire polygonal region, and satisfy the constraint l/2 d hi/hj 6 2 for all adjacent polygons Pi, Pj. This constraint allows for a gradual change in quadrilateral size when going between adjacent polygons. In each polygon Pi, our goal is to generate quadrilaterals whose side lengths are close to hi, areas that are close to h?, and p values that are as good as possible. In this section, the description of the third stage of our method begins with the algorithm for generating mesh vertices on the boundary edges of the Pi. By Theorem 1, each Pi must contain an even number of boundary mesh vertices. The algorithm for generating the boundary mesh vertices consists of the following three steps.

Computer-Aided

Design

Volume

27 Number

3 March

1995

211

Quadrilateral

mesh generation

in polygonal

regions:

6 Joe

p2

on one polygon of each parity, keep e in Li,,. Note that an odd polygon may become even but not vice versa, and so each edge in Lint contains two even polygons or one polygon of each parity at the end of Step 2.1.
Pl

(2.2) For each edge e in a sequential traversal of Lbndr if e is incident on an odd polygon, add 1 to n, if n, = I or (e(/n, 3 h,; else subtract 1 from n,.
2

Figure 3 Example of decomposition of polygonal region into five convex polygons P,. . P, [The quadrilateral sizes computed from N, = 100 desired quadrilaterals are h, = 1.7847, h, = 1.5260, h, = 0.6937, h, = 0.8924, h, = 0.7630(the rectangle bounding the region has the dimensions 20 x IO). The vertices of the convex polygon decomposition are circled. The solid circles indicate the boundary mesh vertices generated by the algorithm in the third section of the paper.)

(1) For

each edge e in the convex polygon decomposition, compute I;, to be the nearest length to h, which is a submultiple of lel (the length of e), where h, = hi if e is incident on only one polygon Pi and h, = (hihj)12 if e is incident on two polygons Pi, Pj. The formula for computing kC is given in Reference 10, p 524. Set n, = [ei/& to be the number of tentative mesh edges to be generated on edge e.

(2.3) Traverse Lint again until it becomes empty. Each edge e is removed from the list and processed when it reaches the front; some edges may be added to the end of Li,, this time. If e is incident on two even polygons, nothing is done. Otherwise change n, by + 1 as above; the two polygons incident on e each change their parity, but e (which is now even) is still incident on one polygon of each parity. Let Pi be the odd polygon incident on e (after the change to n,); Pi must contain an odd edge. Traverse the edges of Pi. If Pi has an odd edge 2 that is either a boundary decomposition edge or incident on another odd polygon Pj, then change np by + 1 as above (so that Pi becomes even, as well as Pi in the latter case); else add each odd edge of Pi that is not yet in Li,, to the end of Lint (since each of these edges is incident on one polygon ofeach parity). In the worst case, all odd edges e become even, and so Step 2.3 is guaranteed to terminate. With a data structure which records the edges of each Pi of the decomposition as well as adjacency information, the above operations can be efficiently done. The worst case time complexity of Step 2.3 occurs when all interior decomposition edges are odd and each polygon Pi is traversed Ni times, where Ni is the number of edges of Pi. Thus the time complexity of Step 2 is bounded by O(&lv:). Usually, the number of times each Pi is traversed is bounded by a small constant, and so the time complexity of Step 2 reduces to O(C,NJ, which is linear in the number of decomposition edges. Note that it is possible to guarantee a worst case linear time complexity if all odd edges are simply changed to even edges, but this does not produce the best possible spacing of mesh vertices on each edge. The worst case time complexity of Step 2 does not increase

(2) Modify the integers

n, associated with the convex polygon edges so that the sum si of the M, values for the edges of each Pi is even. The modification consists of making some odd n, values even by adding or subtracting 1.

(3) For each edge e, generate np - I equally spaced

mesh vertices in the interior of e. Steps 1 and 3 are straightforward. We now describe Step 2 in more detail. Let an even or odd edge be an edge e whose n, value is even or odd, respectively, and let an even or odd polygon be a polygon Pi whose Si sum is even or odd, respectively. First, a special modification is made for polygons Pi with three edges whose si sum is less than or equal to 5. For each edge e of such a Pi, if its II, value is 1 or 3, then n, is changed to 2 so that Pi has six boundary mesh edges. This change is made to avoid the use of the quadrilation in Figure 2. Note that, when a change is made to an n, value, this also changes the sj sum for an adjacent polygon Pj (if it exists). Next, the odd interior decomposition edges (incident on two polygons) are put into a linked list Lint, and the odd boundary decomposition edges (incident on one polygon) are put into a linked list Lbnd.The two lists are processed as follows. (2.1) For each edge e in a sequential traversal of Lint, if e is incident on two even polygons, delete e delete e from Lit, and if n, = 1 or JeJ/n, >, h, then add 1 to n,; else subtract 1 from n,. If e is incident

Figure 4 Example of shrunken polygon P (the boundary of which is drawn with broken lines) inside convex polygon P, and quadrilation and closed walk C jn P [The solid circles indicate the vertices of C = t,.Ot2.L11.12.0~3.1f~J,~~h.l r4,,,rq,, L 4.hL3,5L2.4~Z.S1Z,~~2,3~1,~~1.0~ note that twoedgesoccur twice in C (the leftmost edge of the bottom mesh line and the rightmost edge on the second line from the top).]

212

Computer-Aided

Design Volume 27 Number 3 March 1995

Quadrilateral

mesh generation

in polygonal

regions:

B Joe

as the desired number of quadrilaterals No increases, and so the time spent in generating boundary mesh vertices becomes insignificant when No is sufficiently large.

SHRUNKEN

INTERIOR

QUADRILATION

In this section, we begin the description of how our method quadrilates a convex polygon P given a quadrilateral size h (we now drop the subscript on P and h). We first describe how the mesh is generated in a shrunken interior portion of P (see Figure 4 for an example). The procedure is given below; it is similar to that in Reference 10 where pseudocode is given.

-I

(1) Shrink aP (the boundary of P) by a distance of cth


to produce a smaller convex polygon P whose boundary points are each at a distance of ah from the nearest point on c3P. After trying several CI values, we decided to use a = 5/6. A linear time algorithm for constructing P, which may be empty, is given in Reference 10, pp 5 16-520. If P is empty or degenerates to a point or line segment, then the remaining steps are skipped and the algorithm in the sixth section of the paper is used to quadrilate
P.

such index exists). [For example, in Figure 4, k(1) = 0 and l(1) = 2.1 then let q(i) = m(i) and (4.2) If Xi,m(i) G Xi+l,m(i+l) r(i) be the largest index j such that xi mti) < h/2 (or r(i) = 0 if no such Xi+ l,j index exists); else let r(i) = m(i + 1) and q(i) be the smallest index j such that fi,j xi+ 1 mti+1J< h/2 (or q(i) = 0 if no such index exists). [For example, in Figure 4, q( 1) = m(1) = 1 and r(1) = 3.1 (4.3) Note that k(i) f q(i), I(i) < r(i), and do = q(i) k(i) and d, = r(i) - l(i) differ by at most 1. If do > di (i.e. Xi+ l,lciJ - Xi,k(i) = Xi,4(i) Xi+ l.r(i) = h/2), then if k(i) < m(i) - q(i) increase k(i) by 1; else decrease q(i) by 1. If do < d,, then if I(i) < m(i + 1) - r(i) increase I(i) by 1; else decrease r(i) by 1. (4.4) If d = q(i) - k(i) = r(i) - l(i) > 0 then generate d quadrilaterals by adding the nonhorizontal edges joining u~,~(~)+ and ui+ 1,lci)+j, j = j O,l,...) d. (5) Generate a counterclockwise closed walk C connecting the outer mesh vertices as follows. If only one mesh vertex is generated, i.e. n = 1 and m(1) = 0, then C consists of this single vertex. Otherwise C consists of edges on the left side (formed between consecutive si from top to bottom), followed by the mesh edges on s, (from left to right), followed by edges on the right side (formed between consecutive si from bottom to top), followed by the mesh edges on si (from right to left). The part of the left side of C between si and si+i consists of the chain of edges connecting ui,0,ui,lr ...~~i.k(ip ui+I,l(i),...,i+l,l,ui+l,~ (either k(i) = 0 or I(i) = 0). The part of the right side of C between si and si+ 1 consists of the chain of edges connecting ui+ l,m,i+r), . . ., (either q(i) = m(i) or r(i) = ui + 1 r(i)> ui,q(i)3 . . . y Ui,m(i) m(i + 1)). [For example, in Figure 4, between s1 . and and s2, the left subcham is u1,0u2,2u2,1vZ~o the right subchain is u~,~u~.~u~,~u~,~.] Note that any of the four parts of C may be vacuous (e.g. when n = l), a mesh edge may appear twice in C (in opposite directions), and C contains an even number of edges (since C contains the boundary edges of a quadrilateral mesh plus other edges that appear twice). The quadrilaterals generated in Step 4, if any, are parallelograms of area h2 with angles between (!I= arctan(2) = 63.4 and 116.6. This means the ~1values of these quadrilaterals are larger than or equal to arccos(7/(65)) = 29.7. Any nonhorizontal edge of C has a length between h and 212h since on each segment si there exists a mesh vertex within distance h/2 of the width segment w. Steps 3-5 do not have to be done sequentially; in our implementation, they are actually intermixed. The time complexity for generating the shrunken interior quadrilation and closed walk C is clearly linear in the number of edges of P and the number of mesh vertices and quadrilaterals generated. Therefore quadrilaterals of good quality are quickly generated in the shrunken polygon P.

(2) Find the direction

of the width or minimum breadth (the minimum distance between parallel support lines) of P. In Reference 15, p 29, it is shown that there exists an antipodal vertex-edge pair u, e such that the line segment w joining vertex u to the nearest point of edge e lies inside P and is perpendicular to e, i.e. w determines the width and its direction. A linear time rotating calliper algorithm for finding the antipodal vertex-edge pair L,e that determines the width direction is given in Reference 16.

(3) Generate mesh vertices on parallel lines at distance h apart inside P. These lines are perpendicular to w and centred about w (so that the distance from one endpoint of w to the first line is the same as the distance from the other endpoint of w to the last line); the number of lines is n = [I w l/h] + 1. Let si be the segment of the ith line inside P, 1 d i < n. On each Si, generate mesh vertices at spacing h centred about si and form mesh edges from consecutive mesh vertices. To simplify the description of the following steps, we assume the coordinate system is rotated so that the si are parallel to the x axis and sr is the top segment. Let ui.O,Ui:lr. .3 ui,m(i),where m(i) = Llsil/hj, be the mesh vertices on si from left to right, and let xi.j be the x coordinate of ui.j (4) If n 3 2, generate quadrilaterals between consecutive line segments si and si+ 1 as follows. (4.l) Ifxi.0 2 Xi+l.O then let k(i) = 0 and I(i) be the smallest index j such that xi+ l,j - xi,o >, -h/2 (or 1(i)= m(i + 1) if no such index exists); else let 1(i)= 0 and k(i) be the smallest index j such that xi,j - xi+ 1.o 2 -h/2 (or k(i) = m(i) if no

Computer-Aided

Design Volume 27 Number 3 March 1995

213

Quadrilateral

mesh

generation

in polygonal

regions:

6 Joe

to the left of chain uvw. The handling of the failure case is discussed at the end of this section.

Figure 5 Example uf subdivision of strip between iP Hnd C mto convex subpolygons. each containing an even number of boundary edges [The solid circles indicate the mesh vertices on it and the vertices of C. The broken-line segments are the separators involved in the subdivision. The circled vertex of C has been perturbed slightly to the left in the subdivision process. ]

i_._

p : = 0; ,/ili/ : = false repeat j : = p + 2; dmin : = y, while ~u~r,,u,, < 180 do if ~u~a,u,, > 72 and IuicOIz < dmin then dmin : = / ujuo 12;s : = ,j endif j:=j+2 endwhile if dmin = xl then s : = j - 2; f;lil: = (s = p) endif if not fhil then p : = s; set next separator to u,$io endif until i unbrOup < 180 or jail

In the general case in which C has nc 3 2 edges, the following procedure attempts to find one or two separators u,U~,~) or u,c~,~, for each uLci) or ~1~~~) to subdivide the strip into convex subpolygons. Find the boundary mesh vertex uI r,.(,) (L:~(~,)with J coordinate larger and s coordinate closest to x(u~(,)) Note that uI = u, is possible, for when I [For example, in
1 = 0 a~~rEErR?j;~j

SUBDIVISION OF STRIP INTO CONVEX SUBPOLYGONS


In this section, we continue the description of how our method quadrilates a convex polygon P in the case in which the shrunken polygon P has positive area. In particular, given the boundary mesh vertices of P in counterclockwise order and the counterclockwise closed walk C in P, we describe how to subdivide the strip between 8P and C into convex subpolygons, each containing an even number of mesh edges on its boundary (see Figure 5 for an example with the same P and C as Figure 4). Unlike the triangular case in Reference 10, some mesh vertices on C (and some quadrilaterals in P) may become slightly perturbed and extra mesh vertices may need to be added in the interior of the strip. We continue with the assumption that the lines of mesh vertices are parallel to the .Y axis; let these lines be y = yi, 1 < i < n, from top to bottom, with 2i - J~+, = 11. Let the boundary mesh vertices (on ?P) be uO, u,. . in counterclockwise order. Let the unb13 %b = uO vertices of C be co, L~, , L,,,_1, L,,,= v. in counterclock. wise order, where v. is the leftmost vertex on the top line y = y,. Let x(o) and y(u) denote the x and y coordinates of a vertex c. Let L(i) (R(i)) be the index of the leftmost (rightmost) vertex of C on the line y = yi; L(1) = 0, and R( 1) = nc if there is only one vertex on the top line. (For example, in Figure 5, L(I) = 0, R(1) = 19, L(2) = 3, R(2) = 16, L(3) = 5, R(3) = 14, L(4) = 7, R(4) = 13.) When nc 3 2, cLci,and rRci,, 1 d i 6 n, are the only vertices of C that may have an angle larger than 1SO, as measured inside the strip. We first consider the special case in which nc = 0. i.e. C consists of a single vertex. The following procedure attempts to find 3-5 line segments u,L~,called seppcrrators, to subdivide P into 3-5 convex subpolygons.
I I

(u,) near than y, (x(u~,~))). example


Figure 5,

mesh vertex u;, (u,) near (1.2) Find the boundary I~,,,, (rRcn)) with y coordinate less than yn and .Y coordinate closest to x(c.~(,,,) (x(c.~&). [For example, in Figure 5. 3. = 11 and / = 17.1 (1.3) Modify the indices I, r, A, p using the following pseudocode so that the four subpolygons determined by separators u,uL, 1,, u,.tR( I), each have an even number of l,.cL(,,), U,,lR(n) boundary edges. [For example, in Figure 5, no modification occurs and the four separators are uorO, u~~z,~, uI1r;, u17c13. ] Note that the top or bottom subpolygon may degenerate to an edge, and the subscripts of u are taken modulo nh. If Step 1.3 fails, the remaining steps are skipped. The handling of the failure is discussed at the end of this section.
oddtop : = (mod(l - r f R(l), 2) # 0) oddbor : = (mod@ - j. + R(n) - L(n), 2) # 0) oddlef: = (mod(i. - I + L(n), 2) # 0) fui/ : = false ifoddtop f oddhot then ifoddbot and oddkf then ify(u;._,)<?.,,theni.:=E.1 else if i. # p then i. : = i + I else ,fail: = true endif else if oddhot and not oddlef then change y by F 1 if possible, like above case else is oddlrf then change 1 by +_ 1 if possible, like above case else change r by i_ 1 if possible, like above case endif

(1) Find the boundary mesh vertex closest to P(, and relabel the uj so that u0 is this closest vertex. Set the first separator to uo~:o. (2) Find the remaining separators using the following pseudocode. Note that an angle i uzuis measured

214

Computer-Aided

Design

Volume

27 Number

3 March

1995

Quadrilateral mesh generation


else if oddtop or oddlef

in polygonal

regions: 6 Joe

then if y(u,+,) > y, then II:= 1 + 1; d,:= I%+ 1%(1)12 elseifI#rthenI:=1-l;d,:=

else d, : = cc endif compute r, d,, A, dl, p, dP like above if oddtop and oddlef then d, : = max(d,, d,); d, : = max(d,, d;.) if min(d,, d,) = cc then fail: = true else if d, 6 d, then I:= I; p:= p else r:= r; A: = j. endif else if oddtop then d, : = max(d,, d,); d, : = max(d,, d,) update 1,i. or r, p if possible, like above case else d, : = max(d,, d,); d, : = max(d;., dp) update 1,r or 1, p if possible, like above case endif endif

I% 1UL(1,12

endif if n > 1 then ylo : = yi - h else ylo : = y(u,J endif while j 6 I* and L UjUL(i~Up 180 do $ ify(uj) < y/o then ifn> 1 andylo=yi-hand dmin = a then ylo:= yi - 2h # decrease since # no separator yet if y(u,) < ylo then break endif else break endif endif if y(uj) d yhi then if n > 1 and ylo = yi - 2h then w : = intersection of UjUt(i) and line
y=y,-h

if x(uLti+1J - x(w) < h/4 then break endif endif if L ujuLCi+4, 0 - 180 and > 1ujuL~i~~2 dmin then <
dmin:= /ujuLci,l*; s:= j

(2) (2.1) Relabel the uj vertices and I, r, I., p so that


I = 0 (and r = nb if uI = u,).

(2.2) If n > 2 then possibly perturb uLtlf or uRtl)


as follows. If y(u,,,,+ 1) < y(u,,,,) and 180 < LU~(~)+~U~(~~U,207 then set uLtl) to w, < the intersection of line segment UPON+1 and line y = y,, if X(W)- x(u~,~))d h/4. The condition for changing uRtl) is similar. [For example, in Figure 5, uRtl) = u,~ has been perturbed.] If n 2 3 then possibly perturb Q,,) or ull(,,,as in Step 2.2. If n = 1 then possibly perturb uLC1) uRC1, or as follows, If 180 < LU;.U,~,,U~ 207 then < set uLC1, w, the intersection of line segment to UlUj. and line y = y,, if X(W) - x(uL,J d h/4. The condition for changing vRC1) similar. is

endif endif j:=j+ 2 endwhile if dmin = 00 then fail := true; exit endif p : = s; set next separator to u,utti) endif i:=i+ 1 if i < n then # find first separator from uLCi) j: = p + mod(l(i) - L(i - I), 2); dmin : = co
if Y(UL(i)+J = Yi and Y(u,(i,- 1) > Yi then yhi : = yi # configuration in Figure 6b

(2.3) (2.4)

else
yhi:= y(u,) # configuration in Figure # 6a, Figure 6c or Figure 6d

(3) Find separators

in the left side of the strip using the following pseudocode. Each separator is chosen to be a shortest edge satisfying certain criteria involving angles and y coordinates. Note that each chain UL(i)luL(iJUL(i)+ 1 < i < n, may 1, be in one of four possible configurations (see Figure 6), since either y(u,,+ 1) > yi or y(U,,i,_ 1) = yi and either y(OL(i)+ < yi or y(o,ij+ J = yi. Also, br eak J means to branch to the statement after the loop, and exit means to terminate the procedure.

endif if y(UL,i,_,) > yi then ylo : = yi - h; 0 : = L uLtiJ+luL,i,uL,iJ_ 1 # configuration in Figure 6a or # Figure 6b else ylo : = y,; 8 : = 180 # configuration in # Figure 6c or Figure 6d endif [Above while loop copied here, with . L UjUL(i,UL(i)_ used instead] 1 if dmin = cc then if Y(L(iJ - I) = Yi or Y(Ltij+ I) < Yi of x(uRcIJ - x(Q,) d h then fail:= true; exit endif repeat # backtrack to find a separator
j:=j-2

i:= I; p:= 1; fail:= false repeat if II = 1 then 8 : = L U;VL(1)uP else 8 : = L tiLciJ , uLcipp endif + if0 > 180 then # find second separator from uLCil j:= p + 2; dmin:= cc if y(~~,~)+ = yi and n > 1 then 1) yhi : = yi # configuration in Figure 6b # or Figure 6d else yhi : = y(u,) # configuration in Figure # 6a or Figure 6c

if j < p then jiril: = true; exit endif until y(uJ > yi ify(uj) - yi d h/4 then # perturb u~,~) # upwards uLCi) intersection of u~,~) luL,i) := _ and uL(i) 1uj + endif endif

Computer-Aided

Design Volume 27 Number 3 March 1995

215

Quadrilateral

mesh

generation

in polygonal

regions:

B Joe

p: = s;

set next separator to u,uLci)

endif until i b n if n > 1 and i Uj,CL(nJCL(n) 180 then _I > # find second separator from oLtn, ,j : = p + mod(l(n) - L(n - l), 2); dmin : = cx while j < i, and L u~L~,,,,c~,,,) 1SOdo _1 d if L UjUL(n)CL(n)-I 2 LUiDL(njuL(n)- 1 180 and 1 ujoLcn * < dmin then
dmin : = jujuL,,,,)4 s : = j ;

endif endwhile if dmin = x then &ail: = true; exit endif set next separator to z+~~,, endif [For example, in Figure 5, the first separators found from cL(2)= L~and c~,~, = v5 are u3v3 and u5v5, and the second separator found from v~,,,,= u, is

w7.1
(4) Find separators in the right side of the strip in a similar manner to Step 3. [For example, in Figure 5, the first and second separators found from cR(2) = 116 are u12c16 and u20v16, and the first separator found from uRt3)= cl4 is u~~c~~.] We now discuss the handling of failure to find a separator in either one of the above procedures (for nc = 0 or nc B 2). Failure occurs because there are not enough boundary mesh vertices relative to the number of interior mesh vertices. If failure occurs, then our method discards the shrunken interior quadrilation and repeats the procedures of the previous section and this section using a larger h value of 1.1 times the original h. If failure occurs a second time, then the procedures are repeated with h scaled once more by 1.1 (thus it is 1.21 times the original h). If failure occurs a third time, then our method gives up on trying to generate a shrunken interior quadrilation and uses the algorithm of the next section to quadrilate P. In our experimental results, a failure occurs less than 5% of the time, and less than 10% of these failure cases involve a second or third failure. It is not too difficult to see that the above procedures subdivide the strip into convex subpolygons (when failure does not occur), since the steps are designed so that the selected separators resolve the reflex angles on C and lie entirely in the strip without crossing C, and any perturbations of C are small enough for the structure of C not to be affected.

We conclude this section with a discussion of the time complexity of the above two procedures. The procedure for the special case of nc = 0 takes O(nb) time since there are at most five separators, and so each vertex on LJP is referenced a constant number of times. The procedure for the general case of nc B 2 takes O(nb + nc) expected time since finding the top and botton subpolygons takes linear time and each vertex on the left (or right) side of SP is probably referenced a constant number of times when finding the side separators. The latter is due to the convexity of P and the lower bound yi - 2h on the y coordinates of the uj vertices checked for each separator from uLciJ, < i < n. The convexity of P (and the similar 1 shape of LJP and C) means that the y coordinate of successive separators (chosen on the basis of shortness) does not stay the same for more than at most about two separators and the upper bound on the y coordinates of the uj vertices checked is probably yi + ah for some small constant 1, even in the worst (but nonpractical) case when there are many short edges (with a length much shorter than h).

SUBDIVISION OF CONVEX POLYGON INTO CONVEX QUADRILATERALS In this section, we describe an algorithm for subdividing a convex polygon with an even number of boundary edges into strictly convex or triangular-shaped quadrilaterals, in which no extra vertices are added on the polygon boundary (although mesh vertices may be added in the interior of the polygon). This algorithm is used to quadrilate the convex subpolygons created by the procedure in the previous section (see Figure 7 for an example). It is also used to quadrilate P in the cases in which the shrunken polygon P is empty or degenerate (see Step 1 in the fourth section) or failure occurs three times in the convex subdivision of the strip (see the previous section). The removal of triangular-shaped quadrilaterals is described in the next section. Let S be a convex polygon with 2n (boundary) edges, n 3 2. Our algorithm first subdivides S into convex quadrilaterals and hexagons, and then further subdivides the convex hexagons into convex quadrilaterals (this latter part is discussed at the end of this section). The main operation of the first part of the algorithm is to find an edge in the interior of S to subdivide S into a convex quadrilateral plus a convex subpolygon with 2(n - 1) edges or a convex hexagon plus a convex subpolygon with 2(n - 2) edges (see Figure 8a for an example). This operation is then repeatedly applied to the subpolygons until the number of edges is six or eight.

Figure 6 Four possible configurations of r,_,,l_ I~,,,,,v,_,II I. I i i < ~1: + (a) ,NI , J> Y((.~,,,) y(rL,;,+), (b) Y(L.L,~~> y(c,,i,)= Y(IL,,), ). (c) ,.,,, > : - 1) + y(rL,,,-l ) - v(r,,,,)> ?I(. ,I. (4 ?.(~.L,r,p Y(Q,) = Y(LL,,)+ L,,,+ ,) = 1) ~.

216

Computer-Aided

Design

Volume

27 Number

3 March

1995

Quadrilateral

mesh generation

in polygonal

regions:

6 Joe

subpolygon lies on the chopping edge. Note that the quadrilateral or hexagon chopped off has positive area since the angles at pit and p*b are always smaller than 180. 1, lb:= m - 1; rb:= m; rt:= 2n #indices of # p delimiting left and right sides nl : = m - 1; nr : = 2n - nl # number of remaining # edges on two sides newtop : = true; newbot : = true # indicates if new # chopping edge must be computed repeat if newtop then e12 : = (nr > 2 and angle(u,,) < y and ualidbot( 1,2)) e21 : = (nl 2 2 and angle(u,,+ 1) < y and ualidbot(2, 1)) qtop : = (e12 or e21); dtop : = co ife12 then topr : = rt - 1; topl: = It + 1 (or rb if nl= 1) drop : = IptoplptoprI2 endif if e21 then tempr : = rt; templ: = It + 2 (or rb if nl = 2)
It:= iflp rempl~temgr12 dtop then < top1 : = templ; topr : = tempr dtop : = I~ternp~~rernpA~

Figure 7 Example of quadrilation of convex polygon P [The convex subpolygons in the strip (see Figure 5) are quadrilated the algorithm in the sixth section.]

by

P3

Figure 8 Algorithm operations; (a) introduction of edge p4pll subdivides 12-sided polygon into convex hexagon and convex &sided subpolygon, (b) ualidbotprocedure: ualidbor(2,l) is true, and ualidbot(l,2) is false because removing quadrilateral ~,~p,,p~,p~,+ I from top leaves subpolygon of zero area at bottom

c
Pl /
Pll

P5

PS

P7

(4

The steps when n is larger than or equal to 4 are as follows. 11) Find two vertices of S realizing the diameter (the length of the longest line segment) of S; a linear time rotating calliper algorithm for finding the diameter of a convex polygon (plus the two vertices of the diameter segment) is given in Reference 17. Relabel the vertices of S so that they are 2,. . . , pzn in counterclockwise order and the st&eter of S is 1 pIpml, 2 G m < 2n. Note that the (interior) angles at p1 and p,,, are smaller than 180. To allow the use of top, bottom, left, and right in the following steps, we assume the coordinate system is rotated so that plpm is parallel to the y axis with p1 on top.

endif endif if not qtop and nl + nr > 8 then e14:= (nl = 1 and ualidbot(l,4)) e41: = (nr = 1 and ualidbot(4,l)) e23 : = (nl 2 2 and nr z 3 and ualidbot(2,3)) e32 : = (nl2 3 and nr 2 2 and ualidbot(3,2)) set topl, topr, dtop based on shortest edge as above endif endif if newbot then set qbot, botl, botr, dbot similar to top case endif if nl + nr = 8 and not (qtop or qbot) then break endif if dtop < dbot then # dtop < cc chop off quadrilateral (if qtop) or hexagon at top if I&o&b I 2 IPro&&b I then
It:= topl; rt:= topr

else
It:= top1 - 1; rt:= topr - 1; p[,:= ptOPl if top1 = rb then lb : = It endif endif nl:= Ib - It + 1; nr:= rt - rb + 1 newtop : = true newbot:= (nl< 3 or nr < 3 or nl+ nr = 8) else # dbot < dtop chop off quadrilateral (if qbot) or hexagon at bottom update lb, rb, plbr rt, nl, nr, newbot, newtop similar to top case endif until nl + nr = 6

(2) Find edges to chop off convex quadrilaterals

or hexagons from the top or bottom using the following pseudocode. Angles of vertices are those in the remaining subpolygon. A lower bound of 7 = 153 = 0.85.180 is used for indicating that three consecutive vertices are nearly collinear. The procedure ualidbot(1, r) returns true iff removing the subpolygon formed by the top I left edges and r right edges leaves a subpolygon with positive area at the bottom (see Figure 8b for an example). ualidbot(1, r) is false if one vertex of the chopping edge is plb and any other vertex of the bottom

(3) If an octagon remains because nl + nr = 8 and qtop

Computer-Aided

Design Volume 27 Number 3 March 1995

217

Quadrilateral

mesh

generation

in polygonal regions:

B Joe

and qbot are both false then the octagon is split into four convex quadrilaterals, possibly triangularshaped, as follows. Relabel the vertices as p1,p2,. .,ps. Set rzodd (neven)to be the number of vertices among pi, p3, p5, p7 (pz, p4, p6? PSI that have an angle of 180. If it,,,, b nodd then set u0 to the centroid of convex quadrilateral p2p4p6ps and add edges tlop2, v,p,, uop6, uop8 to subdivide the octagon into four convex quadrilaterals. Note that u0 is in the interior of the octagon since pz, p4, p6, ps cannot be collinear. The case of is similar with pl, p3, ps, p7 used %dd > neven instead. The time complexity of the above algorithm is O(n) since each chopping edge in Step 2 can be found in constant time and reduces the number of edges in the remaining subpolygon. Let H be a convex hexagon generated by the above algorithm (or H could be the initial polygon S). Our method subdivides H into 24 convex quadrilaterals (in constant time), with the choice of subdivision depending on the number of vertices of H with angle larger than or equal to y = 153 (see Figure 9). Let ql, q,, . , q, be the vertices of H, where the labelling of vertices is such that, if H contains at least one vertex with angle larger than or equal to y, then qs has an angle smaller than /, q, has an angle larger than or equal to y, and a longest sequence of consecutive vertices with angles larger than or equal to y starts at ql. Note that at most four vertices may have angles larger than or equal to y since the sum of the six angles is 720. The possible cases are as follows: . If all six vertices of H have angles smaller than ;, then H is subdivided into two strictly convex quadrilaterals using edge qlq4 or q2q5 or q,q,; the edge is chosen on the basis of maximizing the minimum y value of the two quadrilaterals. If only q, and q4 have angles larger than or equal to y, then H is subdivided into two strictly convex quadrilaterals using edge q1q4 (see Figure 9~). If the vertices having angles larger than or equal to y are q, and either q3 or q5 or both, then H is subdivided into three strictly convex quadrilaterals using edges sq,, sq,, sq, where s is the centroid of
Aq,q,q, . (see Figure 9h).

If q, and q2 have angles larger than or equal to 7 and q3 has an angle smaller than y (the angle at q4 or q5 may be smaller than y or larger than or equal to y), then H is subdivided into four strictly convex quadrilaterals using edges slql, s2q2, s2q4. s,q,, s1s2 (see Figure SC) where
.Sl =

3k, + q5)/8+ (42+ ad8


(q1 + q,)P + 3k2 + q,)/8

$2

Note that qlq2q4q, is a strictly convex quadrilateral in this case, and s,sz lies on the line segment joining the midpoints of qlq5 and qzq4. Simple algebraic manipulation shows that s, is the centroid of Aq5qlsz and s2 is the centroid of Aq2q4s1, and so the three angles at each of sl, s2 are all less than 180. Tf ql, q2 and q3 have angles larger than or equal to 7 (the angle at q4 or q5 may also be larger than or equal to y), then H is subdivided into two convex quadrilaterals, possibly triangular-shaped, using edge q2q5 (see Figure 9d) or q3q6 (this is only used if q4 also has angle larger than or equal to y and q2, q,, q,, q, are collinear).

MODIFICATION OF TRIANGULARSHAPED QUADRILATERALS In this section, we describe how the triangular-shaped quadrilaterals generated by the algorithm in the previous section are modified. Triangular-shaped quadrilaterals may only arise in the following three cases: (a) if the initial convex polygon S has four edges, (b) from the subdivision of the octagon in Step 3, or (c) from the last hexagon subdivision case (see Figure Yd). In these cases, we check the p value of the generated quadrilateral and keep a list of the quadrilaterals with ,u value smaller than or equal to 5 and largest angle larger than or equal to 153, and so some nearly triangular-shaped quadrilaterals are also modified. Since our main modification of a (nearly) triangularshaped quadrilateral consists of combining this quadrilateral with one of its neighbouring quadrilaterals and resubdividing the resulting hexagon, we need to extend our quadrilateral mesh data structure (arrays 1/C and ~c,.4n)to record the adjacent quadrilateral (if any) along each edge of each quadrilateral. We use a 2D array QNBR to record neighbour information where C),vBR[i, j] indicates the adjacent quadrilateral along the jth edge of the ith quadrilateral (the jth edge involves the vertices with indices QLJAD[~~] and QCAD[~, 1 + jmod4]). In particular, QNER[i,j] = 4k + (i - 1) where k is the index in QL'AD of the adjacent quadrilateral and 1 is

If only q1 has an angle larger than or equal to y, then His subdivided into two strictly convex quadrilaterals using edge qlq4 if the minimum p value of the two quadrilaterals is larger than or equal to 15; else H is subdivided into two or three strictly convex quadrilaterals as in Figures 9a or 9h depending on which choice gives the larger minimum p value of the quadrilaterals.

qs
Figure 9 Four possible

cl
q;

95

44

q3

92

96
of convex hexagon

91

92

'?6

91

92

93

96 91 42 43 44

(4
subdivisions

(b)
into convex quadrilaterals

Cc)

(4

218

Computer-Aided

Design

Volume

27 Number

3 March

1995

Quadrilateral the index such that the jth edge of the ith quadrilateral is the same as the Ith edge of the kth quadrilateral (but with opposite orientation). If there is no adjacent quadrilateral along the edge, then QNsR[i,j] = 0. We set the entries of the QNBR array as follows. After generating the initial quadrilateral mesh in each convex polygon (which may contain triangular-shaped quadrilaterals), the portion of the QUAD array for the convex polygon is sequentially traversed and a hash table with direct chaining is used to search for the other quadrilateral along each mesh edge. If the search is unsuccessful, i.e. the mesh edge is encountered for the first time, then the edge is inserted in the hash table with related information. If the search is successful, then the mesh edge is deleted from the hash table and two QNBR entries are set. The quadrilateral edges which lie on the convex polygon boundary have their QNBR entry set to 0 (these are the edges which remain in the hash table). The reason for using hashing is that, with a good hashing function and a sufficiently large hash table size, each search, insert, or delete operation can be performed in constant time, on average18. Thus the QNER entries can be set in linear expected time. The modifications presented below occur within a single convex polygon of the decomposition, and the QUAD and QNBR arrays are updated with each modification. After a quadrilateral mesh is generated in all the convex polygons, the QNBR entries for the quadrilateral edges lying on a decomposition edge shared by two convex polygons can be set using hashing. Our procedure for modifying the (nearly) triangularshaped quadrilaterals in a convex polygon makes two passes through the list of these quadrilaterals. After the first pass, only those quadrilaterals which cannot be combined with an adjacent quadrilateral are kept in the list. In the second pass (if necessary), a second attempt is made to combine the triangular-shaped quadrilateral with a neighbour (an adjacent quadrilateral may be changed in the first pass). If the second attempt is not successful, then the (nearly) triangularshaped quadrilateral is subdivided into five strictly convex quadrilaterals as given by Equations 1 and Figure 2 if the minimum p value of the five quadrilaterals is greater than that of the original quadrilateral (/I is calculated as I~+~(/(luiu~J + IuJu41) for Equations 1, since the angle at u4 may be smaller than 180); the subdivision always occurs if the angle at c4 is 180. In our experimental results, this subdivision into five quadrilaterals occurs in less than 0.3% of the quadrilaterals that are modified. Let Q be a (nearly) triangular-shaped quadrilateral in the list with vertices a, b, c, d in counterclockwise order where the largest angle occurs at a. Let R = chef

mesh generation

in polygonal

regions:

Joe

and T= dcgh be the quadrilaterals adjacent to Q along edges bc and cd, respectively, if they exist (see Figure Ma). If R(T) exists, then it is a candidate for combination with Q if its p value is larger than 5 and Labe < 180 ( L hda < 180). If both R and T are candidates, then R is considered for combination first if Abe < L hda; else T is considered first. The other quadrilateral is considered for combination if a resubdivision involving the first quadrilateral is not possible. We only describe the possible resubdivisions in the case in which R is a candidate for combination with Q, since the case of T is similar. As in the previous section, a lower bound of y = 153 is used to indicate that three vertices are nearly collinear.
Labe < y and L fed < y: Q v R is subdivided into the two quadrilaterals abef and afcd (this is similar to the subdivision in Figure 9a) if the minimum p value of these two quadrilaterals is larger than or equal to 15; else Q u R is either subdivided into abef and afcd or the three quadrilaterals abes, ejics, and cdas where s is the centroid of Aaec (this is similar to the subdivision in Figure 96), depending on which subdivision maximizes the minimum p value of the quadrilaterals. L abe < y and y < L fed < 180: Q u R is subdivided into the three quadrilaterals abes, efcs, and cdas where s is the centroid of Aaec. babe < y and L fed > 180: If c is to the left of the ray 2 and e is to the left of or on d and a is to the left of or on f;then the same subdivision as in the previous case is used (see Figure 106); else no resubdivision involving R is performed. The latter two conditions ensure that f_scd and L fcs are each smaller than 180. yb LabeG180 and LfcdG180: QuR is subdivided into four quadrilaterals as in Figure 9c where q1 = a, q2 = b, q3 = e, q4 = f, q5 = c, and q6 = d. y 6~abe 6 180 and L fed > 180: If a is to the left of fc and c is to the left of or on c2 where t is the midpoint of bf, then the same subdibision as in the previous case is used (see Figure I&); else no resubdivision involving R is performed. The two conditions ensure that L fcsl and ~s,cd are each smaller than 180.

EXPERIMENTAL

RESULTS

In this section, we present experimental results from our quadrilateral mesh generation method. The method is implemented in FORTRAN 77using double precision floating point arithmetic, and the results are from runs on a Sun

T h
Figure 10 Triangular-shaped

b
Q and its two neighbours

d
Rand

quadrilateral

7; and the resubdivision

of Q u R in two cases in which L fed > 180

Computer-Aided

Design

Volume

27 Number

3 March

1995

219

Quadrilateral

mesh generation

in polygonal

regions:

I3 Joe

4/20 workstation using thef77 compiler with optimizing option. Three polygonal regions of different complexity are used to test our method: a rectilinear region (see Figure 3), a CMOS region (see Figure II), and a Lake Superior shape (see Figure 12). Convex decompositions and triangulations of these three regions appear in References 9-l 1. For the rectilinear region, quadrilateral meshes are generated for desired numbers of quadrilaterals N, = 100,200,. . ,500. For the CMOS region, meshes are generated for N, = 500,1000, ..,, 2500. For the Lake Superior region, meshes are generated for N, = 1000,2000,. . ,500O. As mentioned in the first section, the convex polygon decomposition procedures in the first two stages of our method are described in Reference 9. The length-scale based mesh distribution function is used in the second stage so that smaller quadrilaterals occur near short edges and narrow subregions. Table 1 contains some information about the three regions and their convex decompositions. N, and N, are the number of edges and subregions in the initial region, N 1 and N, are the number of convex polygons from the first and second stage convex decompositions, and ~~ and r2 are the CPU times in seconds spent in the first and second stages, respectively. Note that N, and TV increase or stay the same as N, increases, and so some table entries contain a range of values. Figures 13-1.5 illustrate the quadrilateral mesh generated for the smallest N, for each region. Tables 2 and 3 contain some measurements and statistics on all the quadrilateral meshes. In Table 2, Nz is the actual number of quadrilaterals generated in the mesh, N, is

the number of mesh vertices, N$/N, is the average number of quadrilaterals per convex polygon, TV is the CPU time in seconds for the 3rd-stage quadrilation, and P,,,~is the minimum p value of the quadrilaterals in the mesh. In Table 3, the relative frequency distribution of p values of the quadrilaterals in a mesh are recorded for
Table 1 Information decompositions Region Rectilinear
CMOS

about

three

test

regions

and

their

convex

N, 8 35 303

N, 1 6 1

N, 3 14 130

N* 5 49-67 187-323

rt 0.01 0.03 1.00

z2 0.03 0.50-0.70 1.67-3.77

Lake Superior

Figure 13 Quadrilateral mesh in rectilinear region for N, = 100 [The actual number of quadrilaterals is 109.1

Figure 11 CMOS region device simulation

with six subregions.

used in semiconductor

Figure 12

Outline

of Lake Superior

with six islands

mesh in CMOS region for No = 500 (rotated) Figure 14 Quadrilateral [The actual number of quadrilaterals is 637.1

220

Computer-Aided

Design Volume 27 Number 3 March 1995

Quadrilateral

mesh generation

in polygonal

regions:

B Joe

the intervals [O, 57, [So, 157, [15, 25), [25, 357, and [35,45]; the table entries are the percentages in each interval. From Tables 2 and 3, the following observations can be made. The actual number of quadrilaterals Nb is closer to the desired number of quadrilaterals N, when Nb/N, or N,/N, increases. The reason why Nt tends to be larger than N, is that the quadrilaterals in the strip near the boundary of a convex polygon Pi (or in all of Pi if there is no shrunken interior quadrilation) tend to have areas of less than h? owing to the various subdivisions of hexagons (see Figure 9). The larger Nb/NQ ratios occur for smaller N, and regions of greater complexity (when N, is larger). For each region, zJN~ decreases slightly as N, increases because it takes less time to generate the

Table 2 regions Region Rectilinear

Measurements

from

3rd~stage

quadrilation

of three

test

NQ

NP

Nv

NW,

73

kllin

100 200 300 400 500 500 1000 1500 2000 2500 1000 2OQO 3000 4000 5000

109 209 321 399 520 637 1165 1665 2228 2702 1421 2609 3675 4832 5913

134 245 365 450 576 691 1241 1753 2331 2816 1686 2954 4084 5302 6434

21.8 41.8 64.2 79.8 104.0 13.0 19.4 25.6 33.3 40.3 7.6 10.1 12.5 15.4 18.3

0.07 0.10 0.13 0.15 0.20 0.47 0.77 1.00 1.17 1.35 1.27 2.13 2.85 3.52 3.97

8.2 10.3 13.8 10.0 5.3 5.0 6.6 6.6 5.6 6.2 4.6 4.9 4.7 4.3 6.1

CMOS

Lake Superior

Table 3 regions Region Rectilinear

Relative

frequency

of p values in quadrilations

of three test

NQ

co, 5) 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.14 0.04 0.03 0.04 0.00

C5.15) 5.5 1 2.39 1.25 1.50 4.04 13.34 9.53 8.41 8.62 5.40 17.31 13.18 10.99 10.86 9.45

Cl53 25) 38.53 19.62 20.87 19.30 18.08 42.70 40.51 34.95 30.30 31.31 47.57 44.73 44.54 41.54 40.25

[25,35) 34.86 32.06 33.64 30.08 33.46 27.94 24.72 28.59 30.88 31.87 28.43 31.43 31.32 33.01 32.19

[35,45] 21.10 45.93 44.24 49.12 44.42 16.01 25.24 28.05 30.2 1 31.42 6.55 10.62 13.12 14.55 17.50

100 200 300 400 500 500 1000 1500 2000 2500 1000 2000 3000 4000 5000

CMOS

Lake Superior

[The numbers

are percentages.]

Figure 15 Quadrilateral mesh in Lake Superior (rotated) [The actual number of quadrilaterals is 1421.1

region for N, = 1000

quadrilaterals in the shrunken interior portion of each polygon. This empirical linear time complexity is expected from the discussions on time complexity in the previous sections. Also, the distribution of ~1values improves as N, increases since the quadrilaterals in the shrunken interior portion of each polygon have a p value larger than 29 and better quadrilaterals can be generated in the strip compared with the case in which there is no shrunken interior quadrilation. When N, is sufficiently large, the resulting mesh should be good enough for finite element analysis since a large percentage of the p values are larger than or equal to 15. It is difficult to compare our results with those from the methods mentioned in the first section, since different test regions are used, the other methods use different ways to specify the varying mesh spacing in different parts of the region (and may require more input to be provided), and the quadrilateral shape measure p has not been previously used. From the CPU times reported in other papers, our method seems to be much faster. It also has the advantage of being based on algorithms rather than nonalgorithmic heuristics.

Computer-Aided

Design

Volume

27 Number

3 March

1995

221

Quadrilateral

mesh

generation

in polygonal

regions:

B Joe

CONCLUDING

REMARKS

REFERENCES
1 2 Ho-Le, K Finite element mesh generation methods: a review and classification Cornput.-Aided Des. Vol 20 (1988) pp 27-38 Talbert, J A and Parkinson, A R Development of an automatic. two-dimensional finite element mesh generator using quadrilateral elements and Bezier curve boundary definition Int. J. Numer. Merhods Eng. Vol 29 (1990) pp 1551-1567 Johnston, B P, Sullivan, J M and Kwasnik, A Automatic conversion of triangular finite element meshes to quadrilateral elements Inf. J. Numer. Methods Eng. Vol 31 (1991) pp 67-84 Blacker, T D and Stephenson, M B Paving: a new approach to automated quadrilateral mesh generation Ini. J. Numer. Methods Eng. Vol 32 (1991) pp 811-847 Zhu. J 2, Zienkiewicz, 0 C, Hinton, E and Wu, J A new approach to the development of automatic quadrilateral mesh generation Inr. J. Numrr. Methods Eng. Vol 32 (1991) pp 849-866 Sezer, L and Zeid, I Automatic quadrilateral/triangular free-form mesh generation for planar regions Inl. J. Numer. Methods Eng. Vol 32 (1991) pp 1441-1483 Tam, T K H-and Armstrong, C G 2D finite element mesh generation bv medial axis subdivision Adv. Eng. Sqfi. Vol 13 (1991) pp 313-324 Tam, T K H and Armstrong, C G Finite element mesh control by integer programming In/. J. Numer. Merhods Eng. Vol 36 (I 993) pp 258 l-2605 Joe. B and Simpson, R B Triangular meshes for regions of complicated shape Int. J. Numer. Method7 Eng. Vol 23 (I 986) pp 75 l-778 Joe, B Delaunay triangular meshes in convex polygons SlitM J. .Qi. Srutist. Comput. Vol 7 (1986) pp 514-539 Joe, B GEOMPACK - a software package for the generation of meshes using geometric algorithms Ah>. Eng. So/i. Vol I3 (1991) pp 325-331 Bondy, J A and Murty, U S R Gruph Theor?, wirh Appliccrfion.\ Macmillan, UK (1976) Fuhring, H The application of node-element rules for forecasting problems in the generation of finite element meshes In/. J. Nzmrrr. Methods Eng. Vol 9 (1975) pp 617-629 Lawson, C L Software for C surface interpolation in Rice, J R (Ed.) Muthematical S@wure III Academic Press. USA 11977) pp 161-194 Lyusternik, L A Concc,s Figures and Polyhedra Dover Publications, USA (1963) Houle. M E and Toussaint, G T Computing the width of a set Prw. 1st ACM Symp. Computational Geomeiry (1985) pp 1-7 Shamos, M I Geometric complexity Proc. 7fh Ann. ACM Symp. Theor) of Computing (1975) pp 224-233 Knuth, D E The Art of Cornmiter Proarammino - Vo13: Seurchiny trr~d Sorting Addison:We&y. USA (?973)

We have presented a method for generating quadrilateral finite element meshes in polygonal regions using geometric algorithms which is based partially on the triangular mesh generator in References 9 and 10. Experimental results from three test regions demonstrate the efficiency and capability of the method. Although the quadrilateral meshes generated by our method are quite satisfactory in quality according to the shape measure p, it would be interesting to investigate postprocessing steps that further improve the quality and are efficient. A common postprocessing step used in almost all the methods mentioned in the first section is Laplacian smoothing or some variation of this. In Laplacian smoothing, each interior mesh vertex is moved to the centroid of its neighbouring mesh vertices; usually a few passes are made through all the interior mesh vertices. We have found that smoothing slightly improves the overall quality of our quadrilateral meshes, but there are also some drawbacks. Some quadrilaterals become worse in quality or even nonconvex; it is also possible for nonsimple quadrilaterals to result. In addition, the CPU time for the smoothing step is sometimes greater than that for constructing the original mesh. At the cost of further time, a valid and improved mesh could be ensured by only moving a vertex if this improves the minimum p value of the quadrilaterals involved. To reduce the time, those vertices interior to a closed walk (enclosing a shrunken interior quadrilation in a convex polygon) and constrained vertices on internal interfaces should not be considered for smoothing. Another postprocessing step worth investigating is the use of local transformations analogous to the diagonal edge swap for triangulations0,4. For quadrilations, it is not clear how local transformations should be defined; they would probably involve hexagons formed from the union of 2-4 adjacent quadrilaterals (see Figures 9 and IO) and may require the addition or deletion of vertices. We believe that the quadrilations generated by our method could be improved by applying local transformations in the strip near each convex polygon boundary and across unconstrained interior decomposition edges. It may also be of theoretical interest to modify our method to get a method which can be proven to guarantee a lower bound on the quality of the generated quadrilaterals. Sometimes a mesh with mostly quadrilaterals and relatively few triangles is acceptable. It is straightforward to modify our method to produce such a mesh. The hexagon in Figure 9d(and possibly Figure SC),the octagon in Step 3 in the sixth section, and (nearly) triangularshaped quadrilaterals can be subdivided into triangles instead of quadrilaterals.

ACKNOWLEDGEMENT The work described in this paper was partially supported by a grant from the Natural Sciences and Engineering Research Council of Canada.

Barr)> Joe is nn associate projk~sor. He received a PhD in computer science from the Universiry oj Waterloo. Canada, in 1984. His research interests include 2D and 30 ./kite-element mesh generation, malhematical sqfrware. geometric computational geometry. modeiling, and computer grphic.r.

222

Computer-Aided

Design

Volume

27 Number

3 March

1995

Вам также может понравиться