Computation of Implicit Representation of Volumetric Shells with Predeﬁned Thickness

: We propose and validate a method to ﬁnd an implicit representation of a surface placed at a distance h from another implicit surface. With two such surfaces on either side of the original surface, a volumetric shell of predeﬁned thickness can be obtained. The usability of the proposed method is demonstrated through providing solid models of triply periodic minimal surface (TPMS) geometries with a predeﬁned constant and variable thickness. The method has an adjustable order of convergence. If applied to surfaces with spatially varying thickness, the convergence order is limited to second order. This accuracy is still substantially higher than the accuracy of any contemporary 3D printer that could beneﬁt from the function as an inﬁll volume for shells with predeﬁned thicknesses.


Introduction
Implicit surfaces are of considerable interest in engineering as they provide an efficient means for the modeling of complex shapes. However, if transferred to the physical world by any means of production, any surface must have a finite thickness and hence, becomes a volume. This can be done by tools for computer aided design by finding surface points and extruding them in the normal direction. For example, Payne and Toga [1] proposed an algorithm to compute a distance field for a discretized surface such that the offset surface could be extracted as an isosurface of the distance field. Venkatesh applied the marching cube algorithm to generate volume models from triply periodic minimal surfaces [2]. Held et al. [3] used generalized Voronoi diagrams to compute offset functions of variable thickness. Pham presented an overview on offsetting methods [4], which was later extended by Maekawa [5]. However, these reviews do not address the analytic offsetting of implicit surfaces.
Fayolle et al. [6] proposed a method for offsetting implicit functions by computing level sets of the distance function. The distance function is obtained by normalizing the original implicit surface by Rvachev's normalization [7]. Fayolle's method is based on numerical procedures that require sampling of the initial implicit surface. They apply the Euler forward method to propagate the offset into the direction of the normal to the surface.
Sethian [8] provides a good overview over fast marching methods used for offsetting implicit surfaces. He also discusses how the accuracy of the the fast marching method can be improved by discretizing the required normal derivatives with finite differences of higher order. However, this by itself does not guarantee an improvement of the order of convergence of the method.
In the mentioned methods, the resulting new surface is either a discretized surface with an explicit surface description or a discretized form of the implicit surface. In both cases, many of the appealing properties of the original implicit surface are lost.
Explicit surface representations usually require much more data than implicit representations, especially if the resolution requirements are high. Applications for implicit surfaces are in 3D printing [9][10][11] and simulation software. In both domains, tessellated surfaces are currently the state of the art. However, simulation software can suffer from artifacts when curved surfaces are approximated by triangles. For example, the accurate simulation of flow around a sphere at a high Reynolds number can be qualitatively wrong if the sphere is approximated by triangles due to spurious flow separation at the edges of triangles, while accurate results can be obtained with the sphere defined as geometric primitive [12], which also requires less memory.
The purpose of the current paper is to propose a method to obtain a new implicit surface at a predefined distance to a given implicit surface.
The reminder of the paper is organized as follows. In Section 2, we introduce a loworder approximation of the offset function to the implicit surface. In Section 3, it is shown how the approximation of the low-order scheme can be improved by Richardson extrapolation in order to obtain a second-order convergent method. In Section 4, it is shown how this methodology is extended to obtain offset functions at any order of convergence. Section 5 demonstrates empirically that the predicted convergence orders are in fact obtained by computing the error norm for offset functions for three different triply periodic minimal surfaces. In Section 6, we discuss the case of a variable thickness of the shell and demonstrate second-order of convergence. Conclusions are given in Section 7.

First-Order Offset Function
Let f ( x) = 0 be an implicit surface Γ. Our aim is to find an implicit surface Γ h as the solution of the offset function φ( x, h) = 0 such that the minimal Euclidean distance between any point on Γ to Γ h is h. Further, we require that the distance between Γ h and Γ −h is 2h. An exact solution to this problem is difficult to find in general and might not even exist, but we can start from a low-order approximation by computing the Taylor expansion of f ( x): where the index n denotes the normal to Γ, which is approximated to lowest order by the direction of the gradient of f ( x) such that Equation (1) becomes Omitting the error term and rewriting (∇ f ( x)) · (∇ f ( x)) = (∇ f ( x)) 2 gives us the first-order offset function φ (1) ( x, h), which can be interpreted as an eikonal equation: From φ (1) ( x, h) = 0, a first-order accurate approximation of the offset surface denoted by Γ (1) h can be computed. We note here that computing an offset function via the propagation of a level set is far from new [13]. In the following, we demonstrate that this simple method can be improved to any specified order of accuracy.

Second-Order Offset Function
A first-order accurate solution to the offset problem is only acceptable if h is very small. In what follows, we present a systematic approach to rise the order of accuracy starting from φ (1) Let us first note that since φ (1) ( x, h) is an implicit surface itself, we are able to apply the same methodology again in order to obtain an offset function of φ (1) ( x, h). In the following recursive computation of the offset function φ (m) n ( x, h), we will indicate the level of the recursion by subscript n and the order of approximation by superscript (m). With this, it is, for example, possible to cover the distance h in two steps of equal size. To achieve this, we recursively apply Equation (3) in itself to obtain This second iteration φ (1) 2 ( x, h) has the same order of accuracy as φ (1) ( x, h), as can be seen by substituting φ (1) and applying the triangle inequality while realizing that h is not a function of x, i.e., (∇( 2 ( x, h) has the same order of accuracy as φ (1) ( x, h), it is expected to be more accurate as it uses half the step size. Adding more steps would raise the accuracy further but the methodology would quickly become unpractical as the algebraic complexity of the implicit surface function grows with each step. Instead, it appears more promising to combine the obtained solutions through Richardson extrapolation [14]. Richardson extrapolation is a convergence acceleration method for sequences of approximations obtained with different smallness parameters (e.g., step sizes). It is applicable if the order of convergence with respect to the smallness parameter is either known or can be obtained directly from the series of solutions. For this, it must be possible to express the error of the method as a Taylor series in the smallness parameter. It is also necessary that the error does not depend on terms not related to the smallness parameter. Therefore, only results obtained by the same deterministic method can be combined in a Richardson extrapolation.
We recall the general equation for Richardson extrapolation given a solution g (q) (h) obtained with smallness parameter h and a solution g (q) (βh) obtained with a smallness parameter βh, both with the same method of order q: In the current case, the refinement factor is β = 1/2 and the convergence order is q = 1. Note that both methods have to be evaluated at the same final location, which in the current case, is after a distance h. However, the solution g (q) (h) = φ (1) 1 ( x, h) is obtained using a single step while the second solution g (q) (h/2) = φ (1) 2 ( x, h) uses two steps of size h/2. After some algebra, this yields A second-order approximation of the surface Γ (2) h is obtained from φ (2) ( x, h) = 0.

Arbitrary-Order Offset Function
There are various systematic ways to rise the convergence order further. We propose here using an extended Richardson extrapolation strategy. For this, we briefly return to the theory behind the Richardson extrapolation and explain how the same method can be used to obtain results at arbitrary order.
The general assumption behind the Richardson extrapolation is that the approximating function φ (1) n ( x, h) can be written as Here, n is the number of equidistant steps or iterations to reach a distance h such that the step size is h/n. The constants E i are independent of the step size. Richardson extrapolation ignores all but the leading-order error to get a better approximation of φ( x, h) from the weighted combination: The weights have to be recovered by inserting Equation (7) into Equation (8) and equating coefficients with regards to φ( x, h) and E 1 , where φ( x, h) is to be recovered while the error term is to be eliminated, i.e., Solving this set of equations gives rise to the usual Richardson extrapolation formula. While Richardson extrapolation usually only considers the elimination of the leading order error term, the formula can be extended to cover several error terms at the same time. The conditions for the extended Richardson extrapolation can be written simply by where i ≤ m. By solving Equation (10), the weights for an extended Richardson extrapolation at arbitrary order can be determined. Table 1 lists the weight coefficients for extended Richardson extrapolations up to order four.
In this way, our method can be seen as a semianalytic way to construct successively more accurate approximations to the eikonal equation.

Implicit Infill Volumes
An implicit function for the infill volume can be derived from the implicit offset functions in positive and negative directions indicated by h < 0 and h > 0. We define the implicit volume Φ( x, h) as the shell of the zero contour of f ( x) with thickness h by The point x is said to be inside the shell if Φ( x, h) < 0 and outside the shell if Φ( x, h) > 0.

Limitations
The problem to supply an arbitrary surface with a finite thickness is not well posed in general. In particular, it is difficult to unambiguously define what is meant by thickness of a curved surface. For example, if the local radius of curvature of a surface is small compared to the desired thickness of the shell, the resulting body could be self-intersecting. In the proposed method, the thickness is defined through Equation (1) as the path length of a curve following the normal of the implicit function f ( x). For shells with local radii much larger than the thickness h, this path is approximately straight, but for increasing thicknesses, the path itself can be curved and the distance of the end points of a curved path is always shorter than the length of the path. Hence, the method proposed here is only valid for shells with a thickness much smaller than their local radii of curvature. It is important to note that this limitation is intrinsic to the definition of thickness in the method and this limitation is not affected by the order of the Richardson extrapolation chosen. Further, we note that the method does not check for self-intersection.

Examples
In this section, we will investigate the performance of the proposed methodology considering some examples of varying complexity.

Circle
A circle can be defined in a Cartesian coordinate system by the implicit function with R being the radius. For the zero contour of f (x, y), it is straightforward to compute the two contours with offset h by replacing the radius with (R − h) and (R + h), respectively.
In order to validate the proposed method, we compute the first-and second-order offset functions from Equation (13): Rewriting Equations (14) and (15) in terms of polar coordinates gives At the specified location of the new surface, the offset functions are which means that the second-order offset function provides the exact solution while the error of the first-order offset function is within the predicted range.

Triply Periodic Minimal Surfaces (TPMSs)
Periodic minimal surfaces have many potential applications in engineering. There are several ways to define a minimal surface [15]. It can be defined as the surface that locally has the smallest area. Another definition is that a minimal surface has a zero mean curvature. In the following examples, we assume that the TPMS is given by the zero contour of the function F( x). Without loss of generality, we assume the TPMS to be periodic in a cubic box with side length L.
The offset functions up to fourth order of convergence for a TPMS are obtained following the proposed procedure.
We compute four different first-order approximations of the offset function according to From this, we obtain different orders of approximation using the extended Richardson extrapolation: The derivation of φ (n) ( x, h) is easily automated in a computer algebra system such like Mathematica, Maple, or SymPy.
Mathematica source code for the generation of offset functions at different orders of convergence is presented in the Supplementary Material published alongside this paper.

Error Measurement Procedure
To measure the accuracy of the proposed method, we employ a sampling technique. We want to measure the distance between the surface of the TPMS and the zero contour of its offset function. The computer algebra software Mathematica is used to find a large sample of points N on one of the surfaces. The sampled points are uniformly distributed in x and y directions. The z coordinate is determined by solving for z given x and y on the surfaces. The procedure for collecting the points is described in Algorithm 1. m with the other surface is measured and compared to the predefined distance h. The error is measured in the following norm: where N is the number of points used and n is the order of the approximation used to represent the offset surface. The procedure for calculating the error is described in Algorithm 2. The error measurement procedure, including sampling of the points from the surface and finding the intersection distance to the next surface, is done on both surfaces, i.e., the original zero contour of the TPMS and the offset function.

Gyroid
A Gyroid is a TPMS that is described by the implicit equation where L is the edge length of a cube circumscribing a unit cell of the Gyroid shown in Figure 1 together with the other surfaces investigated in this paper. With the emergence of 3D printing, Gyroids are of great interest since Gyroid-based patterns can be used to fill space while providing sufficient strength and low weight to the 3D-printed parts. Figure 2 shows the bodies generated with the third-order offset function of the Gyroid for various thicknesses. We employ the error measurement from Section 5.2.1 to validate the proposed method. Figure 3 shows the convergence of the different offset functions for varying thickness. It is observed that the predicted order of convergence is recovered. The first-order offset function appears to be converging with second-order for large enough thicknesses but approaches the predicted asymptote for thin shells.

Schwarz P
The next example is the Schwarz P TPMS, defined as The resulting bodies obtained from the third-order offset function are shown in Figure 4. Again, we measure the convergence of the proposed method following Section 5.2.1 and display them in Figure 5. In this case, the asymptotic behavior of the four tested variants follows the theoretical prediction very closely.  Figure 3. Gyroid convergence study. In both panels, the error in the measured offset h m is plotted against different predefined normalized offsets. In the left figure, the offsets were measured starting from points on F G ( x) = 0 to points on each surface φ (n) ( x, h) = 0, respectively. In the right figure, the measurement direction is reversed. The triangles represent the corresponding slope for each order n. (a)

Neovius
The previous examples had very homogeneous curvatures. For the next example, we chose a surface for which the curvature changes. The Neovius surface is defined as  Figure 5. Schwarz P convergence study. In both panels, the error in the measured offset h m is plotted against different predefined normalized offsets. In the left figure, the offsets were measured starting from points on F Sch ( x) = 0 to points on each surface φ (n) ( x, h) = 0, respectively. In the right figure, the measurement direction is reversed. The triangles represent the corresponding slope for each order n.
The bodies generated from the third-order offset function are depicted in Figure 6. It is seen that the intersection of the Neovius surface with the axes plains has an elliptical shape. Figure 6c shows how the hollow connections between unit cells are filled up. It is obviously difficult to guarantee a constant thickness of the shell in these connections once the thickness approaches the width of the openings. This is evident from the convergence analysis, executed in the same way as for the other two bodies and displayed in Figure 7. For small enough thicknesses, the theoretically predicted convergence is well captured. However, for thicknesses of 0.1 L, the error deteriorates as the resulting shape can no longer be described as a shell of the Neovius surface. One observation is that this deterioration is less severe when the thickness is measured from the offset function to the Neovius surface than when it is measured the other way around. The reason for this is most likely seen in the fact that the proportion of the offset function contour with inaccurate distance towards the Neovius surfaces shrinks when the connections are closed as these closed areas are no longer part of the offset function.   Figure 7. Neovius convergence study. In both panels, the error in the measured offset h m is plotted against different predefined normalized offsets. In the left figure, the offsets were measured starting from points on F Neo ( x) = 0 to points on each surface φ (n) ( x, h) = 0, respectively. In the right figure, the measurement direction is reversed. The triangles represent the corresponding slope for each order n. The nonasymptotic behavior shown at offsets of larger values (e.g., h/L = 0.1) is attributed to the high curvature of the original surface.

Shells with Variable Thickness
It can sometimes be of interest to allow for a variable thickness of the shell [16,17]. Applying the method outlined in this paper to shells with variable thickness would imply substituting h by the function h( x) in all stages of φ (n) ( x, h( x)) before taking the derivative. The implicit dependence of h on x would then automatically be taken into account. However, this approach would not produce the desired result, which can be explained as follows: The proposed method approximates the thickness of the shell by moving a predefined distance along the normal of φ( x, h) = 0 for increasing h. This procedure is only accurate under the assumption that the normal of φ( x, h) = 0 does not deviate substantially from the normal of f ( x) = 0, such that the procedure follows a straight line. However, if h is not constant, the normal becomes, through the chain rule of differentiation: The direction of the normal will therefore be governed by how h changes with x, which is another way of saying that if h is not constant, φ( x, h( x)) = 0 is naturally not parallel to f ( x) = 0.
Another and more straightforward approach to obtain variable thickness is to assume h to be constant in the derivation of φ( x, h) and only replace it when evaluating φ( x, h) = 0. This also has limited accuracy because if h is a function of x, it changes by a value ∼ h∂ n h over the thickness h. For smooth variations of the thickness, it is reasonable to assume that ∂ n h = O(h) such that h∂ n h = O(h 2 ). Hence, the accuracy of the proposed method for variable thickness is bound to second order. This is still sufficiently accurate for many applications. Figure 8 shows the convergence for shells with a linearly increasing thickness along the x axis for the different TPMS. It is observed that the first-order method remains to be first-order accurate, albeit it performs better than expected for the Gyroid at larger thicknesses. The third-order method typically shows better results than the second-order method but it too converges only with second order. Since the intrinsic error in the thickness is already of order O(h 2 ), further increasing the order of φ (n) ( x, h) would not improve the asymptotic nature of the result. For a shell thickness of 0.01 L, the second-order method already obtains errors smaller than 0.03% of the target thickness in all three cases. Figure 9 shows the resulting bodies with variable thickness.  Figure 8. Convergence study for varied offset in the x direction. In each figure, the error in the measured offset h m is plotted against different predefined normalized offsets governed by a linear function h(x). The offsets at x = 0 are set to zero, while the offsets at x = L vary from zero to a maximal value of 0.1 L. The offsets were measured starting from points on different offset surfaces φ (n) ( x, h) = 0 obtained with approximations up to order three. No further improvement is observed when using an approximation method with an order higher than two. Figure 9. Infill volume enclosed between two offset contours from the original interface F( x) = 0 of the Gyroid, Schwarz P, and Neovius, respectively. For a unit cell, the offset distance linearly increases from 0 up to 0.1 in the x direction. In the above figures, the method used to obtain the implicit representation for each of the offset interfaces is the second-order method.

Conclusions
In this paper, we proposed a systematic methodology for deriving analytic implicit body shells of predefined thickness from implicit surfaces. The convergence order and thereby the accuracy of the thickness of the shell can be freely adjusted trough the extended Richardson extrapolation. The motivation for our method comes from engineering applications of additive manufacturing, where such infill volumes are required for the actual 3D-printing process on the one hand and for numerical simulations of such structures on the other hand. For constant thicknesses, our method reaches a precision of smaller than 10 −6 for wall thicknesses measuring 1% of the wave length of the periodic structure. This precision by far exceeds the accuracy of contemporary 3D-printing technology. By opting for offset functions of lower-order computational time can be reduced. The memory requirements for storing the offset function of a TPMS is negligible compared to a discretized surface mesh. Being analytic, the offset function does not lose any quality when scaled. At the time of this writing, it is not straightforward to use the offset function directly as input for commercial 3D printers as they typically expect a tessellated mesh representation of the surface, which can, of course, easily be obtained from discretizing the zero contour of the offset function. Our method can be used to identify, for any point in the domain, whether it lies in the shell or outside the shell. As the shell can be expressed as a solid body in this way, the question of water tightness of the surface never arises. However, the slicing of the object for G-code generation and 3D printing was not addressed in this theoretical work. In the presented semianalytic form, our method can only be applied to surfaces provided as differentiable implicit functions. Such surfaces are always closed as they provide an inner and an outer side. In 3D printing, it is often of interest to include open surfaces [18]. In our approach, this is possible by cutting the resultant shell with an additional solid in a postprocessing step.
Besides being useful for the definition of infill volumes for the printing process itself, the proposed method has other applications, for example, in the analysis and simulation of 3D-printed objects. In general, methods of adaptive manufacturing come with a finite smallest line width. In many applications, the line width of the printer is designed to coincide with the thickness of the shell structure under construction. This is, for example, common for 3D printing of slender concrete structures in applications of civil engineering and architecture [19,20]. But the same is also true for wire arc additive manufacturing [21] and the various types of powder bed methods like selective laser melting [22] and selective binding processes [23,24]. For structures built with these technologies, the thickness of the shell is often a simple result of the line width of the printer and is hence not specified as an infill volume. Here, the designer is interested in the resulting shell geometry actually manufactured by the printer which can be predicted with our method provided that the line width is known. Such knowledge is of particular interest for the modeling and simulation of 3D-printed structures as the simulation software requires accurate volume geometries. In simulation software, the substantial reduction of the memory requirements due to the use of an analytic function instead of a high-resolution surface mesh is a substantial advantage as simulation software is typically memory bound and preprocessing the geometry often takes more time than the actual simulation. This is actually the authors' main motivation as we are concerned with the simulation of air flow through 3D-printed TPMS with our lattice Boltzmann solver VirtualFluids [25][26][27][28]. Surface meshes are particularly ill-suited for large-scale periodic structures such that the search for a more economical representation of such structures was inevitable.
We note here that the proposed method is markedly different from discretized numerical methods for solving the eikonal equation such as the fast marching method described by Sethian [8]. The fast marching method depends on numerical differentiation, which is done on a grid. Even though Sethian points out that the fast marching method can be improved by using finite differences of higher order, this does not necessarily enhance the convergence order of the method. In fact, the convergence order is not directly related to the quality of the normal derivative as is seen from the fact that our method always builds on exact analytic derivations. Due to this utilization of exact derivatives, no discretization and hence no grid is required in the proposed method. This does not mean that our method is generally more efficient than a fast marching method, as discretization on a grid has its advantages. The analytically derived offset function can become extremely complicated. The proposed method is hence not to be seen as a replacement for the fast marching method but rather, as an additional, very precise tool for cases where the original implicit surface is efficiently expressed as an analytic function.
When the thickness of the structure is not constant but varies in space, our method reduces to second-order accuracy, which is still much more accurate than required by any perceivable application in additive manufacturing at the time.
Finally, we note that the extended Richardson extrapolation is by no means restricted to the method derived in this paper. The extended Richardson extrapolation provides a systematic procedure to derive methods of arbitrary accuracy starting from a poor approximation, provided that this approximation fulfills the requirement that the error can be expanded in series.