Representation and Reasoning of Three-Dimensional Spatial Relationships Based on R5DOS-Intersection Model Representation and Reasoning Based on R5DOS Model

This paper aims to disclose the compound topological and directional relationships of three simple regions in the three-di-mensional (3D) space. For this purpose, the directional model and the 8-intersection model were coupled into an R5DOS-intersection model and used to represent three simple regions in the 3D space. The matrices represented by the model were found to be complete and mutually exclusive. Then, a self-designed algorithm was adopted to solve the model, yielding 11,038 achievable topological and directional relationships. Compared with the minimum bounding rectangle (MBR) model, the proposed model boasts strong expressive power. Finally, our model was applied to derive the topological and directional relationships between simple regions A and C from the known relationships between simple regions A and B and those between B and C. Based on the results, a compound relationship reasoning table was established for A and C. The research results shed new light on the representation and reasoning of 3D spatial relationships.


Introduction
e reasoning of spatial relationship, a.k.a. spatial reasoning, can be implemented quantitatively or qualitatively. Qualitative spatial reasoning, aiming to represent and analyze spatial information, is an important tool in artificial intelligence (AI), machine vision, robot navigation [1,2], and geographic information system [3].
Over three decades, many theories and models have been developed for spatial reasoning. For instance, Randell et al. [4,5] put forward the region connection calculus (RCC) theory. Egenhofer and Franzosa [6,7] proposed the theory of 4-intersection model and 9-intersection model. Li [8] derived a dynamic reasoning method for azimuth relationship.
In recent years, spatial reasoning has evolved rapidly, thanks to the emerging AI applications in image processing [9,10], computer vision [11,12], and model prediction [13]. However, most studies on spatial reasoning focus on the spatial relationships on two-dimensional (2D) planes rather than those in three-dimensional (3D) spaces. e 3D space contains too many information elements to be handled by ordinary reasoning methods.
At present, the relationships between objects in the 3D space are mostly solved by compound reasoning. e common approaches of compound reasoning include the compound reasoning of directional and topological relationships [14,15] and the compound reasoning of directional and distance relationships [16]. Liu et al. [17] designed a 3D improved composite spatial relationship model (3D-ICSRM) in a large-scale environment and proposed a reasoning algorithm to solve that model. e accuracy of the 3D-ICSRM is very limited, and it considers the relationship between qualitative distance and direction. In 2016, Hou et al. [18] extended the convex tractable subalgebra into 3D space and used the BCD algorithm to calculate it. In 2019, Wang et al. [19] extended the oriented point relation algebra (OPRAm) model to 3D and proposed oriented point relation algebra in three-dimensional (OPRA3Dm) algorithm, which has certain practical significance. ese two papers consider the direction relationship. In recent years, the literature mainly studies the relationship between the direction and qualitative distance, while there is less research on the direction and topological relationship. is article will focus on the direction and topological relationship to fill the gaps in this field.
is paper aims to disclose the compound topological and directional relationships of three simple regions in the 3D space. Firstly, the RCC-5 model was combined with a strong directional relationship model for two simple regions, based on the extended 4-intersection theory and spatial orientation relationship in RCC5. e combined model was used to identify the compound topological and azimuth relationships between two simple regions, and solved by a self-designed algorithm. rough programming, a total of 65 topological and directional relationships were obtained in the 3D space.
On this basis, the extended 4-intersection matrix was replaced with an 8-intersection matrix to represent the 3D spatial topological and directional relationships between three simple regions. en, it was found that the topological and directional relationships between the R5DOS-intersection model of two regions and three regions are complete and mutually exclusive. Further programming reveals a total of 11,038 topological and azimuth relationships between three simple regions in the 3D space and derives a simple topological and directional relationship R (A, C) from two sets of two simple regions R (A, B) and R (B, C).

RCC eory.
In 1992, Randell et al. [4,5] proposed the RCC theory and established the RCC-8 intersection model, which is a boundary-sensitive model. Based on the boundary-sensitive conditions, the RCC-5 intersection model can be derived (Figure 1).
In 1991 and 1995, Egenhofer et al. constructed an extended 4-intersection matrix, which covers two space objects A and B, with A°being the interior of A: e value of each position set is either empty or nonempty. en, the five kinds of relationships in the RCC-5 intersection model can be represented as the matrix in Table 1 and expressed as a set R 5 � 0 1 1 1 , 1 1 1 1 , For three simple areas A, B, and C, R 2 − zA ∪ zB ∪ zC { } can be partitioned into 8 parts (Figure 2). e eight parts can be illustrated by an 8-intersection matrix: e RCC theory fuels the research on spatial relationship models in the past three decades, giving birth to many new theories. Nonetheless, most of these theories target the 2D plane rather than the 3D space. Recently, there is a growing interest in the spatial relationship models of the 3D space, especially the compound reasoning of directional and topological relationships, and that of directional and distance relationships.
e MBR model, 8-direction model, and 16-direction model are shown in Figure 3 below. e MBR model is not consistent with human cognition of directions.
In 2010, He and Bian [21] came up with a special 8direction cone model (Figure 4), which divides the space into eight regions: NW, NE, EN, ES, SE, SW, WS, and WN. Among them, NW and NE belong to the N direction, EN and ES belong to the E direction, SE and SW belong to the S direction, and WS and WN belong to the W direction. e 8-direction cone model is easy to describe and recognize and is flexible in dealing with relationships in multiple dimensions. Compared with the 8-direction cone model, the16-direction cone model is also consistent with the human cognition of directions, but too complicated to express. Hence, the 8-direction cone model is more suitable for the reasoning of spatial relationships.
Considering its excellence in spatial segmentation, the 8direction cone model was coupled with the RCC-5 intersection model for compound reasoning of topological and azimuth relationships in the 3D space.

Model Construction.
Any object in space is wrapped by an outer sphere ⊙A with a radius r A ( Figure 5), that is, Taking the center of ⊙A as the origin of the rectangular coordinate system in space, the spatial Cartesian coordinate system can be established and the reference space can be divided into eight intervals by the x-, y-, and z-axes. Each interval is called a hexagram limit Oct    Figure 1: e relationships between RCC-8 and RCC-5 intersection models.   Complexity 3 e outer sphere B completely covers the n points: ∀(x Bi , y Bi , z Bi ) ∈ ⊙ B. Similarly, the outer sphere C for point set C can be defined as follows: If it is impossible to find the outer sphere of the space object, the object can be treated as an irregular convex object.
en, five planes π 1 : y � 0, π 2 : x � 0, π 3 : z � 0, π 4 : y � z, and π 5 : y � −z, can be inserted into the rectangular coordinate system in space ( Figure 7). en, the 3D space can be represented as e angle corresponding to each region can be described as follows: where θ is the dihedral angle of the plane π i (i � 1, 2, 3, 4, 5). Adding the set of hexagram limits Oct � 1, 2, 3, 4, 5, 6, 7, 8 { }, the space can be divided into 16 regions: where DO is the set of 3D regions and their hexagram limits. If the center of outer sphere B exists in region 1NE, then B strongly exists in that region, denoted as s1NE. If outer sphere B partly exists in region 2NE, then B weakly exists in that region, denoted as w2NE. We let "0" indicate that there is no object in the area, "1" indicates that the object "strongly

Complexity
exists" in this area, and "2" indicates that the object "weakly exists" in this area. An example is shown in Figure 8: For simplicity, only strong existence scenarios were considered. en, the set of regions, where B strongly exists, can be defined as follows:  Complexity where θ ob the dihedral angle formed by planes π ob and π 1 , which is perpendicular to the x-axis and passes the straight line ab (Figure 9). For two regions, the extended 4-intersection matrix can be introduced to the DOS: For three regions, the 8-intersection matrix can be introduced to the DOS: Our model consists of two layers: the first layer is the topological relationship R 5 layer, and the second layer is the orientation relationship DOS layer. en, the following definition can be derived. Suppose For any two simple regions A and B, it is possible to obtain a 5 × 4'0-1 matrix. In theory, a total of 2 20 matrices could be acquired, which correspond to 2 20 topological and directional relationships in the 3D space: 6 Complexity Based on the topological relationship between outer spheres B and C, the existence of the centers of the two spheres can be described in two cases.
According to the above conditions, 2 8 × 3 16 matrices could be obtained theoretically, which correspond to 2 8 × 3 16 topological and directional relationships in the 3D space.

Model Properties
Definition 2. In layer R 5 , any m × n -order 0-1 matrices A � (a ij ) m×n and B � (b ij ) m×n can be defined as A ∪ B � (a ij ∨b ij ) m×n . en, a 0-1 diagonal matrix can be established as Table 2.
e following proposition can be derived from Table 2:

}, R (A, B) is the element that corresponds to the topological relationship R 5 between any two simple regions A and B.
en, the following theorem can be obtained. en, it is assumed that the topological relationship between A, B, and C corresponds to two matrices R5 3 DOSa and R5 3 DOSb and can be induced by the R5 3 DOS-intersection model. en, there exists 1 ≤ i ≤ 24 such that R5 3 DO S a i ≠ R5 3 DO S b i . If i � 1, R5 3 DOSa i � 0 and R5 3 DOSb i � 1, A°∩ B°∩ C°i s both empty and nonempty, which is obviously contradictory. Hence, the above theorem was proved valid.

Constraints on ree Simple
Regions. e following constraints were designed on three simple regions. Constraint 1: to uniquely correspond to the topological and directional relationships in the 3D space, a R5 3 DOS matrix must satisfy the following conditions.
Case 2: if any two of the three simple regions are equal, the ternary region can be regarded as a binary region with only one 1 in the DOS layer. Case 3: if any two of the three simple regions are inclusive or noninclusive, the ternary region can be regarded as a binary region when any two regions intersect and the sum of layer R 5 is 4. Case 4: if only one of the three simple regions is inclusive or noninclusive, the ternary region can be regarded as a binary region when any two regions intersect and the sum of layer R 5 is 5. Case 5: if the three simple regions are disjoint, the ternary region can be regarded as a binary region when any two regions intersect and the sum of layer R 5 is 5. Case 6: if simple regions B and C are inclusive or noninclusive and separated from A, then the center of the A can only fall within B and C: For a ternary reference object in the 3D space, there are theoretically 2 8 × 3 16 matrices. Under the above constraints, a total of 11,038 matrices were obtained after removing the nonexistent scenarios.

Topological Relationship Algorithm for 3 Simple Regions in the 3D Space.
e topological relationship algorithm for 3 simple regions in the 3D space can be implemented in the following steps.
Step 2: scan each row of matrix A, and mark all row vectors that satisfy the constraints.
Step 3: save all the marked row vectors as a matrix B and output the matrix as the final result. e pseudocode of the algorithm is displayed as follows. Topological and directional relationship: Gen (null; R5 3 DOSa)//Input: null; output: topological relationship satisfying constraints (Algorithm 1).

Comparison between R5 3 DOS-Intersection Model and MBR Model.
is section proves that the R5 3 DOS-intersection model has stronger expressive power than the MBR model in the 3D space [21][22][23].
First, layer R 5 was defined as R (A, B) � PPI, R (A, C) � PPI, and R (B, C) � PPI, and the center of outer sphere B was assumed to fall into 1NE or 2NE. is situation does not exist in the real world. Under Constraints 2 and 4, there is no solution to this situation. However, the R5 3 DOS-intersection model can explain the situation that cannot be realized in the 3D space.
Next, the R5 3 DOS-intersection model was found capable of expressing situation that cannot be illustrated by the MBR model through the analysis of the following example. For any three external spheres A-C in the 3D space, it is assumed that the topological and azimuth relationships between them are known, and these spheres are separated from each other.
(1) R5 3 DOSaALL ⟵ 2 8 * 3 16 (9) end if (10) end for (11) return R5  en, Without changing the positions of A-C, the images of the R5 3 DOS-intersection model in the two examples can be obtained as Figures 13 and 14, where green, blue, and red balls are the outer spheres A-C, respectively.     (Figures 15 and 16).
In the same way, we can get the corresponding R 5 3DOSintersection model (Figures 17 and 18): rough the above comparison, it can be seen that the R 5 3DOS-intersection model can represent the topological relationship of space objects A, B, and C, and it can accurately represent the spatial situation that the MBR model cannot represent.

Comnd Relationship Reasoning Based on R5 3 DOS-Intersection Model.
is section applies the R5 3 DOS-Intersection Model to the reasoning of the compound relationships between simple regions in the 3D space. It is assumed that the topological and azimuth relationships between simple regions A and B and those between simple regions B and C are known in advance. en, the goal is to deduce the possible topological and azimuth relationships between simple regions A and C.
According to Section 2.3, we have Using the R5 3 DOS-intersection model, a total of 65 topological and azimuth relationships were obtained from the real world. Hence, it is possible to obtain 65 0-1 matrices of 5 rows and 4 columns, which is denoted as Ω 1 � R i ; i � 1, . . . , 65 R i . Targeting at region A, the topological and directional relationships between A and C and those between B and C were taken into account.
Since the topological and azimuth relationships between simple regions A and B and those between simple regions B and C are known in advance, we have R(B, C) ∈ Ω 1 . en, the possible topological and orientation relationships between A and C were derived from the R5 3 DOS-intersection model. According to Definition 2, we have Table 3: e list of all directional and topological relationships.

Supplementary Materials
is code is the screening algorithm of the R5DOS-intersection model.
e purpose is to screen several matrices theoretically in the model according to the constraints and finally get the algorithm of the matrix that meets the requirements, the result of running the code needs simple processing, not the result of the article. e code is developed based on MATLAB software. (Supplementary Materials)