## 4 Technical Analysis
### Redundancy Removal of Component Geometry Information
#### 4.2.2 Redundancy Removal  
Many components in an IFC file are similar or identical in geometry, which are redundant for the rendering progress. By using Hausdorff distance, the developed system can evaluate the similarity in instances and classify similar ones into one group. Since rendering instances in the same group only needs one drawcall, the time and hardware cost are significantly reduced. Although the BIM software built-in _IfcMappedRepresentation_ can label similar components, this software can only label instances based on the user's specific operation, such as copying. This mechanism may cause failure in recognizing other newly created instances that are same as the previous ones. Therefore, the developed system used PCA and Hausdorff distance to classify instances in terms of their geometry and identified similar components within user-defined precision, such as the default millimeter precision.  
Hausdorff distance [61] is used to measure the geometric similarity in components in the local coordinate system, and it is defined as:  
\[H(A,B)=max(h(A,B),h(B,A)) \tag{7}\]  
\[h(A,B)=max_{a\in A}\bigg{\{}\underset{b\in B}{\overset{}{\underset{}{\max}}}(a, b)\bigg{\}} \tag{8}\]  
where \(H(A,B)\) is the Hausdorff distance; \(A\) and \(B\) are the point sets; \(a\) and \(b\) are the points in \(A\) and \(B\), respectively; and \(d(a,\ b)\) is the Euclidean distance between points \(a\) and \(b\). For the point \(a\), the distance between point \(a\) and each point \(b\) in point set \(B\) is solved, and the minimum value is set as the distance between point \(a\) and point set \(B\). The maximum distance between each point \(a\) and point set \(B\) is denoted by \(h(A,\ B)\). The Hausdorff distance between point sets \(A\) and \(B\) is defined as the maximum value between \(h(a,\ b)\) and \(h(b,\ a)\). Figure 3 shows a flowchart of the redundant case recognition algorithm based on Hausdorff distance.  
Figure 3: Flowchart of the redundant case recognition algorithm based on Hausdorff distance.  
WebGL technology is a common rendering framework in the Web system, and it provides rich interfaces to control the rendering process. The WebGL rendering process is shown in Figure 4. Before rendering an instance, the CPU needs to transfer the vertex, facet, and material data to GPU, which is called a drawcall. The drawcall efficiency is the performance bottleneck of 3D rendering technology in the hardware architecture. Therefore, merging the drawing components with the same shape into a single drawcall can significantly improve the rendering efficiency.  
In the developed BIM system, the three.js framework was employed to render the model on the browser side. To improve the rendering efficiency, it is necessary to reduce the number of drawcalls as much as possible. Through a single drawcall, a large number of instances can be drawn, such that the rendering efficiency is greatly improved. The three.js framework provides _InstancedMesh_ objects to achieve this function. By inputting a shared geometric mesh and multiple coordinate transformation matrices into shaders, multiple objects with the same shape need to be drawn only once.