# Build Orientation Optimization Based on Weighted Analysis of Local Surface Region Curvature
## 3 Methodology
### Surface Region Analysis
#### 3.1.3 Curvature Shift  
Curvature shift algorithm refers to an iterative step, similar with the mean shift strategy: calculate the average of the current point offset, move the point to its offset average, then use the shifted point as a new starting point and continue to move until satisfying certain conditions. As shown in Figure 3(a), the curvature shift strategy is implemented as follows: the center of the blue circle is selected as the initial point, and all the curvature vectors in the blue circle (the radius is denoted as \(h\)) are added together. The average curvature vector is shown as a red arrow and the red dot is the new starting point of the next iteration. The process iterates until the center of the circle converges to a fixed point, which is the position of the maximum probability density. The points with similar curvatures form a cluster centered on the point with the maximum curvature. Therefore, the curvature shift is essentially a gradient-based optimization algorithm. The curvature shift indicates the curvature vector always shifts to the maximum curvature density on the surface. In each cluster of point set, the center of the cluster is located at the point with the maximum curvature. The curvature shift vector(\(C_{sv}\)) is defined to represent the average shift vector in a local sample point set. Given a set of points in \(R^{d}=x_{i},i=1,2,\ldots,n\), the maximum curvature of \(x_{i}\) is \(c_{i}\). The definition of \(C_{sv}\) is as follows:  
\[C_{sv}=\frac{1}{k}\sum_{x_{i}\in S_{h}}(x_{i}-\bar{x})\cdot w(c_{i})=\frac{1}{ k}\sum_{x_{i}\in S_{h}}\bar{v_{i}}\cdot\frac{c_{i}}{\sum_{i=1}^{n}c_{i}} \tag{7}\]  
where \(S_{h}\) is a high dimensional sphere with a radius of \(h:S_{h}(x)=\left\{y:(y-x)^{T}(y-x)\leq h^{2}\right\}\), \(k\) represents there are \(k\) points located in the sphere, \(\bar{v_{i}}\) is the shift vector and \(w(c_{i})\) is the curvature weight factor for determining the vector offset. Based on the strategy of curvature shift, more points in \(S_{h}\) are distributed along the curvature density. Therefore, the \(C_{sv}\) should point to the direction of curvature density just as shown in Figure 3(b). Before that, we do not consider the distance factor in calculation of the curvature shift vector. As long as the projections of two sampling points in the direction of the mean vector are equal, they contribute equally to the calculation of the curvature shift vector. Therefore, the intention of introducing the kernel in curvature shift is that the contribution of the  
Figure 4: Curvature shift strategy. offset to \(C_{sv}\) is different as the distance between the sample point and the offset point is different. Gaussian kernel is introduced in curvature shift:  
\[k(x_{i})=\frac{1}{\sigma\cdot\sqrt{2\pi}}\cdot e^{-\frac{\left|x_{i}-\right|^{2} }{2\sigma^{2}}} \tag{8}\]  
in extending the curvature shift algorithm, a weight coefficient is set for each sample point, so that the importance of different sample points for calculating \(C_{sv}\) is different. Combining kernel functions and sample point weights, \(C_{sv}\) has the following form:  
\[C_{sv}(c_{i})=\frac{\sum_{i=1}^{n}G_{h}(c_{i}-\bar{c})w(c_{i})(c_{i}-\bar{c})} {G_{h}(c_{i}-\bar{c})w(c_{i})} \tag{9}\]  
where \(G_{h}\) is a unit kernel function, \(H\) is a bandwidth matrix, \(w(c_{i})\) is the weight factor of sample point. In practical applications, the bandwidth matrix \(H\) is often limited to a diagonal matrix. In particular, the most common bandwidth matrix is \(H=h^{2}I\). To simplify the mathematical model subject to the normal distribution, let \(\sigma=1\) and \(b=0\).