## 2 Reconstruction of Polycrystalline Model
### NURBS Characterization of Grains
Figure 9 illustrates the control points and corresponding NURBS curves resulting from this algorithm, representing the pixelated polycrystalline microstructure depicted in Figure 1. However, as described next, the construction of these NURBS curves is not simple and requires further processing, as individual grains and their boundaries are unidentified at this stage and we only have two sets of points representing the entire polycrystalline microstructure (sharp corners of grains and control points on their boundaries). Figure 8: Optimal locations of control points. Figure 9: NURBS characterization of grain boundaries. To identify individual grains, we first use the Moore-neighbor contour tracing algorithm with [PERSON]'s stopping criterion [42] to obtain a sorted set of points along grain boundaries (cyan points in Figure 10). This algorithm begins at one of the black boundary pixels of a grain boundary (the start pixel) in the skeleton image and explores its Moore neighborhood (eight adjacent pixels) in the counterclockwise direction [40] to find the next boundary pixel. This algorithm sorts a set of pixels that represent an individual grain counterclockwise, with [PERSON]'s stopping criterion ensuring that the algorithm terminates when the tracer re-enters the start pixel. After identifying/sorting pixels of all grains, we must identify the NURBS control points belonging to each grain. First, the control points located inside the bounding box (BBox) of each grain, enlarged by a factor of \(1.5l_{\text{gs}}\), are identified (dark blue and yellow points in Figure 10). Next, we identify control points within the distance \(l_{\text{gs}}\) from the sorted grain boundary points previously obtained using the Moore-neighbor contour tracing algorithm. This step is essential to filter out control points belonging to the current (visited) grain (dark blue points in Figure 10) and exclude those of adjacent grains (yellow points). Sharp corners of each grain are identified similarly. The next step is to identify highly convex grains using a convexity measure \(k_{\text{conv}}\)[43], which is the ratio of the grain's area to the area of its convex hull (the smallest convex polygon containing all of its sharp corners and control points [35]). For grains that do not deviate very much from their convex hull, identified with \(k_{\text{conv}}>0.85\), the sharp corners and control points are sorted in a counterclockwise order based on the angle they make with the grain's centroid. Sorting these points allows the grain geometry to be characterized as a set of NURBS curves between its consecutive sharp corners, as shown in Figure 9. However, when \(k_{\text{conv}}<0.85\) (cf. Figure 11), using a centroidal angle-based algorithm to sort the sharp corners and control points may yield erroneous results due to the concave shape of the grain. In such scenarios, we again employ the boundary points obtained using the Moore-neighbor contour tracing algorithm, which are already sorted in counterclockwise order (the cyan points in Figure 10), to sort the control points. Figure 12 illustrates the final NURBS representation of the polycrystalline microstructure image depicted in Figure 3. The pseudocode of the algorithm for reconstructing this NURBS model described above is summarized in Algorithm 1. Figure 10: Procedure to determine the NURBS control points and grain vertices for the current grain from the global set of control points (cf. blue points in Figure 9) and sharp corners (cf. red points in Figure 9).