# Build Orientation Optimization Based on Weighted Analysis of Local Surface Region Curvature
## 4 Optimal Build Orientation  
The fabricated part based on the CAD model should get the best surface quality and shape precision when printed in the optimal orientation. However, when the model designed by the computer becomes more complicated, the optimal process of orientation is a paradox. One surface gets better quality, while the other side may sacrifice the quality and geometry precision. What is more, the build time and support structure cannot be considered at the same time. Lots of researchers focus on multi-object optimization, it is still difficult to find the optimal balance among the different factors. Actually, what we need most is to get the best performance requirements when given the single constrain. Therefore, the surface quality is the only factor we consider. Even if one factor considered, we do not take all the surface into account when analyzing the model. The key region of the model concerns us most. Therefore, geometry analysis on the model based on curvature shift is implemented to get the key regions of the model. Those regions contribute more than the others when determining the optimal orientation. To get the optimal build orientation, the volume error function proposed in [13] is adopted. [28] also proposed the cusp height to measure the fabricate error when the surface of the model has a specific angle with the build orientation. The volume error function is given as follows:  
\[\Delta V=\frac{1}{2}C_{\text{cusp}}\cdot\Delta F=\frac{l}{2}|cos\theta_{i}| \cdot\Delta F. \tag{14}\]  
where \(l\) is the layer thickness. Assume the given model has \(m\) facets, the volume error function is:  
\[V=\frac{l}{2}\cdot\sum_{i=1}^{n}\left|\vec{d}\cdot\vec{n}_{i}\right| \tag{15}\]  
The total volume error \(V\) is determined by the sum of the absolute values of the dot product along the build orientation \(\vec{d}\) and the facet normal \(\vec{n}_{i}\). To minimize the \(V\), we just need to determine a orientation which minimizes the sum of value of the dot products of \(\vec{d}\) and \(\vec{n}_{i}\). In the volume error function, \(\vec{n}_{i}\) are of the equal importance to the determination of build orientation \(\vec{d}\). Now that the various regions of the model have different performance requirements. Geometry analysis is implemented so that more important regions can be distributed a bigger weight to contribute more on the process of the optimization. Therefore, adding the weight factor, the volume error function is revised by the following equation:  
\[V=\frac{l}{2}\cdot\sum_{i=1}^{n}\left|\vec{d}\cdot w_{fi}\cdot\vec{n}_{i}\right| \tag{16}\]  
In order to solve the optimal solution to the volume error function, we apply the method proposed by [13]. The minimization of the volume error function is equal to this question: given a weighted normal set \(\vec{N}=\{\vec{n}_{1},\vec{n}_{2},\ldots,\vec{n}_{n}\}\), find a unit vector \(\vec{d}\) which can minimize the sum of the projection length \(L_{p}\) of all the normals to \(\vec{d}\). Assuming \(\vec{d}=(a,b,c)^{T}\), \(\vec{n}_{i}=(x_{i},y_{i},z_{i})\), the equation of \(L_{p}\) is determined as follows:  
\[L_{p}=\sum_{i=1}^{n}|\kappa_{i}|=\sum_{i=1}^{n}|ax_{i}+by_{i}+cz_{i}|=\sum_{i =1}^{n}\left|0-\vec{n}_{i}\cdot\vec{d}\right| \tag{17}\]  
\(\kappa_{i}\) is the projection length of \(\vec{n}_{i}\) to \(\vec{d}\), Equation (17) is equivalent to a linear regression problem with minimum absolute deviation. The linear regression parameters can be appropriated by using the least squares criterion instead of the minimum absolute deviation criterion. The parameters are quickly determined with PCA and matrix eigenvector decomposition. The optimal build orientation is chosen from which eigenvector minimizes the volume error function. The entire optimization process is shown in Figure 7. The optimization process first loads the 3D CAD model format. The model adopts the STL(Stereolithography) format. The STL file format can easily obtain the points information and triangle facets information of the model.