# Combination Constraints of Multiple Fields for Implicit Modeling of Ore Bodies
## 5 Implementation  
The implementation of implicit modeling includes three main steps: evaluation, solution, and surface reconstruction. The evaluation step of implicit function is the basis of the solution and surface reconstruction steps. The efficiency of iterative solution and isosurface extraction depends on the efficiency of evaluation. Each sub-field of the combined implicit function field can be solved separately. The implicit surface with multiple fields should be reconstructed using multi-domain (or multi-material) isosurface extraction methods [34; 38]. If the combined potential field implicit function is regarded as a single field, the surface reconstruction of the combined potential field is the same as the single field.  
We mainly focus on the evaluation of the combined implicit function. For a given point, there are several labeled function values to be determined for each sub-field, which reduces the efficiency of evaluation. In fact, it is not necessary to calculate some invalid labeled function values for the points outside the corresponding bounding box. For the combination rules with modeling sequence, the sub-fields can be evaluated in order of priority, from high to low. Moreover, compared with the evaluation of function value, it is more efficient to evaluate whether a point is inside a bounding box or not. Therefore, more than one sub-field is evaluated only in the region where the corresponding bounding boxes overlap.  
Every node of the operation tree is specified a bounding box. The function values can be evaluated in a traversal way based on the hierarchical bounding box of the operation tree. For a given point, some invalid nodes will not be evaluated to avoid unnecessary calculations. Based on the above analysis, the evaluation efficiency of the combined implicit function is improved to accelerate the speed of implicit surface reconstruction.  
Given a point \(\mathbf{x}\), the improved evaluation method for the combined implicit function \(F(\mathbf{x})\) is given below.  
Step 1: Solve the implicit function for each sub-field separately;  
Step 2: Obtain the operation tree according to the specified hierarchical combination operations;  
Step 3: Specify the bounding box for each leaf node of the operation tree. For a leaf node, compute the minimum bounding box based on the corresponding sampling data. Then, extend the box by a factor according to the reconstruction result until it obtains a desired result;  
Step 4: Traversing the operation tree from bottom to top, compute the optimal oriented bounding box for each non-leaf node of the operation tree. Among them, the bounding box of a non-leaf node is calculated by the combination operation of its child nodes;  
Step 5: Traversing the operation tree from top to bottom, evaluate whether the given point \(\mathbf{x}\) is inside the bounding box of each node or not. If \(\mathbf{x}\) is inside the bounding box of a node \(M_{i}\), node \(M_{i}\) is a valid node and its child nodes should be judged in the same way. If \(\mathbf{x}\) is outside the bounding box of a node \(N_{i}\), node \(N_{i}\) and all of its child nodes are invalid nodes;  
Step 6: After the traversal is completed, the valid sub-fields \(\{f_{i}\}\) in the leaf nodes that have an influence on the evaluation point \(\mathbf{x}\) can be obtained;  
Step 7: Compute the corresponding labeled function values \(\{f_{i}(\mathbf{x})\}\) of the sub-fields at the valid leaf nodes. For the RBF-based implicit functions, the fast multipole method [39] can be used to further improve the evaluation efficiency of sub-fields;  
Step 8: Traversing the operation tree from bottom to top, compute the function value of each node that has an influence on the evaluation point \(\mathbf{x}\) according to the corresponding combination operations;  
Step 9: Finally, the function value of the root node is the combined value of \(F(\mathbf{x})\).