# Fast Overlap Detection between Hard-Core Colloidal Cuboids and Spheres. The OCSI Algorithm
## 2 Algorithms
The former inequality implies that

\[\min\left(\left\{\alpha_{i}c_{i}-\left(\mathbf{r_{SC}}\cdot\hat{ \mathbf{e}}_{i}\right)\right\}^{2}\right)= \tag{14}\] \[\mathbf{C}=\mathbf{r_{C}}+\sum_{i=1}^{n}\alpha_{i}c_{i}\hat{\mathbf{e}}_{i}, \tag{1}\]0

while, the latter inequality implies

\[\mathbf{C}=\mathbf{r_{C}}+\sum_{i=1}^{n}\alpha_{i}c_{i}\hat{\mathbf{e}}_{i}, \tag{1}\]1 \[\mathbf{C}=\mathbf{r_{C}}+\sum_{i=1}^{n}\alpha_{i}c_{i}\hat{\mathbf{e}}_{i}, \tag{1}\]2

As a result that the solution of Equation (14) is the same as that of (15), if \(|\mathbf{r_{SC}}\cdot\hat{\mathbf{e}}_{i}|>c_{i}\), then one can write

\[\mathbf{C}=\mathbf{r_{C}}+\sum_{i=1}^{n}\alpha_{i}c_{i}\hat{\mathbf{e}}_{i}, \tag{1}\]3 \[\mathbf{C}=\mathbf{r_{C}}+\sum_{i=1}^{n}\alpha_{i}c_{i}\hat{\mathbf{e}}_{i}, \tag{1}\]4

The solutions of Equations (12) and (16) can be incorporated in a single equation by using a step function defined as

\[\Theta(x)= \begin{cases}0&x\leq 0\\ 1&x>0\end{cases}  \tag{17}\]

Therefore, the minimum distance of a point \(\mathbf{r_{S}}\) from the surface of a cuboid \(\mathcal{C}\) reads

\[\min\left(\left\|\mathbf{r_{S}}-\mathbf{C}\right\|\right)=\sqrt{\sum_{i=1}^{n }\Theta\Big{(}|\mathbf{r_{SC}}\cdot\hat{\mathbf{e}}_{i}|-c_{i}\Big{)}\Big{\{} \left|\mathbf{r_{SC}}\cdot\hat{\mathbf{e}}_{i}\right|-c_{i}\Big{\}}^{2}} \tag{18}\]

Finally, a cuboid \(\mathcal{C}\) overlaps with a sphere of radius \(R\) and centre in \(\mathbf{r_{S}}\), if the following inequality is satisfied:

\[\sqrt{\sum_{i=1}^{n}\Theta\Big{(}|\mathbf{r_{SC}}\cdot\hat{\mathbf{e}}_{i}|-c_ {i}\Big{)}\Big{\{}\left|\mathbf{r_{SC}}\cdot\hat{\mathbf{e}}_{i}\right|-c_{i} \Big{\}}^{2}}\leq R \tag{19}\]

## References

* (1) [PERSON] _Real-Time Collision Detection_; Morgan Kaufmann Series in Interactive 3D Technology; Taylor and Francis: Abingdon, UK, 2004. * (2) [PERSON]; [PERSON]; [PERSON]; [PERSON] _Real-Time Rendering_, 4 th ed. ; Chapman and Hall/CRC: Boca Raton, FL, USA, 2018. * (3) [PERSON]; [PERSON]; [PERSON] Efficient collision detection using a dual OBB-sphere bounding volume hierarchy. _Comput.-Aided Des._**2010**, _42_, 50-57. [CrossRef]
* (4) [PERSON]; [PERSON]; [PERSON] OBBTree: A Hierarchical Structure for Rapid Interference Detection. In Proceedings of the 23 rd Annual Conference on Computer Graphics and Interactive Techniques, New Orleans, LA, USA, 4-9 August 1996; pp. 171-180. * (5) [PERSON] A simple method for box-sphere intersection testing. In _Graphic Gems_; [PERSON]; Academic Press: Cambridge, MA, USA, 1990; pp. 335-339. * (6) [PERSON]; [PERSON] Box-sphere intersection tests. _Comput.-Aided Des._**1994**, _26_, 579-584. [CrossRef]
* (7) [PERSON]; [PERSON]; [PERSON] On faster sphere-box overlap testing. _J. Graph. Tools_**2007**, _12_, 3-8. [CrossRef]
* (8) [PERSON]; [PERSON] Collision Detection and Response for Computer Animation. In Proceedings of the 15 th Annual Conference on Computer Graphics and Interactive Techniques, Atlanta, GA, USA, 1-5 August 1988; pp. 289-298. * (9) [PERSON] [PERSON]; [PERSON]; [PERSON] Efficient algorithm to detect collision between deformable 8-spline surfaces for virtual sculpting. _Comput.-Aided Des._**2008**, _40_, 1055-1066. [CrossRef]
* (10) [PERSON]; [PERSON] GPU-based parallel collision detection for fast motion planning. _Int. J. Robot. Res._**2012**, _31_, 187-200. [CrossRef]
* (11) [PERSON]; [PERSON]; [PERSON] Collision detection of convex polyhedra on the NVIDIA GPU architecture for the discrete element method. _Appl. Math. Comput._**2015**, _267_, 810-829. [CrossRef]
* (12) [PERSON]; [PERSON]; [PERSON] Collision detection Based on OBB Simplified modeling. _J. Phys. Conf. Ser._**2019**, _1213_, 042079. [CrossRef]
* (13) [PERSON]; [PERSON]; [PERSON] Neural-learning-based telerobot control with guaranteed performance. _IEEE Trans. Cybern._**2017**, _47_, 3148-3159. [CrossRef]
* (14) [PERSON]; [PERSON]; [PERSON]; [PERSON] Collision detection for virtual environment using particle swarm optimization with adaptive cauchy mutation. _Cluster. Comput._**2017**, _20_, 1765-1774.