# An Open-Source Algorithm for 3D ROck Slope Kinematic Analysis (ROKA)
## 2 The ROck Slope Kinematic Analysis (ROKA) Algorithm
### Assumptions of the Analysis  
ROKA has been developed considering three main basic assumptions. The first and principal assumption is that the discontinuities' surface is considered planar and circular, following the Baecher's disc model [33]. This assumption is widely used in material mechanics [34; 35; 36; 37], and it considers discontinuities as discs; therefore, a discontinuity can be described by the coordinates of the disc center (cx, cy, cz), disc radius (r), and orientation of the 3D plane in which the disc lies (Figure 2). The orientation of the disc can be defined by its attitude (e.g., dip/dip direction) or by its normal N.  
Figure 1: Schematic representation of the workflow of the ROck slope Kinematic Analysis (ROKA) algorithm. Figure 2: Representation of the Baecher’s disc model used to represent the discontinuity. The relationship between N, its components Nx, Ny, and Nz, and the dip/dip direction can be defined calculating the direction cosines [38]:  
\[\cos\alpha=\frac{\text{N}_{\text{x}}}{\text{N}};\ \cos\beta=\frac{\text{N}_{ \text{y}}}{\text{N}};\ \cos\gamma=\frac{\text{N}_{\text{z}}}{\text{N}} \tag{1}\]  
The dip angle can be defined as:  
\[\text{dip}=90^{\circ}+\arcsin(\cos\gamma) \tag{2}\]  
whereas the dip direction can be defined  
* if \(\cos\alpha>0\) and \(\cos\beta>0\): \[\text{dip direction}=\arctan\biggl{(}\frac{\cos\alpha}{\cos\beta}\biggr{)}\] (3)
* if \(\cos\alpha>0\) and \(\cos\beta<0\) or \(\cos\alpha<0\) and \(\cos\beta<0\): \[\text{dip direction}=180^{\circ}+\arctan\biggl{(}\frac{\cos\alpha}{\cos\beta} \biggr{)}\] (4)
* if \(\cos\alpha<0\) and \(\cos\beta>0\): \[\text{dip direction}=360^{\circ}+\arctan\biggl{(}\frac{\cos\alpha}{\cos\beta} \biggr{)}\] (5)  
The second important assumption is that all the considered discontinuities are only those visible and mapped onto the rock slope, and their surfaces are hypothesized as circular with a diameter equal to their maximum visible extension. The third assumption is that the discontinuities or their intersection can be potentially unstable if they intersect the slope surface and satisfy these geometric relationships with the local orientation of the slope:  
* A discontinuity is potentially critical for **planar failure** if (6a) it is a dip slope discontinuity and (6b) its dip angle is higher than the friction angle \(\phi\) and (6c) is lower than the apparent angle of the slope along the discontinuity dip direction; \[\left\{ \begin{array}{c}(\text{a})\ \text{dipdir}_{\text{slope}}-90^{\circ}< \text{dipdir}_{\text{discontinuity}}<\text{dipdir}_{\text{slope}}+90^{\circ}\\ (\text{b})\ \text{dip}_{\text{discontinuity}}>\phi\\ (\text{c})\ \text{dip}_{\text{discontinuity}}<\text{apparent dip}_{\text{slope}} \end{array} \right.\] (6)
* Two discontinuities are critical for **wedge failure** if (7a) they form a dip slope intersection and (7b) the dip angle of the intersection is higher than the friction angle \(\phi\) and (7c) is lower than the apparent angle of the slope along the discontinuity dip direction; \[\left\{ \begin{array}{c}(\text{a})\ \text{dipdir}_{\text{slope}}-90^{\circ}< \text{trend}_{\text{intersection}}<\text{dipdir}_{\text{slope}}+90^{\circ}\\ (\text{b})\ \text{dip}_{\text{intersection}}>\phi\\ (\text{c})\ \text{dip}_{\text{intersection}}<\text{apparent dip}_{\text{slope}} \end{array} \right.\] (7)
* A discontinuity is critical for **flexural toppling** if (a) it is an anti-dip slope discontinuity and (b) its dip \(<90^{\circ}-\) slope dip \(+\) friction angle \(\phi\); \[\left\{ \begin{array}{c}(\text{a})\ \text{anti dipdir}_{\text{slope}}-90^{\circ}< \text{dipdir}_{\text{discontinuity}}<\text{anti dipdir}_{\text{slope}}+90^{\circ}\\ \text{dip}_{\text{discontinuity}}<90^{\circ}-\text{dip}_{\text{slope}}+\phi \end{array} \right.\] (8)* Two discontinuities are critical for **direct toppling** if (a) they form anti-dip slope intersection and (b) the dip of the intersection \(<90^{\circ}-\) slope angle. \[\left\{