Abstract
Hausdorff distance measure is very important in CAD/CAE/CAM related applications. This manuscript presents an efficient framework and two complementary subalgorithms to directly compute the exact Hausdorff distance for general 3D point sets. The first algorithm of Nonoverlap Hausdorff Distance (NOHD) combines branch-and-bound with early breaking to cut down the Octree traversal time in case of spatial nonoverlap. The second algorithm of Overlap Hausdorff Distance (OHD) integrates a point culling strategy and nearest neighbor search to reduce the number of points traversed in case of spatial overlap. The two complementary subalgorithms can achieve a highly efficient and balanced result. Both NOHD and OHD compute the exact Hausdorff distance directly for arbitrary 3D point sets. We conduct a number of experiments on benchmark models and CAD application models, and compare the proposed approach with other state-of-the-art algorithms. The results demonstrate the effectiveness of our method.
Introduction
Distance measure is the fundamental step for many applications in science and engineering areas [15, 41, 68]. Hausdorff distance can quantify the similarity between two arbitrary point sets without the necessity to establish the one-to-one correspondence between them. In most engineering applications, the number of point sets obtained by 3D model is not identical, and it is difficult to establish a one-to-one correspondence between them. Therefore, Hausdorff distance is suitable for measuring similarity between 3D models in engineering practice.
Hausdorff distance has drawn particular attention from scholars in many science and engineering fields, such as CAE/CAD/CAM [40, 68], pattern recognition [52, 63], similarity measure [16, 30, 32, 48], shape matching [5, 70], mesh model simplification [26], reconstruction of curved and surfaces [11, 12, 18, 35], and penetration depth [66, 73].
It is a hard task to improve the efficiency of the algorithm while ensuring the accuracy in calculating the Hausdorff distance. Generally speaking, the similarity measure for 3D models based on Hausdorff distance faces at least three problems: (1) Most of the previous algorithms of similarity measure based on Hausdorff distance have a strong disciplinary background, and are short of generalization; (2) Since the Hausdorff distance measure is computationally intensive, it is restricted to applications for large scale data; (3) Furthermore, in some applications, computing exact Hausdorff distance needs additional cost (for example, 3D point sets are pre-processed and rasterized into voxel models), which worsen efficiency of some state-of-the-art algorithms.
To the best of our knowledge, it is difficult to cover above limitations in one single processing algorithm. For an example, the state-of-the-art algorithm of 2015 (EARLYBREAK) [65] can achieve the high efficiency in processing the medical images (considered as voxel data), while it is low efficiency in calculating spatial objects of highly overlapping.
How to find a new approach to cover above problems as much as possible and achieve an efficient and balanced result is becoming a challenge. In this manuscript, based on whether the pair of point sets are nonoverlaped or overlaped, an efficient computation framework is presented with two complementary subalgorithms, Nonoverlap Hausdorff Distance (NOHD) and Overlapped Hausdorff Distance (OHD).
The NOHD algorithm builds an Octree for input point sets, and uses the principle of branch-and-bound and early breaking to prune the branches of Octree efficiently, which can reduce the number of nodes that have to be traversed. However, the efficiency is poor when applying the NOHD algorithm to two point sets of seriously overlapped. Therefore, we propose the OHD algorithm to solve this problem. The OHD algorithm builds adaptive Octree, and also designs point culling strategy which can reduce the traversed points. Both NOHD and OHD compute the exact Hausdorff distance directly for arbitrary 3D point sets. Under the subalgorithms of NOHD and OHD, we present a new Hausdorff distance computing procedure, which can choose the complementary subalgorithms to compute the Hausdorff distance with different spatial relationship of the pair of point sets.
The remainder of this manuscript is organized as follows. In Section 2, we briefly review the related work. Section 3 describes the problem and challenge for computing Hausdorff distance. In Section 4, we present two novel subalgorithms, the NOHD algorithm and the OHD algorithm. In Section 5 we construct an integrated framework of computing the Hausdorff distance. Section 6 conducts experiments with analysis. Finally, the conclusions and future work are discussed in Section 7.
The research of Hausdorff distance originated from computer vision [23, 25, 31, 46, 59, 61, 62] and was quickly extended to many areas of science and engineering [5, 9, 13, 40, 41, 68].
Curves and surfaces
The problem of efficient calculation of the Hausdorff distance has become a hot topic in this field, has influenced the progress in CAD/CAE/CAM.
Alt et al. [7] presented an algorithm for Hausdorff distance computation based on a characterization of the possible points where the distance can be attained. Chen et al. [18] presented an algorithm for computing the Hausdorff distance between two B-Spline curves, which improves the reference [7] by using a pruning technique to reduce computation time.
Bai et al. [11] presented an algorithm for computing an approximate Hausdorff distance between planar free-form curves by approximating the input curves with polylines and then computing the Hausdorff distance between the line segments. Kim et al. [34] presented a compact representation for the Bounding Volume Hierarchy (BVH) of Non-uniform rational Basis spline (NURBS) surfaces using Coons patches, which could be used to construct a BVH-based algorithm for computing the Hausdorff distance between NURBS surfaces.
Kim et al. [36] developed a real-time algorithm for the precise Hausdorff distance between planar freeform curves using hardware depth buffer.
Recently, Krishnamurthy et al. [28, 38, 39] developed a GPU algorithm that computes the Hausdorff distance between NURBS surfaces. Interactive speeds are obtained by performing GPU traversal of a bounding-box hierarchy and selectively culling pairs of bounding boxes that could not contribute to the Hausdorff distance.
Polygonal models
The Hausdorff distance computation for large polygonal meshes has been a very difficult task to implement for real-time application.
Atallah [9] provided an algorithm for computing the Hausdorff distance for a special case of point sets, namely non-intersecting, convex polygons. The algorithm has the complexity of
Due to the complexity of exactly computing the Hausdorff distance, the approximate algorithms have been proposed as practically solutions [8, 22, 26, 47]. Llanas [47] proposed two approximate algorithms based on random covering for non-convex polytopes. Guthe et al. [26] proposed an approximate algorithm for calculating the Hausdorff distance between mesh surfaces. This algorithm makes use of the specific characteristics of meshes to avoid sampling all points in the compared surfaces. These regions are then further subdivided and regions that cannot attain the Hausdorff distance are purged away.
Tang et al. [66] implemented an approximate algorithm that is based on BVH that is preprocessed in advance (before real-time computation). Their implementation is very fast in practice, running at interactive speed for complicated dynamics scene.
Point sets
Above algorithms are based on the specific characteristics of meshes and thereby lacks generality. Some general methods are proposed. Given two nonempty point-sets with
Alt et al. [5] presented a method based on the Voronoi diagram which requires
Nutanong et al. [54] extended the algorithm proposed in [55] to avoid the iteration of all points in
Taha et al. proposed the randomization and the early breaking optimization in reference [65] to achieve efficient, almost linear, calculation. This optimization avoid scanning all voxel pairs by identifying and skipping unnecessary rounds.
The purpose of this study is to explore a general method to compute the exact Hausdorff distance for CAD/CAE/CAM applications and to ensure the efficiency.
Problem state
Hausdorff distance
The Hausdorff distance [66] is the maximum deviation between two models, measuring how far two point sets are from each other [26]. Given two nonempty point sets
where
The Hausdorff distance is often used in engineering and science for pattern recognition, shape matching and error controlling. If
The basic computing method of the Hausdorff distance is described as Algorithm 1.
The outer loop of the NAIVEHDD algorithm traverses all points in
Taha et al. [65] pointed out that it is not necessary for inner loop (4
The original algorithm published in [65] missed one line and had been corrected in a note.
In Algorithm 2, the event of meeting the condition that
Assuming that the inner loop has been implemented for
The expectation of
According to Eq. (5), the number of tries in the inner loop is inverse proportion to
The larger
Where
After substituting Eq. (6) into Eq. (5), the expectation of
It should be noticed that the smaller
In order to overcome the deficiency in overlap situation, Taha and Hanbury [65] proposed a strategy to exclude the intersection point set between
Excluding intersection in EARLYBREAK. (a) 
According to the property of Hausdorff distance,
There are still some problems for EARLYBREAK algorithm [65]. Firstly, the execution number of the inner loop was reduced by early breaking and random initialization, but the execution number of the outer loop was not reduced. Secondly, when the similarity between
This manuscript tries to address the above problems as much as possible, and present a new approach to directly and efficiently calculate the Hausdorff distance for general 3D model with an exact result.
Firstly, due to the fact that the two subalgorithms are based on Octree, a set of definitions related to lower bound and upper bound are provided. In the case of spatial nonoverlap, a subalgorithm named NOHD was proposed. Then, we analyzed the complexity for computing the Hausdorff distance in the case of spatial overlap and proposed the OHD algorithm.
The definition of bound and the description of overlap
The Hausdorff distance between
As shown in Fig. 2(a), the lb(
As shown in Fig. 2(b), the LB(
Lower bound and upper bound of Hausdorff distance: (a) lower bound from point to node; (b) lower bound from points to node; (c) upper bound from point to node; (d) upper bound from points to node.
As shown in Fig. 2(c), the ub(
As shown in Fig. 2(d), the
According to the analysis in Section 3, when the value of Hausdorff distance between
Given an object
Similarly, given an object
In context of this manuscript, the description of overlapping between BB
As shown in Fig. 3(a), when
As shown in Fig. 3(b), when
The spatial relations between A and B: (a) nonoverlapping; (b) overlapping.
The basic idea of NOHD and the definition of priority queue
In order to reduce the outer loop number of traversal of
Firstly, the calculation of Hausdorff distance from
Secondly, NOHD algorithm defines a new concept of entry of Decreasing Priority Queue (DPQ) to enhanced the principles of branch-and-bound, and therefore to reduce the number of nodes of Octree
The DPQ which arranges Entries(
NOHD algorithm description
The NOHD algorithm is described in Algorithm 3. The initialization involves the following steps: (i) To create an Octree Octree
After the initialization, DPQ contains a single entry with the root of Octree
In case 1, if In case 2, if
In processing of node
The first culling is based on whether MinUB is greater than MaxLB or not, the following steps are processed respectively:
If MinUB
If MinUB
In the second culling, CubeToPoints (Algorithm 4) is called, and a breaking flag of child node
If the flag is “ If the flag is “
The pseudocode of CubeToPoints is described as Algorithm 4, into which three parameters are input: child nodes
The Algorithm 4, firstly initializes the flag, the UB(
The pseudocode of PointToPoints is shown as Algorithm 5, which takes three parameters: point
Algorithm 5 calculates the minimum distance from point
The combination of Algorithms 4 and 5 can efficiently reduce the time complexity of calculating the distance from
In NOHD algorithm, the Hausdorff distance between
Hausdorff distance computation between non-overlapping point sets.
In processing Octree
Hausdorff distance computation between overlapping point sets.
Figure 5 shows a situation, in which
Firstly, along with the increment of Octree depth, the lower bound from Secondly, when
Based on the above analysis, both the EARLYBREAK algorithm and NOHD algorithm cannot efficiently reduce the time complexity in overlap situation. Therefore, we proposed the second subalgorithm, the OHD algorithm, to deal with this situation.
The OHD algorithm computes the Hausdorff distance between
Since the lower bound of the Hausdorff distance between any point
By constantly traveling
The key steps of Algorithm 6 is organized as follows.
Firstly, the Approximate Hausdorff Distance (AHD) between Secondly, an Octree Thirdly, a strategy of point culling is applied, where any point in Finally, the distance between the candidate point and the nearest point in Octree
In typical approximate algorithm [65], the initial value of AHD is zero at the time when the outer loop is started. With the gradual execution of outer loop, AHD will monotonically increase and reach the value near to final Hausdorff distance after limited times of the loop.
Therefore, the initialization of AHD can be quickly implemented after limited number of loops, which is set as
Point culling to reduce number of out iterations for exact algorithm
A strategy of point culling is proposed to reduce number of out iterations, that is, to reduce the point number of
An Octree Octree
Strategy of point culling.
The points of
The leaf-node points (such as: The non-leaf-node points (such as:
Therefore, our strategy in OHD algorithm is to cull these leaf-node points.
The lower bound of the Hausdorff distance between any point
In order to efficiently reduce number of inner iterations, that is, to avoid traversing all of nodes in Octree
Where, the APQ arranges Entries(
The NNDist algorithm is shown as Algorithm 7. The initialization (1
After the initialization, APQ contains a single entry with the root of Octree
If
The first culling is based on whether lb( The second culling is based on whether lb( If
First, the distance Second, if Third, after comparing
Based on spatial relationships of
As shown in Fig. 7, the Hausdorff distance between
The spatial distance between 
When
When
We also introduce a threshold
When When 0
Besides the adaptively and balance, the proposed algorithm can calculate the Hausdorff distance efficiently for general 3D model with an exact result. Under the background, any new and efficient algorithm in future can be easy integrated into the framework, just as the EARLYBREAK algorithm.
A number of experiments are conducted to verify the efficiency and effectiveness of the proposed algorithm, which is implemented using on Windows 7/Inter(R) core(TM) i7-4470 (3.4 GHz)/8.00 GB of memory with C
We used the code from the PCL-1.6.0 (http://www. pointclouds.org/) [60] for building Octree. To evaluate the performance of the proposed algorithm, it was tested with three different types of data, namely random 3D Gaussians, point cloud models and CAD/CAE models generated from CAD software.
In the first experiment (Section 6.1), 3D point sets were generated based on random Gaussians and were used to test the effectiveness of the early breaking strategy for Octree in the NOHD algorithm. In the second experiment (Section 6.2), 3D point sets were generated based on random Gaussians and were used to test the effectiveness of the point culling strategy in the OHD algorithm. In the third experiment (Section 6.3), 3D point sets were used to test the effect of depth on the efficiency of the NOHD algorithm and the effect of coefficient In the fourth experiment (Section 6.4), 3D models generated from CAD software were used to compare the proposed algorithm with the EARLYBREAK algorithm under Motion. In the last experiment (Section 6.5), several examples from typical fields (such as point cloud models and CAD/CAE models) are tested among the NAIVEHDD algorithm, the INC algorithm, the EARLYBREAK algorithm and the proposed algorithm.
In order to verify the idea of NOHD early breaking strategy in general, random Gaussians data were used for testing. 300 pairs of nonoverlapping random Gaussian point clouds were generated. The number of points in each pair varies from 3 thousands to 0.3 million. The effectiveness of our early breaking strategy in the NOHD algorithm was tested with different number of points in
In order to verify the effectiveness of NOHD early breaking strategy, we denoted the algorithm that had removed the early breaking strategy from the NOHD algorithm as the
As shown in Table 1, the fourth column and fifth column report the average of 10 computation results for the
Contribution of early breaking: Comparison between the efficiency of the NOHD algorithm when using early breaking or not
Contribution of early breaking: Comparison between the efficiency of the NOHD algorithm when using early breaking or not
In order to verify the validity of the point culling strategy in the OHD algorithm, the same data sets as Section 6.1 are used. We denoted the algorithm that had removed the point culling strategy from the OHD algorithm as the
Contribution of point culling: Comparison between the efficiency of the OHD algorithm when using point culling or not
Contribution of point culling: Comparison between the efficiency of the OHD algorithm when using point culling or not
As shown in Table 2, the fourth column and fifth column report the average of 10 computation results for the
To further analyze various characteristics of the method, we discussed the effect of depth on the efficiency of the NOHD algorithm and the effect of coefficient
The relationship between depth of Octree
In context of this manuscript, in the case of spatial nonoverlap, the calculation of Hausdorff distance from
We need to set the depth of Octree before constructing the Octree
According to the experimental research, this manu- script recommended the depth of six.
The relationship between 
When
The Octree
According to our experimental research, this manu- script gives the recommendation as follows: the
An important variation of the Hausdorff distance problem is to find the distance when there is a relative movement between two models, such as penetration [66, 73]. This problem is known as geometric matching under the Hausdorff distance metric. In this section, we computed the Hausdorff distance between a fixed model and a moving model to fully illustrate the efficiency of the proposed algorithm.
Two models
HD computation between a stationary torus and a moving torus. (a) One torus is moving under a continuous translation. (b) Comparison of the execution time between the proposed algorithm and the EARLYBREAK algorithm.
When two models were nonoverlapping, the average time cost of the NOHD algorithm was significantly better than that of the EARLYBREAK algorithm. When the degree of overlap fell into the range of 0
As shown in Fig. 11, although two models are tested with different shape and size, the proposed algorithm achieved the same result as above.
In order to further evaluate its performance, the proposed approach was applied to several examples from different fields (such as point cloud models and CAD/ CAE/CAM models) for experimental comparison.
Three pairs of point cloud models and three pairs of CAD/CAE/CAM models were tested in this section as shown in Fig. 12. The step of calculating the Hausdorff distance between the models was as follows: (1) Models
Hausdorff distance computation for different cases
Hausdorff distance computation for different cases
HD computation between a stationary gear and a moving gear. (a) One gear is moving under a continuous translation and rotation. (b) Comparison of the execution time between the proposed algorithm and the EARLYBREAK algorithm.
The different cases used for timing the minimum distance computations: (a) pears (10,754–10,754); (b) cow and hippo (2,903–23,105); (c) two rabbits with different resolution (34,834–3,594); (d) different cups (10,007–9,449); (e) different wrenches (5,191–5,290); (f) singular models (13,564–12,680).
The time costs in calculating the Hausdorff distance through the NAIVEHDD algorithm, the incremental Hausdorff distance calculation algorithm (INC) [54], the EARLYBREAK algorithm [65], and the proposed algorithm were shown in Table 3 (The units of time is second).
According to the comparison of experiments, the time cost executed by the proposed algorithm in calculating the Hausdorff distance is significantly less than that executed by the NAIVEHDD algorithm, and is distinctly less than that executed by the EARLYBREAK algorithm.
The proposed algorithm is composed of the NOHD, the OHD and the EARLYBREAK algorithm. The NOHD algorithm combines branch-and-bound with early breaking to cut down the Octree traversal time in case of spatial nonoverlap. The OHD algorithm integrates a point culling strategy and nearest neighbor search to reduce the number of points traversed in case of spatial overlap.
Therefore, the high efficiency of the NOHD algorithm and the OHD algorithm in the proposed efficient framework was confirmed once again.
An efficient framework with two complementary subalgorithms is presented with theory analysis. The experiments also demonstrate that the proposed approach, as a whole, outperforms the state-of-the art algorithms [54, 65]. The main contributions are summarized as follows:
Besides individual algorithms, an efficient framework is presented, which automatically chooses the suitable subalgorithms to compute the Hausdorff distance in different spatial relationship between a pair of point sets. In this way, the long-standing limitation of computing Hausdorff distance can be relaxed. In NOHD algorithm, we present a strategy synthesizing branch-and-bound and early breaking, and efficiently reduce cost of the Octree traversal. In OHD algorithm, we construct a strategy combining point culling and nearest neighbor searching, and efficiently reduces the cost of points traverse. And different from the state-of-the art algorithm [54, 65], the proposed algorithms can directly calculate a pair of the 3D point sets without transforming them into voxel model. The experiments demonstrate that the proposed approach, as a whole, outperforms the state-of-the art algorithms [65]. The proposed framework can easily integrate other algorithms. Therefore, any subalgorithm with a high efficiency can be added into this framework in the future.
Since distance measurement is fundamental operation in applications of science, engineering and industry [15, 21, 43, 50, 53, 56, 64, 71, 74, 75, 76], we will explore following directions but no limited in future work:
The qualitative evaluation of model similarity, such as similarity assessments for 3D CAD/ CAE model retrieval [10, 17], focused on the qualitative aspects of the models, e.g., topological result and geometric profile. On the other hand, in the field of data exchange [29, 37, 42, 51, 57, 58, 67, 69] and collaborative design [19, 20, 33, 44, 45, 49], the quantitative comparison of the similarity between source and target of feature-based CAD models is the latest development [72]. So the proposed method can be adopted in this area to improve the computing efficiency of quantitative comparisons between large scale models in engineering applications of CAD/CAE/CAM in the future. For example, the proposed algorithms can enhance the computing efficiency of quantitative comparisons in Feature-based Data Exchange in CAD/CAE/CAM when calculating the fitness in optimization computation [72]. This work is also related with design automation because the exact Hausdorff distance will be automatically computed. Design automation is considered as a particularly challenging issue in Computer-Aided Engineering systems, such as A MICROCAD system for interactive design of connections in steel buildings engineering [1, 2], object-oriented model-based presentation for integrated design of steel buildings structures [3, 4], and so on. The multi-core CPUs and many-core GPUs are nice choices for high-performance, low-power and cost-sensitive industrial applications. And they are also available on common PC platforms. Therefore, from view of practice, we should try improve our algorithm with multi-core/many-core acceleration platforms for industrial applications [14, 27, 77, 78].
Acknowledgments
This work is supported by the National Science Foundation of China (Grant No. 61472289) and Open Project Program of State Key Laboratory of Digital Manufacturing Equipment and Technology at HUST (Grant No. DMETKF2017016).
