clustering a large number of faces for 2 ... - Semantic Scholar

11 downloads 0 Views 391KB Size Report
International Meshing Roundtable, pp.547-564 (1998). [7] William J. Schroeder, Jonathan A. Zarge, and William. E. Lorensen, “Decimation of Triangle Meshes”,.
CLUSTERING A LARGE NUMBER OF FACES FOR 2-DIMENSIONAL MESH GENERATION Keisuke Inoue1, Takayuki Itoh2, Atsushi Yamada3, Tomotake Furuhata4, Kenji Shimada5 1,2,3,4

IBM Japan Ltd., Yamato-shi, Kanagawa, Japan {inoue,itot,ayamada}@trl.ibm.co.jp, [email protected] 5

Carnegie Mellon University, Pittsburgh, PA., U.S.A. [email protected]

ABSTRACT This paper presents an automated face clustering method used as a preprocess of mesh generation for finite element analysis. Hundreds or thousands of faces are often contained in a CAD model designed in detail, and many of them are smaller than a single mesh element. This complexity of a CAD model makes a meshing process difficult both in quality and in speed. Our clustering method decomposes a CAD model into several regions, each of which is geometrically proper for a meshing process. In the algorithm, we start from the state where every single face makes its own region, and then repeat selecting a pair of adjacent regions and merging them into one region until there remains no mergeable pair of regions. The selection of the most suitable pair and the mergeability test are done based on several geometric indices about a pair of regions. The validity of the method is demonstrated with results of clustering and mesh generation on a real-scale CAD model. Keywords: mesh generation, clustering, simplification, finite element analysis •

The whole parametric space is too complex since it consists of parametric spaces of a large number of faces.



Iterative calculation for deciding node placement converges very slowly.



The quality of the generated mesh is low both topologically and geometrically.

1. INTRODUCTION Increasingly, designers prefer to conduct finite element analysis (FEA) on original CAD models rather than to create specific models for analysis alone. However, a CAD model in the final design stage can consist of hundreds or even thousands of faces, each of which is represented as a trimmed parametric surface and is usually smaller than a preferred mesh element size. Although the mesh generation problem is considered to be a discretization process that divides a large surface into small elements, for actual CAD models, the situation is contrary. That is, one mesh element often covers a number of faces. Therefore, it is meaningless to generate a mesh for every face and combine the meshes into one. We have proposed a physically-based approach to generating a mesh for 2-dimensional objects [1][2][3][4]. However, when we apply the method to a whole model consisting of a large number of faces including tiny ones, the following problems arise:

These problems become more serious as a CAD model becomes more complex. Our solution to this problem takes the following three steps (See Figure 1): 1.

Decompose the entire region into a set of proper regions by face clustering.

2.

Generate a mesh for each region using simplified geometry, i.e., a projected plane.

3.

Merge all generated meshes into one mesh.

By introducing simplified geometry instead of using the actual complicated geometry of a region, the meshing process

can be greatly accelerated and stabilized without worsening the quality of mesh. Practically, ignoring small details contributes much to the quality of the mesh as well since singularities such as CAD model errors or very small curvatures usually reside in those details. In that sense, the first step realizing proper regions is the key in our threestep solution in order to generate a well-shaped mesh in a reasonable time. However, it is very labor-intensitive to perform the first step manually. In this paper, we propose an automated method for the first step in which all faces in a model are clustered into several geometrically proper regions for mesh generation. In our approach, a pair of two adjacent faces are merged into a larger region iteratively. Through the process, each region grows to be a well-shaped region. The criterion for merger is determined based on a combination of geometric indices. This method can be categorized as a simplification method of geometric models for meshing [5][6], but it is different from other methods since it divides the entire region into wellsized sub-regions. This algorithm is similar to the polygon simplification methods [7][8][9][10] because they also merge triangular polygons by prioritizing according to a combination of geometric indices. However, we apply very different geometric indices from theirs because our target is not graphics applications but mesh generation in which there are various mesher- or application-dependent requirements for output regions. Moreover, input faces in our problem are characterized by a large variety in: •

Size: some are tiny and others are so large as to cover a third of the CAD model.



Complexity: some faces have very complicated boundaries and/or larger variations of normal vectors than others.

These features make our problem very different from those dealt with in other papers. The remainder of the paper is organized as follows. In Section 2, after describing the problem, we outline our technical approach. Then in Section 3, we describe how to determine whether two regions should be merged or not and how to prioritize possible mergers. In Section 4, we show results of clustering and meshing on a real-scale CAD model. region

face

input CAD model

step 1: clustering

2. TECHNICAL APPROACH

2.1 Problem Description Our algorithm accepts the following as inputs: •

A set of faces with adjacency links



A mark for each pair of adjacent faces

Input faces are assumed to be connected without overlapping each other and to make a 2-manifold shell as a whole. As for the marks, the user can set either of two marks, INTERNAL or BOUNDARY, on any face pair. The mark INTERNAL represents that the edges shared by the pair of faces must not be on the boundary of a region, while the mark BOUNDARY represents that they must be on a boundary. Every unmarked face pair is listed as a candidate for iterative merger. Our algorithm clusters all input faces into several groups, each of which makes a connected region suitable for mesh generation. Due to a combinatorial explosion, this clustering problem can have a large number of solutions. Two trivial solutions are 1) one region for the whole shape, and 2) every face making its own region. However, by considering requirements for a well-shaped region, the proper clustering is found somewhere between the two extremes in most cases. A well-shaped region satisfies the following conditions: •

Area size: The area of a region should be large enough in comparison with that of a mesh element. A small region causes a poor-quality mesh.



Boundary smoothness: A boundary of a region should be as smooth as possible. A sharp angle at a vertex on the boundary causes poor quality of mesh elements in that area.



Region flatness: Each region should be as flat as possible. A large variation of normal vectors over a region causes failure of the meshing process on the projected plane.

The definition of a well-shaped region can vary depending on the method of mesh generation and/or later applications that work on the mesh. For example, region flatness is specifically important only when a projected plane is adopted as a simplified geometry for meshing process, while the former two are required more generally. In any case, our clustering method is customizable to various requirements stated in terms of geometry.

2.2 Arc Contraction on an Adjacency Graph By mapping a face to a graph node, and adjacency of a pair of faces to a graph arc respectively, we define an adjacency graph from the set of input faces (See Figure 2). Since input faces make a 2-manifold shell, the adjacency graph becomes planar. A face-merging operation corresponds to an arccontraction operation in this graph.

step 2: meshes of regions

step 3: merged mesh

Figure 1. Three-step solution

8. Re-calculate scores for all arcs connected to the merged node.

1

1 2

5

2 5

4 3

4 3

(a) a set of faces

(b) an adjacency graph

9. Jump to Step 4. All arcs marked with INTERNAL are resolved in the preprocess; therefore, they never appear in the list. On the other hand, arcs marked with BOUNDARY can appear in the list due to the unification of multiple arcs, even though they are not in the list initially.

Figure 2. Conversion from faces to a graph The arc-contraction operation consists of two steps (See Figure 3). In the first step, a target arc is deleted and its two terminal nodes are merged into one. At the same time, other arcs incident to the two nodes are connected to the merged node. In the second step, if multiple arcs are produced in the first step, they are unified into a new arc. In the unifying operation, if at least one of the multiple arcs is marked with BOUNDARY, the unified arc is marked with BOUNDARY. If at least one of the multiple arcs is marked with INTERNAL, the unified arc is marked with INTERNAL. There could be a case where one arc of the multiple arcs is BOUNDARY and the other INTERNAL. This means that the input marks are contradicting themselves and they must be corrected.

Step 1

Step 2

Figure 3. Arc contraction

2.3 Outline of the Algorithm Our algorithm is basically a sequential arc contraction on an adjacency graph. The process starts from the initial state where every graph node corresponds to one face. Then, a pair of adjacent regions is merged in an iterative manner. If n mergers take place, the total number of regions is reduced by n.

3. CONDITIONS FOR MERGING REGIONS

3.1 Scoring and Mergeability The score is a scalar value calculated for each arc and it is used to prioritize arcs for contraction. The arc with the top score, which is considered to be the most preferable candidate for contraction, is always selected as a target arc. Without proper termination conditions, a sequential contraction based on scores always ends up with a situation where all faces are merged into one region. Therefore, in order to terminate the algorithm in a preferable state, we introduce a test of mergeability, which is a Boolean value determined for each arc. If the target arc selected based on scoring does not pass a mergeability test, the algorithm terminates assuming that there remains no proper arc for contraction.

3.2 Geometric Indices for Scoring and Mergeability In Section 2.1, we listed three items: (1) Area Size, (2) Boundary Smoothness, and (3) Region Flatness, to measure the preference of a region. In this section, we describe indices concretely to calculate a score and mergeability.

3.2.1 Area Size We employ an area index for scoring a pair of regions:

The algorithm consists of the following steps:



1. As a preprocess, contract every arc marked with INTERNAL.

The area index is defined as follows:

2. Make a list of all unmarked arcs. 3. Calculate a score for each arc in the list. 4. Take the top-scored arc from the list.

Area index ( A ).

A=

∞  0

( S 1 ≤ S 0 or S 2 ≤ S 0), ( otherwise ).

5. If the arc is marked with BOUNDARY, remove the arc from the list and jump to Step 4.

where S 1 and S 2 are the areas of the two regions, and S 0 is the minimum allowable area. Infinity, for which we actually use a very large number, implies that the pair of regions has a high priority for merger.

6. If the arc passes the mergeability test (this topic will be discussed in Section 3), contract the arc and remove the arc from the list. At the same time, remove arcs produced during the arc contraction from the list and add the unified arcs.

3.2.2 Boundary Smoothness

7. If the list is empty, terminate the algorithm.

As for boundary smoothness, we employ two kinds of indices:



Ratio of shared boundary ( Rsh )



Average improvement of contact angle ( ∆ )

The ratio of shared boundary, Rsh , contributes to the long boundary shared by the face pair and is defined as:

l l  Rsh = max  ,  ,  L1 L2  Figure 6. Gauss map angle and average normal where l stands for the length of the shared boundary, while L1 and L2 stand for the perimeters of the two regions respectively. As shown in Figure 4, a larger value of Rsh implies that two regions share a relatively longer boundary.

Figure 4. Ratio of shared boundary The average improvement of contact angle, ∆ , reflects the contribution to make the boundary simple. The value is calculated by the following equation: ∆=

1 N

N



(φ i

− α i ) + (φ i − β i ) , 2

where N is the number of endpoints of discrete segments of the shared boundary (usually equals 2), while α , β , and φ are angles at an endpoint as shown in Figure 5. The ideal value of φ is π , which means a straight boundary curve around the contact point. A positive value of ∆ implies that the merger of the pair contributes to make the boundary simpler.

Variance of normal vector ( σ 2 ) is defined as:

∫ {ang ( m, n)} dS , 2

σ2 =

S

where ang (m , n) represents the angle of two vectors, vector n represents a normal vector at a point on the surface, vector m represents an average normal vector over the surface as shown in Figure 6. Since σ 2 for a merged region can be approximated by:

σ 2=

S1σ 12 + S 2σ 22 S1S 2 {ang (m 1 , m 2 )}2 , + S1 + S 2 ( S1 + S 2 ) 2

where S i , σ i2 , and m i (i = 1, 2) are respectively area, variance of normal vectors, and an average normal vector for each region. Using the above equation, we define the partial derivative of σ 2 , λ as follows:  ∂σ 2   ∂σ 2   ,   λ = max  ∂S1  S =0  ∂S 2  S 1

   2 =0 

A large value of λ indicates that the variance increases rapidly when the two faces are merged.

3.3 Combining Indices

Figure 5. Angles at a contact point

The geometric indices described in the previous section reflect a certain characteristic of a region or its improvement caused by merger. We use them to define a score function that realizes the desired strategy of clustering. The most primitive way is to use just an index as a scoring function. To allow a more tailored algorithm, a weighted sum of indices is introduced, while the most general form of the score function can be written as:

3.2.3 Region Flatness

F (r1 , r2 ) = F ( g 0 (r1 , r2 ), g 1 (r1 , r2 ),...) ,

For region flatness, we employ three kinds of indices: where r1 and r2 are two regions and gi is a geometric



Gauss map angle ( θ )



Variance of normal vector ( σ 2 )



Partial derivative of σ ( λ )

index. 2

The Gauss map angle θ is defined as the half angle of the cone circumscribing the Gauss map of normal vectors over a region as shown in Figure 6. A larger angle will contribute to a lower score.

The mergeability criterion can be, in the simplest form, an inequality about a geometric index or score function. But in the general form, it is a combination of inequalities about geometric indices. Since different indices reflect different aspects for a pair of regions, improving one index usually leads to worsening another. Therefore, the score function and mergeability

criterion should be carefully tuned, and the setting is mesheror application-dependent.

Figure 11 shows the results by using the scoring pattern Type B shown in Table 1, and by setting the threshold σ 0 to 1.5,

3.4 Multiple-phase implementation

7.0, and 18.0 (deg). The total numbers of clusters are 127, 2 82, and 29, respectively. They show that the larger σ 0

In addition to tailoring the scoring function and mergeability criterion, we can apply the clustering algorithm in multiple phases. In other words, after reducing the number of regions with a certain setting for the scoring and mergeability conditions, we can start the second phase from that state with a different setting, and iterate this.

causes the smaller number of clusters.

In order to allow further mergers, settings in later phases should be looser in some sense. From experiments, we found it effective to apply a couple of settings that focus on different geometric aspects.

We compared the three scoring patterns in Table 1, by calculating the following two indices for regions:

This hybrid implementation introduces a far larger variety in customizing the clustering algorithm, which should be heuristically explored. Some results will be shown in the next section.

4. RESULTS AND DISCUSSIONS The proposed method was implemented in C and executed on an IBM PowerStation RS/6000 Model 43P (PowerPC 604e, 375MHz). Some results are presented in this section. In the following experiments, we used a CAD model of a mechanical part shown in Figure 7, which consists of 1742 faces. In Figure 8, each face is colored in different color. There are many tiny or thin faces that are smaller than desired mesh element sizes. We implemented three simple settings for the score function and mergeability criterion, as shown in Table 1. With these settings, we demonstrate how the clustering method works. Table 1. Settings of scoring and mergeability scoring function

mergeability criterion

Type A: Gauss map angle

F = −θ + A

θ ≤ θ0

Type B: variance of normal vector

F = −λ + A

σ 2 ≤ σ 02

Type C: ratio of shared edges

F = Rsh + A

Rsh ≥ R0

Figure 10 shows the results of clustering faces by using the scoring pattern Type A shown in Table 1, and by setting the threshold θ 0 to 15.0, 45.0, and 83.0 (deg). The total numbers of clusters (i.e., regions) are 134, 80, and 36, respectively. They show that the larger θ 0 causes the smaller number of clusters.

Figure 12 shows the results by using the scoring pattern Type C shown in Table 1, and by setting the threshold R0 to 0.5, 0.4, and 0.3. The total numbers of clusters in these results are 133, 87, and 32, respectively. They show that the smaller R0 causes the smaller clusters.

Rl : Ratio of the length of the boundary to the circumference of an equivalent circle

σ : Standard deviation of normal vector (i.e., square root of variance of normal vector) Table 2 shows the values of indices for three results, which include similar numbers of clusters. It shows that clusters generated by Type C have the smaller Rl values. Therefore, it seems that these clusters have simpler boundary shapes than those of other clustering results. It also shows that clusters generated by Types A and B have the smaller σ values than those generated by Type C. Table 2. Comparison of three types of clusterings pattern

Type A

Type B

Type C

mergeability threshold

θ 0 = 45.0

σ 0 = 7.0

[deg]

[deg]

R0 = 0.4

N (#cluster)

80

82

87

Rl (average)

2.001

1.867

1.440

Rl (minimum)

1.129

1.129

1.111

Rl (maximum)

8.767

5.026

2.897

σ (average) [deg] σ (minimum) [deg] σ (maximum) [deg]

13.77

11.90

14.43

0.00

0.00

0.00

34.94

52.85

43.66

We also generated meshes over the regions generated by the clustering processes. Our implementation first projects the boundaries of regions onto planes, and then generates quaddominant meshes on the planes by using the square packing method [4]. The meshes are finally projected back onto the surfaces of the regions, and merged into one single mesh (See Figure 9). Finally, we evaluated the quality of the meshes generated after the clustering processes. To measure the quality of the meshes, we calculated the ratio of undesirable elements to the total number of elements in a mesh. In this evaluation we measured the following six ratios: N1: ratio of triangular elements N2: ratio of elements that have small (under 30 degrees) angles

N3: ratio of elements that have wide (over 135 degrees) angles

regions generated by Type C have better boundaries, but the variance of normal vectors is not always as good.

N4: ratio of elements that have short (under 0.4 times the given element pitch) edges

The mesh generated by Type F (i.e., multiple-phase implementation) seems to have no defective values in any aspect. Depending on the requirements of the application, multiple-phase implementation would be the best alternative, but it still needs more extensive work. The whole clustering result is shown in Figure 13.

N5: ratio of elements that have long (over 1.4 times the given element pitch) edges N6: ratio of folded (at least one angle between two normal vectors is over 30 degrees) elements Table 3 shows the results of evaluating the quality of the meshes. The results are also shown in Figure 14. In Table 3, Type 0 denotes that a mesh is generated over one region consisting of all faces, while Type F denotes that the mesh is generated over regions that are clustered with a multiplephase implementation. For the experimental multiple-phase implementation (Type F), we employed three phases with different settings of the scoring function and mergeability criterion. Strategies in the three phases are outlined as: Phase 1. Merge regions using strict mergeability criterion on boundary smoothness and region flatness. Phase 2. Merge regions using mergeability criterion on area only (That is, make every region greater than a certain area). Phase 3. Merge regions using medium mergeability criterion focusing on boundary smoothness. The number of regions was initially 1742, and was reduced to 898, 69, and 32 after each phase. Table 3. Comparison of mesh qualities Type 0

Type A

Type B

Type C

Type F

N1

0.122

0.157

0.167

0.124

0.125

N2

0.003

0.036

0.020

0.006

0.009

N3

0.005

0.038

0.023

0.010

0.010

N4

0.001

0.054

0.021

0.003

0.007

N5

0.228

0.036

0.042

0.061

0.042

N6

0.130

0.013

0.026

0.030

0.009

Since it is difficult to define a good projection plane for the whole shape, the mesh generated by Type 0 contains many ill-shaped elements as we expected. This resulting mesh is not suitable for FEA. Meshes based on other clustering types have many fewer undesirable elements. It therefore proves the validity of our method. The meshes generated by Type A and Type B have particularly better N5 and N6 values, since the regions are generated considering the variance of normal vectors. However, their other characteristics are not as good as those of other types. This is because the regions generated by Type A or B do not always have well-shaped boundaries. Some features of the mesh generated by Type C are opposite to those of the meshes generated by Type A or B, since the

5. CONCLUSION We have presented a method for clustering a large number of faces for the purpose of 2-dimensional mesh generation. When dealing with a large CAD model actually used in industry, decomposition of the whole model into well-sized, well-shaped regions contributes significantly to the improvement of the quality of the generated mesh. Our central idea is a sequential merger of adjacent regions. The most promising pair for making a well-shaped region is selected based on a score that is a combination of geometric indices. Experimental results show that well-shaped regions for meshing are obtained by using the multi-phase approach. By configuring the combination of geometric indices and tuning parameters, the method is customizable to various applications that have different requirements on the wellshapedness of a region. The potential limitation of our approach is that it always selects the best available pair at a moment in the clustering process. This approach does not always lead to an optimal solution. To obtain a better result, ‘tactical’ merging might be necessary, such as accepting an ill-shaped region once and then merging it into a well-shaped region. As future work, instead of ‘tactical’ merging, we are thinking of developing postprocess functions, such as exchanging faces between two regions locally to achieve better regions. Another topic would be a systematic way of tailoring the combination of geometric indices and of determining threshold values for mergeability tests.

REFERENCES

[6]

Anton V. Mobley, Michael P. Carroll, and Scott A. Canann, “An Object Oriented Approach to Geometry Deseaturing for Finite Element Meshing”, Proc. 7th International Meshing Roundtable, pp.547-564 (1998).

[7]

Kenji Shimada, and Takayuki Itoh, “Automated Conversion of 2D Triangular Mesh into Quadrilateral Mesh”, Proc. Intl. Conf. on Computational Engineering Science ’95, pp.350-355 (1995).

William J. Schroeder, Jonathan A. Zarge, and William E. Lorensen, “Decimation of Triangle Meshes”, SIGGRAPH ’92 Proc., pp.65-70 (1992).

[8]

Kenji Shimada, Atsushi Yamada, and Takayuki Itoh, “Anisotropic triangularation of parametric surfaces via close packing of ellipsoids”, Proc. 6th International Meshing Roundtable, pp.375-390 (1997).

Hugues Hoppe, Tony DeRose, Tom Duchamp, John McDonald, and Werner Stuetzle, “Mesh Optimization”, SIGGRAPH ’93 Proc., pp.19-26 (1993).

[9]

Michael Garland, and Paul S. Heckbert, “Surface Simplification Using Quadric Error Metrics”, SIGGRAPH ’97 Proc., pp. 209-21 (1997).

[4]

Kenji Shimada, Jia-Huei Liao, and Takayuki Itoh, “Quadrilateral Meshing with Directionality Control through the Packing of Square Cells”, Proc. 7th International Meshing Roundtable, pp.61-75 (1998).

[10] Andrew J. Willmott, Paul S. Heckbert, and Michael Garland, “Face Cluster Radiosity”, Eurographics Workshop on Rendering, (1999).

[5]

Alla Sheffer, Ted Blacker, Jan Clements, and Michel Bercovier, “Virtual Topology Operations for Meshing”, Proc. 6th International Meshing Roundtable, pp.49-66 (1997).

[1]

[2]

[3]

Kenji Shimada, “Physically-Based Mesh Generation: Automated Triangulation of Surfaces and Volumes”, PhD thesis, Massachusetts Institute of Technology (1993).

Figure 7. Input CAD model with 1742 faces

Figure 8. Colored faces

Figure 9. Merged mesh

(a) θ 0 =15.0(deg) (134 clusters)

(b) θ 0 =45.0(deg) (80 clusters)

(c) θ 0 =83.0(deg) (36 clusters)

Figure 10. Type A clusterings with different thresholds

(a) σ 0 =1.5 (deg) (127 clusters)

(b) σ 0 =7.0 (deg) (82 clusters)

(c)

σ 0 = 18.0 (deg) (29 clusters)

Figure 11. Type B clusterings with different thresholds

(a) R0 = 0.5 (133 clusters)

(b) R0 = 0.4 (87 clusters)

(c) R0 = 0.3 (32 clusters)

Figure 12. Type C clusterings with different thresholds

Figure 13. Type F (multiple-phase) clustering (32 clusters)

(a) N1

(c) N5 , and N6

(b) N2 ,N3 , and N4 Figure 14. Quality of meshes

Suggest Documents