# A G-Code Generator for Volumetric Models
## 4 Test Results
### Orientation and Support Structure Generation  
At first, we conducted a test to verify the effectiveness of our orientation algorithm and support structure generation method. Five volumetric models served as the input models in the test. We named these models stick, bone, lung, mushroom, and bonsai in this work. Three of them are shown in Figure 8a, including the stick, bone, and lung models (from the top to the bottom). The image of the mushroom model can be found in Figure 2a. The stick model is created by using a constructive solid geometry modeler. The bone and lung are segmented from a CT-scan data set. Originally, the  
Figure 7: Encoding a toolpath into a series of G-codes.  
mushroom is a polygonal model. We discretized it into a voxel-based representation by using the preprocessor of our slicer. Then, these models were oriented by our slicer. Parts of the results are shown in Figures 8b and 2b. At the following step, support structures are generated for both the input and oriented models. The support structures of the stick, bone, and lung models are revealed in parts (c) and (d) of Figure 8, and the support structures of the mushroom are shown in Figure 2c,d.  
To produce an objective comparison, the heights and the volumes of the support structures of the original and rotated models were calculated and recorded during the computations. The results are measured in voxels and are listed in Table 1. The first column contains the names of the models. The heights of the input and oriented models are recorded in the second and third columns, while the volumes of support structures of the input and oriented models are displayed in columns 4 and 5. As the numbers in column 2 and 3 show, the orientation process reduced the heights of these models. The height of the stick model was reduced by more than 72%, while the heights of other models were reduced by 17.6%, 21.2%, 44%, and 34%, respectively. Since the heights of these models were reduced, less slices will be produced in the following G-code generation process, and the build times of these objects will be decreased [20].  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline \multirow{2}{*}{**Data Sets**} & \multicolumn{2}{c}{**Height (in Voxels)**} & \multicolumn{2}{c}{**Volume of Support Structure**} \\ \cline{2-5}  & **Original** & **Oriented** & **Original** & **Oriented** \\ \hline Stick & 150 & 42 & 24,731 & 3632 \\ \hline Bone & 324 & 267 & 499,806 & 405,050 \\ \hline Lung & 316 & 249 & 239,469 & 202,182 \\ \hline Mushroom & 207 & 116 & 67,388 & 50,390 \\ \hline Bonsai & 256 & 169 & 1,311,485 & 1,026,258 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Heights and volumes of support structures of the test data (measured in voxels).  
Figure 8: Images of the stick, bone, and lung models; (**a**) the raw models, (**b**) oriented models, (**c**) support structures of the raw models, and (**d**) support structures of the oriented models.  
By maximizing their moments of inertia, the oriented models were more stable than the input geometries. They needed less support structures, as shown in columns 4 and 5 of Table 1. The stick model gained a significant improvement (more than 85%). The reductions of support structure for the other models were 18.9%, 15.6%, 33.7%, and 21.7%, respectively. By examining the images of Figures 2 and 8, these improvements can also be visually verified. In these images, the \(x\), \(y\), and \(z\) axes of the data space are rendered in red, green, and blue colors. The \(z\) axis is pointed vertically, while these other 2 axes are rotated to reveal more details of the models. These images are produced by our visualization module using volume rendering.