STL Mesh
STL Mesh
STL Mesh
DESIGN
Computer-Aided Design 34 (2002) 1±17
www.elsevier.com/locate/cad
Abstract
The aim of the method proposed here is to show the possibility of generating adaptive surface meshes suitable for the ®nite element
method, directly from an approximated boundary representation of an object created with CAD software. First, we describe the boundary
representation, which is composed of a simple triangulation of the surface of the object. Then we will show how to obtain a conforming size-
adapted mesh. The size adaptation is made considering geometrical approximation and with respect to an isotropic size map provided by an
error estimator. The mesh can be used ªas isº for a ®nite element computation (with shell elements), or can be used as a surface mesh to
initiate a volume meshing algorithm (Delaunay or advancing front). The principle used to generate the mesh is based on the Delaunay
method, which is associated with re®nement algorithms, and smoothing. Finally, we will show that not using the parametric representation of
the geometrical model allows us to override some of the limitations of conventional meshing software that is based on an exact representation
of the geometry. q 2001 Published by Elsevier Science Ltd.
Keywords: Mesh generation; STL File format; Bisection algorithm; Delaunay triangulation
Fig. 1. Example of an ASCII STL ®le (there is also a binary ®le format, which contains the same information). Please note the redundancy of vertices A, B and C.
to be meshed. The topology and connectivity between Then, as many industrial artefacts have edges, we need to
triangles is obtained by avoiding redundancy between determinate where they are located, if any. This is done
vertices in the STL ®le. This is done by using a binary using an edge detection process, considering the connectiv-
tree in which the vertices are stored and sorted ity between entities in the triangulation.
according to a lexicographic order. At the end of this The search for the model's edges is very important
procedure, we have a mesh of the object's surface, with since they have to be kept intact in the re-meshing, i.e.
all the types of connectivity needed for the re-meshing, they must not be cut by the Delaunay re-meshing strat-
particularly the connectivity used for adjacency searches egy. The search is based on angle calculations between
(see Section 3). adjacent triangles. The common segment of two triangles
Fig. 6. Graph of the curvatures obtained on the triangles by linear interpolation of the curvatures corresponding to the vertices. The most curved areas are
shown in black.
4 E. BeÂchet et al. / Computer-Aided Design 34 (2002) 1±17
After each bisection, the mesh must be handled locally in It should be noted that triangulations that are weakly
order to achieve better regularity. This is done by respecting Delaunay-conforming in the sense of De®nition 2 generally
the Delaunay criterion, which is well-known for 2D meshes. do not respect the empty sphere criterion for the whole
6 E. BeÂchet et al. / Computer-Aided Design 34 (2002) 1±17
Fig. 13. Several meshing steps, with a threshold angle of 458 (four vertices
Fig. 11. Cylinder, built using AutoCad. inserted).
E. BeÂchet et al. / Computer-Aided Design 34 (2002) 1±17 7
2.4. Smoothing
Fig. 19. De®nition of the gap between the sphere and the triangle.
As shown in the examples below, algorithms have been 2.7. The advantages of using STL instead of CAD patches
implemented in order to respect different types of size maps
that are imposed a priori. Since nodes are generated on In a mesh generation process based on CAD patches, the
existing triangles using bisection techniques (as long as patches that make up the solid's boundary are meshed indi-
the length of the sides of the triangle are locally greater vidually. Consequently, the edges shared by adjacent patches
than the prescribed size), the actual mesh size is about 0.6 are kept in the resulting mesh. Most of the time, patches in
times the prescribed size. CAD designs are not related to any physical meaning and
The size map consists of either a constant size map, an generally there is no point in keeping patch edges in the
arbitrary size map provided by the user or by an error esti- resulting mesh for FEM calculation purposes. Moreover,
mator, or a size map that will lead to a good geometric keeping patch edges often leads to a stretched triangle because
approximation of the solid's boundary. In the latter case, they contribute to constraining the resulting mesh. In our
mesh density is driven locally by the maximum geometric mesh generation system the only edges that are kept are
error (theoretically the gap between the target mesh and the ªtrueº edges and edges that are needed to apply the boundary
E. BeÂchet et al. / Computer-Aided Design 34 (2002) 1±17 9
Fig. 23. Re®nement: constant target size: 3 mm. Smoothing. 2302 triangles,
1153 vertices.
Fig. 21. Resulting mesh obtained from the STL ®le (patch independent).
3. Validation examples
3.1. Cylinder
Fig. 24. Histogram of the length of segments corresponding to Fig. 23 The
(Figs 22±27) target size is 3 mm. (see Section 2.5).
Fig. 22. Original STL mesh. 252 triangles, 128 vertices. Height: 30 mm. Fig. 25. Histogram of the quality factor of the triangles in Fig. 23.
10 E. BeÂchet et al. / Computer-Aided Design 34 (2002) 1±17
Fig. 28. Original STL mesh. 1386 triangles, 695 vertices. Size: 150 mm.
Fig. 29. Re®nement: constant target size: 8 mm. Smoothing. 4040 triangles,
2022 vertices.
Fig. 27. Re®nement: constant target size: 7 mm, coarsening (not described
here): constant target size: 5 mm. Smoothing. 314 triangles, 159 vertices.
Fig. 31. Histogram of the quality factor of the triangles in Fig. 29.
Fig. 34. Original STL mesh. 1908 triangles, 932 vertices. Size: 100 mm.
Fig. 32. Adaptive re®nement: maximum imposed geometric error: 0.1 mm,
maximum imposed triangle size: 20 mm for low curvature regions.
Smoothing. 6434 triangles, 3219 vertices.
Fig. 35. Re®nement: constant target size: 2 mm. Smoothing. 59,196 trian-
gles, 29,576 vertices.
Fig. 33. Re®nement: constant target size: 8 mm, except on a plane: 2 mm.
Smoothing. 8622 triangles, 4313 vertices.
The dif®culty comes from the fact that there are ®ve
tetrahedrons touching each other (distinct solids). The
projection algorithm could project vertices onto the wrong
solid, and this is avoided by adjacency relations used in the
projection algorithm described in Section 2.2 (Figs 40±43)
Fig. 37. Histogram of the quality factor of the triangles in Fig. 35. Thin
blades imply quality factors under 0.1.
Fig. 40. Original STL mesh. 480 triangles, 220 vertices. Size: 60 mm.
Fig. 39. Adaptive re®nement: maximum imposed geometric error: 0.1 mm, Fig. 41. Re®nement: constant target size: 2mm. No smoothing. 7920 trian-
maximum imposed triangle size: 10 mm for low curvature regions. gles, 3940 vertices.
Smoothing. 13,730 triangles, 6843 vertices
E. BeÂchet et al. / Computer-Aided Design 34 (2002) 1±17 13
Fig. 42. Histogram of the length of segments corresponding to Fig. 41. In Fig. 45. Re®nement: constant target size: 0.2 in. Smoothing. 45,602 trian-
this case, the histogram is not properly smoothed. This is due to the fact that gles, 22,803 vertices.
the geometry heavily constrains the shape of triangles and the length of
segments. The target size is 2 mm (see Section 2.5).
Fig. 46. Histogram of the length of segments corresponding to Fig. 45. The
target size is 0.2 in (see Section 2.5).
Fig. 43. Histogram of the quality factor for triangles in Fig. 41. Same
remark as for Fig. 42.
Fig. 47. Histogram of the quality factor for the triangles in Fig. 45.
3.5. Guitar
(Figs 44±48)
Fig. 48. Adaptive re®nement: maximum imposed geometric error: 0.02 in.,
maximum imposed triangle size: 0.8 in. For low curvature regions. Smooth-
Fig. 44. Original STL mesh. 3470 triangles, 1737 vertices. Size: 20 in. ing. 27,550 triangles, 13,777 vertices.
14 E. BeÂchet et al. / Computer-Aided Design 34 (2002) 1±17
3.6. Lever
(Figs 49±54)
Fig. 53. Histogram of the length of segments corresponding to Fig. 51. The
target size is 5 mm (see Section 2.5).
Fig. 50. Original STL mesh. 1330 triangles, 655 vertices. Size: 377 mm.
Fig. 54. Histogram of the quality factor for the triangles in Fig. 51.
3.7. Aneurysm
Fig. 51. Re®nement: constant target size: 5 mm. Smoothing. 30,208 trian-
gles, 15,094 vertices. (Figs 55±59)
Fig. 55. STL mesh from a medical scanner. 10,494 triangles, 5245 vertices. Fig. 56. Re®nement: constant target size: 3 1/10 mm). Smoothing. 21,462
Size: 278 1/10 mm Courtesy of Dr M.,L. Raghavan, Department of Biome- triangles, 10,729 vertices.
dical Engineering, University of Iowa, Iowa City, IA.
Fig. 58. Histogram of the length of segments corresponding to Fig. 56. The References
target size is 3 mm (see Section 2.5).
[1] Cher®ls C, Hermeline F. Diagonal swap procedures and characteriza-
tions of 2D-Delaunay triangulations. Math Mod and Num Anal
1990;24(5):613±26.
[2] CuillieÁre JC. A direct method for the automatic discretization of 3D
parametric curves. Comp Aided Design 1997;29(9):639±47.
[4] Delaunay B. Sur la spheÁre vide. Bul Acad Sci URSS, Class Sci Nat
1934:793±800.
[5] Dirichlet, GL. U È ber die Reduktion der positiven quadratischen
Formen mit drei understimmten ganzen Zahlen. Z Angew Math
Mech 1850;40(3):209±27.
[6] George PL, Borouchaki H. Triangulation de Delaunay et maillages:
application aux eÂleÂments ®nis, Paris, HermeÁs. ISBN 2-86601-625-4,
1997.
[8] PeÂbay PP, Frey PJ. A priori Delaunay-conformity. Proceedings of the
7th International Meshing Roundtable, 1998. p. 321±33.
[9] Rivara MC, Inostroza, P. Using longest-side bisection techniques for
the automatic re®nement of delaunay triangulations. Intl J for Num
Fig. 59. Histogram of the quality factor for the triangles in Fig. 56. Because Meth in Eng 1997;40:581±97.
of tiny details on the original model, there are still some stretched triangles. [10] VoronoõÈ G. Nouvelles applications des parameÁtres continus aÁ la theÂo-
rie des formes quadratiques. Recherches sur les paralleÂloeÁdres primi-
tifs. Journal Reine angew math 1908;134.
4. Conclusions [11] Watson DF. Computing the n-dimensional Delaunay Tesselation with
application to VoronoõÈ polytopes. Computer Journal 1981;24(2):167±
In this paper, we have shown the possibility of directly re- 72.
meshing (i.e. without knowing the actual exact geometry) not
only meshes from STL ®les, but more generally all surface
meshes, provided that they are conforming. For example, this Further reading
can be done when using a FEM adaptive remeshing loop and a
size map provided by an error estimator. [3] CuillieÁre JC. An adaptive method for the automatic triangulation of
3D parametric surfaces. Comp Aided Design 1998;30(2):139±49.
The method described can mesh a solid without [7] Ito Y, Nakahashi K. Direct surface triangulation using stereolithogra-
being restricted by the CAD representation (patches), phy (STL) data, 38th AIAA Aerospace Sciences Meeting & Exhibit,
i.e. two patches can be meshed without their common AIAA-2000-0924, 2000.
E. BeÂchet et al. / Computer-Aided Design 34 (2002) 1±17 17
Eric Bechet is a PhD student at the EÂcole Jean-Christophe CuillieÁre is a Professor at the
Polytechnique de MontreÂal, QueÂbec, Canada. Universite du QueÂbec aÁ Trois-RivieÁres,
He received a BS (1997) in mechanical QueÂbec, Canada. He received his BS (1988)
engineering from the EÂcole SupeÂrieure des and PhD (1993) in Mechanical Engineering
Sciences de l'IngeÂnieur de Nancy, France. from the Institut National Polytechnique de
His research interests are in mesh generation Lorraine (Nancy, France). His major research
for complex parts, and anisotropic re-meshing interest is in mesh generation algorithms for
algorithms for accurate injection moulding complex shapes. He is also involved in research
simulations. works about CAD/CAM integration and Finite
Element applications in Mechanical Design
and Manufacturing.