1. Introduction
Three-dimensional printing is an advanced manufacturing technology that enables the “free fabrication” of complex structures quickly and efficiently with a simple device [
1,
2]. Compared with traditional manufacturing processes, it overcomes the limitations of complex configurations that are difficult to machine and reduces processing procedures, manufacturing cycle time, and manufacturing costs [
3]. In recent years, 3D printing technology has been successfully applied in aerospace, automotive, and other areas [
4,
5,
6,
7,
8]. Although 3D printing technology has made breakthroughs, due to its unique manufacturing process, the manufactured products usually have errors problems, which greatly restrict the widespread use of the technology [
9].
There are three main sources of errors that exist in the 3D printing manufacturing process. The first error comes from the conversion between model formats, i.e., the process of converting a computer-aided design (CAD) model to a model in the format required for 3D printing; the second error comes from the layered slicing and path planning algorithm [
10]; and the third error comes from the manufacturing accuracy of the device itself [
11]. All of the above errors directly affect the molding accuracy of the final printed structure. However, compared to the latter two errors, if the first error cannot be effectively reduced, it will be difficult to manufacture a high-precision structure even if the subsequent process is highly accurate.
When performing 3D printing, we first need to build a digital model through modeling software. However, the model formats generated by different modeling software vary. They are not directly used to drive 3D printers. In order to generate Gcode that can “communicate” directly with the 3D printer, the model needs to be converted from different formats to the common STereoLithography (STL) format file for 3D printing. Currently, 3D printing models usually use planar triangles to form an envelope model to represent the CAD model, such as the more widely used STL model. It approximates the CAD model by setting the maximum chord height between the planar triangle and the surface of the model [
12,
13]. For this reason, when the CAD model has complex surfaces or high local accuracy, using planar triangles to simplify it will inevitably result in a loss of features and accuracy of the model [
14]. In order to retain the features and accuracy of the CAD model as much as possible, the triangular facets of the overall model need to be continuously subdivided during the format conversion process. This will cause problems such as the too-large amount of model data or data redundancy, which inevitably increases the difficulty of model data processing [
15]. Compared with the planar triangle model, the surface triangle model has higher degrees of freedom through parametric shape control. It can fit the surface and complex features of the model with high accuracy by using a relatively small number of face pieces, which effectively solves the problems caused by the simplification of the overall model by planar triangles. Several scholars have investigated the construction methods of surface triangles. Vlachos et al. [
16] proposed a point-normal triangle in order to improve the visual quality in graphics rendering. Its main idea is to use a Bezier surface triangle (e.g., PN triangle) surface to replace each triangle in the original mesh. Compared with other Bezier triangles, PN triangles have lower degrees of freedom, and their shapes are influenced not only by the normal vectors but also by their different methods. Hamann et al. [
17] constructs a
C0 continuous surface by using a triangular rational quadratic Bezier surface to approximate a cubic linear interpolation function profile. The construction of Bezier surfaces requires control point information, which is harder to obtain directly when performing model fitting. NURBS and B-sample surfaces using surface approximation control meshes all have a similar problem to Bezier surfaces in that it is difficult to construct a direct mathematical relationship between the surface model and the original model.
Unlike surfaces using control meshes, surface shape control based on boundary conditions is simpler and more intuitive, and easier to achieve stitching between surfaces. Márta et al. [
18] proposed a new definition of a surface that uses three triangular surfaces instead of the original boundary curves on the triangular parameter domain to generate a triangular surface. This interpolation scheme has affine transformation invariance [
19], while the connection between the resulting surface and its components is continuous along a common boundary curve, except for the vertices. This method involves a tremendous amount of data input and also contains the combined operation of three surfaces, which greatly increases the computational cost. In addition, Hagen [
20] proposes an interpolation method based on the Hermite operator, which implements the interpolation of the boundary curvature of an arbitrary triangle.
In order to meet the growing demand for model formats for 3D printing, the American Society for Testing and Materials (ASTM) Special Advisory Panel has creatively proposed a surface triangle in the additive manufacturing file (AMF) format [
21,
22]. The surface triangle consists of cubic Hermite curves [
23], but they only define the boundary curves of the surface triangle and do not define the Hermite surface triangle model completely. According to the authors’ knowledge, there are few studies on Hermite surface triangles, but compared with other surface triangles, the definition and input quantity of Hermite surface triangles are relatively easy. It is not only suitable for 3D printing the required multi-surface sheet model, but also can make full use of the surface information contained in the original design model to achieve high accuracy fitting of the model. Therefore, how to construct a Hermite surface triangle model and make full use of the existing 3D printing manufacturing model information to fit the CAD model with high accuracy is a problem worthy of study.
Based on the above analysis, this paper proposes a Hermite surface triangle model construction method considering the high-precision fitting of 3D printing models. Affine transformation is used to establish the mapping relationship between multiple surface triangles and feature triangles. Then, the cubic surface model with general parameters is constructed and the cubic Hermite surface model is solved using the vertex and tangent vector information. Finally, the model fitting error calculation and comprehensive evaluation are realized by using the height difference between the model sampling points and the mapping points.
3. Hermite Surface Triangle Model
In this subsection, based on the constructed feature triangles and mapping relations, the general parametric surface model is first established by the two parameters u and v. Then, the vertex coordinates and normal vectors of the Hermite curve are matched with the surface model to build the Hermite surface triangle model.
Let
be a general two-parameter surface. To ensure the smoothness of the surface, set it as a cubic equation. Then, its mathematical expression can be described as:
where
is the three-dimensional characteristic coefficient.
As shown in
Figure 7, from the vertex coordinates and tangent vector information of the surface triangles, it is known that
,
and
are the three boundary curve parameters characterized by the vertices
,
, and
in the counterclockwise direction, respectively. Let
,
, and
be their corresponding curves, respectively.
Substitute the characteristic parameters
,
, and
into Equation (6). Then, the three boundary curves in the general parametric surface can be expressed as:
The Hermite boundary curve corresponding to Equation (8) is obtained by substituting the vertex and tangent vector information in
Figure 8 into Equation (1).
Equations (8) and (9) are combined to obtain Equation (10).
The eigencoefficients of the Hermite surface model can be obtained by solving Equation (10).
Then, Equation (6) can be written as Equation (12).
where
.
is the set shape vector, which aims to improve the controllability of the surface model, and thus achieve the adjustment of the accuracy of fitting the local details of the CAD model.
Figure 8 shows the change in the shape of the surface triangle when
is taken to different values. The focus of this paper is to construct a Hermite surface triangle for 3D printing with high-precision model fitting. A discussion of
will not be developed in this paper, and the specific details will be reflected in another paper. In order to verify the validity of the constructed surface model fit, we set
in the subsequent examples.
4. Error Calculation and Evaluation Method
In order to verify the effectiveness of the proposed method, the error calculation and comprehensive evaluation method between the fitted model and the CAD model are presented in this section. The fitting error is essentially the offset that exists between the fitted model and the original model surface. It is theoretically more accurate to use the inter-model volume error as the evaluation criterion for the offset of the model. However, since the distance between model surfaces is related to both its location and surface data, and the original model shape has uncertainty, this will make the fitting error difficult to be uniformly expressed by mathematical formulas. To this end, the fitting error is calculated in this paper by means of model sampling. The main idea is to transform the problem of integration of the volumes between the two models into a problem of summing the height differences at the sampling points.
In order to sample the data points of the original model reasonably and comprehensively, a method of calculating the sampling mapping points is proposed. The sampled data points are obtained by meshing the CAD model using
Hypermesh software, as is shown
Figure 9.
Figure 10 shows the schematic diagram of the model fitting error.
is any sampling point in the CAD model, and the fitting error at that point is the height difference between that point and the corresponding mapping point of the fitted model. The mapping point is the intersection point between a vertical line
made along the X/Y/Z direction past the
point and the fitted model, as shown in
Figure 10.
and
are the mapping points of
on the Hermite surface model
and STL model
, respectively.
The coordinates of the mapped point can be calculated from the information of the triangular surface slice where the vertical line intersects the fitted model. As shown in
Figure 11,
is the projection of the sampled points.
,
, and
are the vectors constructed with the
vertices in a counterclockwise direction starting from
, respectively.
,
, and
can be regarded as vectors rotating counterclockwise with
as the center. When
lies within
,
,
, and
have the same sign, indicating that the vertical line
intersects the triangle
. Conversely, when
is outside
, the vertical line
does not intersect with triangle
.
Taking a vertical line along the Z-direction as an example, when the triangle in the Hermite model intersecting the vertical line is determined, the parameter value
of the sampled mapping point on the Hermite surface triangle can be found by Equation (16). The vertical coordinates of the sampling mapping points (e.g., Equation (16)) can be obtained by substituting
into Equation (14).
It is worth noting that the procedure calculates all the sampled mapping points on the surface triangles intersecting the vertical line and takes the point closest to the sampled point as the error calculation point.
In the Z-direction of the STL fitted model, the triangles with vertices
,
and
, where the sampled mapping point
is located, should satisfy the following conditions.
The vertical coordinate of this sample mapping point can be described as:
where
After obtaining the sampling mapping points on the fitted model, the error between the fitted model and the original model can be obtained by calculating the distance between the sampling points and the mapping points, and the unit of distance is by millimeter. In order to make a comprehensive evaluation of the error of the fitted model, the evaluation method of calculating the fitting error in terms of mean deviation and variance is proposed. In the Z-direction, the mean deviation (mm) and variance (mm
2) of the sampled points can be described as:
where
.
and
are the original model and the fitted model, respectively.
is the distance difference between the models at the point
.
n is the number of sampling point. Similarly, the fitting errors in the X and Y directions can be solved by the above method.
5. Numerical Cases
Case 1. In this section, we take the Stanford classical rabbit model with high complexity morphology as an example and compare the fitting error of its Hermite surface model and the 3D printing generic STL model. As shown in Figure 12, the solid rabbit model in step format was imported into Hypermesh software, and the sampled data points with 702 located on the model surface were obtained by meshing. The rabbit model was fitted using the Hermite surface triangles constructed in this paper and the planar triangles of the STL, respectively. The number of triangular surface slices is controlled by changing the approximation tolerance and mesh density of the fit. And finally, five groups of Hermite and STL fitted models were obtained, corresponding to the number of triangular facets of 16,862, 18,519, 22,820, 25,323 and 27,239, respectively.
Table 1 shows the sampling mean deviation and variance of the original model and the fitted model in the X, Y, and Z directions.
Theoretically, as the number of fitted model facets increases, the accuracy of the fit should also improve, i.e., the mean deviation will be reduced. However, as shown in
Table 1, there is no such rule between the obtained data. The main reason for the existence of this phenomenon is that when the fitted model is not finely drawn to the local features of the original model, the triangle that should be used to calculate the fitting error at its closest distance does not intersect with the vertical line after some of the sampling points make a vertical line along the error calculation direction. This will cause an offset in the mapping point selection, resulting in a large sampling error.
Table 2 and
Table 3 show the distribution of the sampling mean deviation of the data in groups 1 and 5, respectively. As shown in
Table 2, the maximum fitting error of the Hermite surface model in the Z direction is around 50, and then the overall fitting error is mostly distributed below 5. In contrast, the maximum fitting error of the STL model reaches more than 800, and there is still a large distribution around 50. In the other two directions, the maximum fitting errors of the two are similar, but the Hermite surface model has a smaller value of sampling error and a relatively concentrated distribution. In contrast, the fitting errors of the STL model are relatively discrete in distribution and have larger values. Similarly, as shown in
Table 3, the maximum fitting error is similar in the Y direction, but in the Z and X directions, the maximum fitting error of the STL model is much larger than that of the Hermite surface model, and the overall error distribution is more discrete in all three directions.
As shown in
Table 1,
Table 2 and
Table 3, the overall fitting accuracy of the Hermite surface model is higher compared to the STL model, but the obtained fitting error fluctuates more due to the existence of mapping point bias, which does not truly reflect the deviation between the fitted model and the original model. In order to evaluate the fitting ability of the two models more accurately and objectively, the distance-weighted nearest neighbor algorithm [
28] is used to process the data in
Table 1. This method achieves the screening and removal of data with more discrete distribution by calculating the distance between objects and assigning larger weights to closer distances.
Table 4 and
Figure 13 show the fitting errors and the variation in mean deviation of mean deviation after removing the “noise points”, respectively.
As can be seen from
Table 4 and
Figure 13, the mean deviation between the Hermite and STL models in the Z, X, and Y directions gradually decrease as the number of model facets increases, and gradually stabilize at the 4th and 5th groups. It shows that the accuracy of the fit of the 2 to the model is gradually improving with the increase in the number of face slices. The fitting error of the STL model fluctuates in the Y-direction, e.g., the error becomes larger in group 3. The main reason for this phenomenon is that STL uses planar triangles for fitting, which is more likely to produce an offset in the mapping points. At the same time, the overall fitting accuracy of the Hermite surface model is much better than that of the STL planar model, which can preserve the original model characteristics and accuracy as much as possible with a smaller number of face slices. This not only can effectively solve the problem of excessive data volume or data redundancy caused by the continuous subdivision of the face slices in the STL model when improving the fitting accuracy, but also can further improve the processing efficiency and manufacturing accuracy of complex models in the 3D printing process.
Case 2. The turbine model is used as another example to verify the effectiveness of the proposed method. A Hermite surface model and a 3D printing generic STL model are used to fit it, and the fitting error is analyzed. The solid model of the turbine and the 950 sampled data points extracted based on the grid division are shown in Figure 14.
The Hermite and STL fitting errors were compared by five groups of models with face piece numbers of 18,272, 20,540, 22,752, 24,336, and 28,592, respectively.
Table 5 shows the mean deviation and variance of the fitted model in three directions after removing the “noise”. The variation of the mean deviation is shown in
Figure 15.
As is shown in
Table 4 and
Figure 13, the fitting error is gradually decreasing as the number of model facets increases in the Z and Y directions. The model fit error was minimized in group 5. The mean deviation was about 0.2 and 0.35 for Hermite and STL, respectively. In the X-direction, the fitting error of Hermite ranged from 0.2 to 0.1, and gradually tended to 0.1 as the number of model facets increased. The fitting error of the STL model showed a gradual decrease with the increase in the number of model facets, except for a slight fluctuation due to the mapping point offset on group 3. However, its lowest error among the 5 groups is still around 0.25. The overall fitting accuracy of the Hermite model for this case is still better than that of the STL model, which verifies the effectiveness of the proposed method.