Overview
Model slicing and support structure generation are two key steps in 3D printing. The framework of our slicing and support structure generation algorithm is illustrated in Fig. 1.
First, we calculate all slicing planes according to the size of the Brep model. Then, we compute the intersection curves between the faces of the Brep model and each slicing plane, as well as the intersection points between the edges of the Brep model and each slicing plane. These intersection points are used to split the intersection curves into several segments, where the intersection curves only intersect each other, at most, at endpoints. Thus, the intersection points become endpoints of the intersection curves. Lastly, we analyze the intersection curves to obtain a contour curve of the Brep model on each slicing plane.
For support structure generation, we compute the grid points of the Brep model. With the normals of the grid points we compute the supporting region inside, in which hanging points and edges are also detected, to obtain supporting areas for each slicing layer. Lastly, we generate support structures for 3D printing.
Model slicing
Our slicing operations work directly on Brep models. The workflow is as follows.
Generate slicing planes
We compute the height of the Brep model along the slicing direction. We generate the slicing planes according to the distance between two neighbor slicing layers.
Calculate intersections
We compute the intersection curves between each face in the Brep model and each slicing plane, as well as the intersection points between each edge in the Brep model and each slicing plane.
Generate contour curve for each layer
We analyze the intersection curves to obtain a contour curve of the Brep model on each slicing plane.
Generate slicing planes
The slicing direction is perpendicular to the slicing planes. We rotate the Brep model for the Z axis to be in the slicing direction. Then, we calculate the height of the Brep model along the Z axis. The number of slicing planes is the height of the Brep model divided by the distance between the two neighbor slicing planes. We set the Zcoordinate of the lowest point of the Brep model to be 0. All the equations representing slicing planes are obtained as follows:
where d_{sp} is the distance between the two neighbor slicing planes, i = 0, 1, …, \( \left\lfloor \frac{h_B}{d_{sp}}\right\rfloor \), h_{B} is the height of the Brep model along the Z axis, and ⌊∙⌋ is the floor function, which produces the greatest integer less than the given number. Here, d_{sp} is given by the user before 3D printing.
Calculate intersections
In model slicing, the most difficult step is computing the intersection results between faces or edges of the Brep model and each slicing plane. In the Brep model, faces are usually made by trimmed surfaces. Therefore, computing the intersection curves between a face in the Brep model and a slicing plane can be divided into two steps. First, the intersection curves C_{is} are computed between the untrimmed surface of the face and the slicing plane. Second, the intersection curves C_{is} are cut by the boundary of the face.
To speed up computing the intersection curves C_{is} between the untrimmed surface and the slicing plane, we develop several intersection functions, each of which works on a type of surface, such as a plane, sphere, ellipsoid, cylinder, elliptical cylinder, cone, and elliptical cone. The resultant intersection curves depend on the directions of surfaces and slicing planes, as illustrated in Fig. 2. The intersection curves C_{is} are directly discretized during the process of intersection, and thus are converted into a set of polylines {P_{i}  P_{i} = {p_{1}, p_{2}, …, p_{n}}}, where P_{i} is a polyline, p_{k} (k = 1, 2, …, n) is a discrete point, and n is the number of discrete points in the polyline P_{i}.
Computing the intersection results is a difficult task. Numerous cases exist, and these cases should be considered separately. Figure 3 depicts some cases of computing intersection points between the edges of the Brep model and slicing planes. The results depend on the directions of edges and slicing planes.
The flowchart for computing intersection points between the edges of the Brep model and a slicing plane is presented in Fig. 4. First, we determine whether an endpoint of the edge is an intersection point. Thus, we find two adjacent edges of the point. If the two adjacent edges are on the same side of the slicing plane (Fig. 3b, then we abandon the intersection point. If the two adjacent edges are on different sides of the slicing plane (Fig. 3c), then we store the intersection point. If the intersection point is on an edge but is not the endpoint of the edge, then the intersection point divides the edge into two segments. If the two segments are on the same side of the slicing plane (Fig. 3d), then we abandon the intersection point. If the two segments are on different sides of the slicing plane (Fig. 3a), then we store the intersection point. If the edge is on the slicing plane (Fig. 3e), then we store two endpoints of the edge.
Generate contour curve
Before generating contour curves, we use the intersection points between the edges and each slicing plane to split the intersection curves between the faces and each slicing plane into several segments, such that each intersection curve segment intersects each other segment, at most, at endpoints. An intersection point should be at least on an intersection curve because an edge should be on a face. Thus, the splitting can be performed. We then connect the intersection curve segments of the splitting results to form loops, which are the contour curves on the Brep model and the slicing planes.
Support structure generation
For fuseddeposition 3D printing, support structure generation is necessary for hanging parts of models. Otherwise, 3D printing may fail because of gravity. Our support structure generation can be performed automatically. The workflow is as follows.

Generate Grid Points: Grid points are sampled directly on the Brep models, and the normals, height, and support type information are stored.

Detect Hanging Edges/Points: Hanging edges and points that may be missing during sampling are detected.

Generate Supporting Areas: Supporting areas are generated according to the results of the above two steps.
Supporting types
In our support structure generation, supporting is classified into the following three types.

None: Indicates that the grid point has no specific supporting type.

ForceSupport: Indicates that the grid point is a forced supporting point.

ForceNoSupport: Indicates that no support can be imposed on the grid point.
The three supporting types can be manually set on some grid points. As support structures may make touch points on models less smooth, it is necessary to manually set the supporting types on some grid points, so as to guarantee the quality of some parts of models.
Generate grid points
We create points evenly along the Xaxis and Yaxis. Then, we project these points on the Brep models along the Zaxis to generate the grid points on the Brep models. These grid points are also the sample points on the Brep models. We calculate the normals and the height values at the grid points, and store the support types at the grid points.
Detect hanging edges and points
Given that edges and vertices are crucial on the Brep models, they must also be detected. If we find that edges or vertices on the Brep models are hanging, then we will set them with the supporting type ForceSupport. The edges that are hanging are called hanging edges, and the vertices that are hanging are called hanging points. The flowcharts for detecting hanging edges and points are presented in Figs. 5 and 6, respectively.
As shown in Fig. 5, we judge whether an edge has 2 adjacent faces. If the edge has 2 adjacent faces, we judge whether the angle of these adjacent faces is smaller than a threshold cos_angle. Then, we discretize the edge and judge whether the discrete point is pointing downwards. We calculate the angle between the normal of the discrete point and the vector (0, 0, − 1). If the angle is smaller than cos_angle, we consider the point as pointing downwards, and mark the point as ForceSupport. The value of cos_angle is π/3.
As shown in Fig. 6, there are two kinds of vertices which are hanging points. The first one is the cone apex. If the vertex is the cone apex and the vertex is pointing downwards, we mark this vertex as ForceSupport. The algorithm for determining whether the vertex is pointing downwards is described above. The second kind of vertex, which is a hanging point, is a vertex in which all of its adjacent edges are above it. We calculate all the endpoints of its adjacent edges, and if the z values of these endpoints are not smaller than the z value of the vertex, we mark the vertex as ForceSupport.
Generate supporting areas
We add all grid points with the supporting type ForceSupport, hanging edges, and hanging points into the supporting areas. We calculate the angles between the normals of grid points with the supporting type None and the Xaxis. If angles are greater than a threshold, then the grid points are added to the supporting areas. Lastly, we remove all the grid points with the supporting type ForceNoSupport from the supporting areas. Support structures are generated after the final supporting areas are obtained.