Abstract
To achieve accuracy when customizing knitted products, the size parameters of various parts of the user's body, such as arm length and waist circumference, are obtained via manual measurement or three-dimensional scanning. However, for customized products such as medical socks, which have high-precision design requirements, the existing customization design methods can only ensure the accuracy of key data, such as foot length and foot height, but cannot meet the requirements for all-round customization based on users' foot data. To improve design accuracy, this study proposes a method to generate automatically a continuous set of fine size parameters that are required for knitting from a three-dimensional model of socks based on the idea of simulated knitting. Specifically, a region segmentation method based on the shape diameter function and model skeleton is developed. The sock model is divided into regions such as heel, foot, and toe, which correspond to the knitting process. In addition, a method to simulate the knitting process of a sock machine is developed, which enables loop-by-loop knitting using a sock machine via layer-by-layer iterative sampling on the surface of the model. The sampling axis is generated based on the model skeleton as the direction of sock knitting for the simulation. In the process of simulating knitting, the knitting method is switched between the divided area. Then, the knitting path of the yarn and the parameters required for the simulated sock machine that meet the sock-making process conditions are obtained. Finally, actual socks are knitted using the machine with the obtained knitting parameters, and the proportion of each area of the socks is compared with that of the model. The error is less than 6%. The proposed method can improve the production accuracy of customized socks, which is of great significance for improving the three-dimensional molding technology of socks.
Socks are an indispensable knitted product in everyday life, and the development trend of this industry is leaning toward meeting the individual needs of users. In the traditional design method of socks, it is necessary to thread according to the designed socks process, pass multiple tests, modify the process to meet the requirements, and finally, confirm the process list for the machine. 1 For customized socks, such as medical socks and sports socks, the knitting parameters of ordinary socks cannot meet the accuracy requirements of the target user's foot, which leads to repeated proofing and reduced design efficiency. Thus, a set of continuous and accurate knitting parameters must be obtained through three-dimensional (3D) design, which can improve design accuracy, reduce the time spent on design proofing, and enable quick customization of socks for target users.
This study intends to customize products that can directly generate the weaving parameters required for production from the 3D model to improve the speed and accuracy of production design. Many previous studies have comprehensively investigated this aspect. Hofmann et al. proposed a system that can be used for the machine weaving of custom textiles; it generates hand-woven parameters from two-dimensional (2D) texture patterns, but not textile parameters generated by 3D models. 2 Igarashi et al. proposed a method to convert a 3D model into a 2D knitting pattern, in which the 2D knitting pattern can be manually knitted to obtain a 3D knitted fabric. However, this method is operationally expensive and can only be used for manual knitting; thus, it cannot be used in batches. 3 Wu et al. first proposed a method that can convert a 3D model into a knitting model with a knitting grid to represent loops. However, each row of the knitting model is independent of the others; therefore, the model does not conform to the actual knitting process. 4 Subsequently, Wu et al. proposed a knitted mesh that can transform a 3D mesh into a stitched mesh that can be manually knitted; however, it cannot be mass-produced owing to the need for manual weaving. 5 Narayanan et al. proposed a method that can turn a mesh model into knitting instructions for knitting on a V-shaped needle bed. 6 However, this method can only be used for V-shaped needle beds, and in the process of transition, the user must manually select the start and end positions of knitting, which increases the learning cost. Ruan et al. proposed a method to convert the grid model of socks into knitting parameters and knit on the machine, but this method needs to select manually the position of the sock top and the sock toe, which is not easy to operate. 7
For knitted socks, the knitting process is relatively fixed. Socks are primarily composed of cylinders and bags. When knitting and forming, the sock machine is used for tubular knitting. According to the area of the socks ‘sock top > sock tube > sock heel > sock foot >sock toe’, which corresponds to ‘flat stitch > addition and subtraction stitches > flat stitch > addition and subtraction stitches’, in which the toe and heel of the socks are formed by adding and subtracting needles to form a pocket area. Therefore, in the process analysis of the 3D model, the two types of shapes, that is, the cylindrical and bag shapes, can be analyzed by region.
The model is typically divided into regions according to the afore-mentioned sock features. Several previous studies have examined the area segmentation of 3D models. For example, Au et al. proposed region segmentation of a model using model concave information. 8 However, this method is unsuitable for hosiery models with different surface concavities and complex changing speeds, which will segment many regions of different sizes and shapes. 8 Shapira et al. proposed a segmentation method based on the shape diameter function that can extract the model skeleton. 9 The shape diameter function is a scalar value that reflects the thickness of the model, and the overall thickness outside the toe area of the hosiery model is essentially the same. Therefore, the shape diameter function alone cannot accurately segment the heel and toe areas.
This study proposes a region segmentation method that is suitable for hosiery models based on the shape diameter function and extracts the skeleton of the model. The shape diameter function value and model skeleton are used to segment the toe and heel regions of the sock model, respectively. This study also develops a method iteratively to sample the knitting process of the sock machine line–byline on the surface of the model, generate the yarn knitting path during the knitting simulation of the sock machine, including the grid shape and size characteristics, and record and calculate the number of laps and lap heights required for knitting using the sock machine. Finally, the obtained parameters are used to knit on a circular sock machine and the size parameters and ratio of each area between the input model and sock sample are compared. The research purpose of this paper is to reduce the large amount of time consumed in the design of customized socks, improve design accuracy, and to provide ideas for the method of converting 3D models into knitting parameters.
Methods
The 3D model of the sock (Figure 1(a)) is first input. Then, the sock top ring (Figure 1(b)) and skeleton of the sock model (Figure 1(c)) are automatically calculated, and the heel and toe areas are segmented (Figure 1(d)). Then, the knitting path of the sock machine is simulated through iterative sampling (Figure 1(e)), and the number of turns and lap heights in each area are recorded during iteration to generate the chain file required for the production of the sock machine (Figure 1(f)). Finally, knitting is performed on the machine to obtain the sample (Figure 1(g)).

(a) input model; (b) automatic calculation of sock top ring; (c) automatic calculation of model skeleton; (d) automatic area segmentation; (e) cyclic sampling; (f) output knitting path map and parameters required for on-machine; and (g) machine knitting.
Input
For the input mesh model, users can use 3D modeling software to create a suitable model or use 3D scanning to obtain model parameters. The input model requires a raised shape, and the input parameter is the number of knitting needles, n.
Sock top ring
After inputting the model, the system automatically obtains the position where the socks start knitting, which corresponds to the ‘sock top ring’ on the model. The algorithm to obtain the sock ring is as follows.
In the first step, the mesh repair algorithm is used to obtain the point set

Obtaining the sock top ring (a) get the sock top and mid point P1 (b) Get the orientation of the set F(c) equally spaced reordering.
The second step for the unordered point set
In the third step for the ordered point set
Sampling axis extraction
This study extracts the sampling axis used in the iterative sampling of the model based on the skeleton of the model. The function of the sampling axis is to provide the sampling direction and correct for the distance between sampling points during sampling. Because there is no bifurcation in the sock model, the skeleton extraction method proposed by Shapira et al. is simplified. 9 Thus, the skeleton extraction method is more targeted and the algorithm is simpler. 2 The method used to extract the sampling axis consists of the following six steps (see Figure 3).

Model skeleton extraction: (a) input model; (b) inward projection; (c) fitting a two-dimensional (2D) point cloud; (d) extracting disordered skeleton points; (e) skeleton points are sorted and connected; and (f) sampling axis supplementary correction.
The first step is to use the Shapira method to calculate the shape diameter function value of each point (equation (1))
9
,17 and project each point on the surface of the model along the opposite direction of its normal vector using the distance of the shape diameter function value to obtain the point cloud
In the second step, the Lee method is used,
14
and a 2D point cloud
The third step uses the distance between the point
The fourth step repeats the operation of the third step for all clusters to obtain all the disordered skeleton points of the model (
The fifth step reorders and connects the disordered skeleton points (
In the sixth step, the skeleton
Segmentation of toe
In this study, the toe region is segmented based on the value of the shape diameter function. This study provides a segmentation method for the toe region of the sock model based on the normalized shape diameter function value. The specific method is as follows.
In the first step, the shape diameter function value of each point is calculated for the input sock model, and statistics are obtained.
For the second step, the shape diameter function value of the obtained point is normalized, and the normalization method adopts the Shapira method, as follows:
9
In the third step, the part with the smaller normalized shape diameter function value is selected as the segmentation region of the toe part. It can be observed in Figure 4 that the normalized shape diameter function value begins to exhibit an upward trend immediately after the first high peak value. In the corresponding hosiery model, after the sudden change of the toe part, the thickness of the model gradually increases from the toe to the heel, and the thickness reaches its maximum value at the heel. Therefore, the normalized shape diameter function value of the upward trend starting position is used as the segmentation criterion, and all points below this value are used as the toe area.

Statistical plot of normalized value of sock shape diameter function.
Segmentation of heel
The sock heel region is segmented based on the skeleton of the model (Figure 5). The first step is to determine the skeleton turning point

Calculation flowchart of heel area.

Skeleton turning point extraction.

Fit segmentation vector (a) the method of fitting a straight line (b)proximity method.

Heel area segmentation (a) get the segmentation plane (b) determine the dividing angle (c) determine the segmented area.
Skeleton turning point
The skeleton turning point
Two-segment region fitting of skeleton
The first step is based on the turning point
Sock heel area segmentation
Finally, the heel region of the socks is divided based on the segmentation vector
The first step is to find the segmentation plane
The second step is to determine the dividing angle. The angle between the sock heel segmentation vectors
The third step is to determine the segmented area. All points
Iterative sampling
The weaving path considered in this study consists of sampling nodes that represent the fabric coil units. The developed method gradually generates sampling nodes containing the features of the row-and-column structure based on the structure of the socks. The calculation of the sampling node is based on the sampling axis of the model, and the iterative sampling method is used on the surface of the model to re-divide the weaving path to simulate the actual weaving process. The following introduces the basic concept of the row-column structure, the method of iterative sampling, and the method used by the sampling axis.
Row-column structure
As shown in Figure 9, the weft-knitted fabric has a row-column structure, wherein the row is connected by the yarn connection of the course, and the column is connected by the longitudinal interlocking of the loops.

Row-column structure.
Sampling nodes represent coils whose arrangement exhibits the characteristics of a row-column structure. The horizontal length of the stitched grid is the width

Row-column structure.
Initial setting
The only parameters that the user needs to input manually are the model and the initial number of needles
Iterative sampling
After the sock top ring and region segmentation are calculated, the next iterative sampling begins. Taking the initial sampling point
As shown in Figure 11, due to the compression and stretching of the heel of the sock, the course spacing of the sock will change at different positions. Therefore, the sampling distance must be corrected when selecting the default sampling point in the next row. The reference for the corrected distance is the angle between the normal vector of the initial point

Course spacing variation.

Cycle sampling in the direction of the sampling axis and adjust the sampling distance.
The sampling axis alternatives
In the process of the continuous iteration based on the afore-mentioned method, the center point of the sampling point

Sampling axis alternatives.
Region switching
When the next row of sampling points is sampled to the segmented sock heel area, the sampling method to is switched to ‘heel’. After sampling at the heel part, sampling switches to the foot part. The sampling method of the sock foot is the same as that of the sock tube. The sampling axis is the iterative sampling direction, and the sampling interval is adjusted during sampling until the sampling reaches the toe area of the area division, that is, the sampling point of the next line is completely inside the segmented area. After the sampling of the toe part is completed, the knitting path diagram is completed. In addition, the number of rows sampled in each area and the row height of each sampled row required for knitting using the sock machine are simultaneously derived (Figure 14).

Sampling mode area switching.
Results and discussion
The algorithm employed in this study is developed using a PC equipped with Visual Studio 2019 development tools and C/C++ development components in a Windows environment. The selected socks model is sourced from various open-source websites as well as paid model websites. The WLT-6F fully computerized sock machine is selected as the model used for the knitting test, and its specification is 144 needles.
To verify the adaptability of the proposed method to different types of socks, this study adopts the low-cut sock model, quarter sock model, crew sock model, and quarter sock model with a different width and foot length.
Region segmentation
This study examines and compares the effect of the regional segmentation of the toe and heel for each model in this algorithm. In the regional segmentation of the toe part, the normalization parameter α that is selected is 4. According to the statistics of Figure 4, the normalized shape diameter function value starts to show a second upward trend at 0.56, so the normalized shape diameter function value of the toe part is 0.56. The calculation results for the toe and heel regions of the sock model are presented in Table 1. The comparison shows that the algorithm for the toe and heel is versatile for different types of sock models, and the segmentation effect is good.
Region segmentation effect, knitting path, and knitting socks machine effect
Knitting path
This study obtains the knitting path by the iterative sampling of each sock model. The number of needles
Sock machine knitting effect
The obtained parameters are input into the sock machine, and the knitting effect shown in Table 1 is finally obtained. As a result of the preset pattern file of the machine, the color of the used yarn is changed before entering the toe; thus, the actual toe area is smaller than the pattern area. The blue area representing the toe in Table 1 is drawn along the suture line in Figure 15 (indicated by Figure 13 and the blue area in Table 1).

The actual toe area.
The comparison between the knitting effect of the sock machine and the algorithm calculation effect
The actual knit effect is compared with the algorithm calculated effect. For the heel part, the ratio of the length of the knitting part from the sock top to the heel (Figure 16(a)) and the height of the overall sock (Figure 16(b)) are selected as the first part to be compared. The ratio of the length of the overall sock minus the length of the heel part (Figure 16(d)) and the length of the overall sock (Figure 16(e)) is used as the second part of the comparison. By comparing the actual knitted socks and the ratio of the two parts calculated by the algorithm, the accuracy of partial region segmentation of the socks is verified. For the toe part, the ratio of the length of the toe part (Figure 16(c)) to the length of the overall sock (Figure 16(e)) is selected as a scalar to verify the accuracy of the toe region segmentation. The actual toe area and that obtained by the algorithm are similar, verifying the accuracy of the segmentation of the toe area. At the same time, we select one half of the circumference of the sock top (Figure 16(f)) and one half of the circumference of the middle of the sock foot (Figure 16(g)) to verify the accuracy of the width of the model. Finally, this paper enlarges the part of the sample to obtain a local map to reflect the accuracy of iterative sampling (Figure 13).

Various measurement sections using quarter socks as an example and the local maps (a) the length of the knitting part from the sock top to the heel (b) the height of the overall sock (c) the length of the toe part (d) the length of the overall sock minus the length of the heel part (e) the length of the overall sock (f) one half of the circumference of the sock top (g) one half of the circumference of the middle of the sock foot (i) the local maps.
The regional segmentation effects of the heel and toe of each model are compared. The actual data obtained by the algorithm is compared with the data obtained by knitting on the machine. The parameters are compared in Table 2.
Dimensions and proportions of each part of the area
Comparing of various types of models with the key parameters of the socks knitted by the sock machine reveals an error lower than 6% (Figure 17).

Proportional errors of various parts of socks.
Conclusions
This study introduces a region segmentation method for socks based on the shape diameter function, which can obtain the segmentation effect of the heel and toe regions of the sock model. The iterative sampling results of the entire sock is obtained using the calculated segmentation area and sampling axis for iterative sampling, and the production process of the sock is simulated. After the key data are obtained at the end of the sampling, the chain file required for knitting on the machine can be modified according to the obtained data. Compared with the existing computer-aided hosiery design system, the user operation cost is reduced and the accuracy is improved.
Footnotes
Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) disclosed the receipt of the following financial support for the research, authorship, and/or publication of this article: Zhejiang Provincial Public Service Technology Research Project (grant NO. LGG21E050024).
