## 3 Proposed Method
### MSR Generation Using T-Spline Local Refinement
#### 3.2.1 Topological Stage of MSR Generation  
The topological stage of MSR serves the purpose of new control points insertion near the boundaries of sub-regions. In this section, the concept of PolyBoundingBox is proposed to insert control points based on the minimum bounding box of sub-regions. The minimum bounding box for the sub-region is the box with the smallest Euclidean distance measurement for all sampling points in the sub-region. The minimum bounding box of the sub-region can be obtained by means of minimum and maximum coordinate values of sampling points in the sub-region. We denote \(b_{smin}\), \(b_{tmin}\), \(b_{smax}\), and \(b_{tmax}\) as the minimum and maximum coordinate values of sampling points in \(s\) and \(t\) parametric directions, respectively. Then the minimum bounding box of the sub-region is defined by \([b_{smin}\), \(b_{tmin}]\)\(\otimes\)\([b_{smax}\), \(b_{tmax}]\).  
\[b_{r}=\frac{n_{s}}{n_{t}} \tag{12}\]  
The PolyBoundingBox (**B**) consists of a set of a minimum bounding box (\(boxi\)), which is constructed iteratively based on the box-sampling ratio (\(b_{r}\)) defined using Equation (12). For each of the minimum bounding boxes, \(n_{s}\) is the number of sampling points belong to the sub-region, and \(n_{t}\) is the total number of sampling points in the current minimum bounding box. A preset value (\(tor\)) is provided by user to control the termination of PolyBoundingBox construction. The procedure of PolyBoundingBox construction is shown in Algorithm 1.  
```
Input: sub-region, \(tor\). Output: A set of minimum bounding box (**B**). Step 1. Add current sub-region into area list **A**, Step 2. When **A** is not empty, travel all elements in **A**, Step 2.1. Denote \(a_{i}\) is an element in **A**, start to construct minimum bounding box from the middle line of \(a_{i}\) by appending lines before and after it repeatedly, calculate \(b_{r}\) for each iteration, and the minimum bounding box (\(boxi\)) is finished until the \(b_{r}\) is smaller than \(tor\), Step 2.2. Add \(boxi\) into **B**, Step 2.3. Divide current area \(a_{i}\) into multi-areas using connected component analysis method, and add them into **A**. Step 3. Expand operation is performed for each minimum bounding box in **B** to connect all minimum bounding boxes.
```  
**Algorithm 1** PolyBoundingBox construction algorithm for each sub-region.  
Figure 5 shows the construction of PolyBoundingBox, and \(tor\) is set to 70%. Figure 5a presents a watershed result colored in red, the middle line is found and drawn in a dashed orange line, the current minimum bounding box is constructed in a green box, and \(b_{r}=88.9\%\) that is bigger than \(tor\). Figure 5b gives the next minimum bounding box of Figure 5a, and \(b_{r}=66.7\%\) that is smaller than \(tor\). Hence, the current construction is finished, and the minimum bounding box in Figure 5a is selected. The other area is divided into two sub-areas, and the similar process is executed as shown in Figure 5c. The \(b_{r}\) is 71.4%, 88.9%, 76.2% from top to bottom that are both bigger than \(tor\) in Figure 5c. The expand result is presented in Figure 5d using the half length of the sampling interval, and colored in black boxes.  
The preset value (_tor_) is critical for PolyBoundingBox construction. When using smaller _tor_, less poly lines are used to construct PolyBoundingBox roughly, which will introduce fewer control points and improve computational efficiency and vice versa. A proper value should be specified for PolyBoundingBox construction. Geometrical stage is executed since PolyBoundingBox is constructed.