# Refinement and Computation Method for Line/Body Topological Relationships
## 3 Derivation and Computation of Basic Intersection Types  
### Derivation of Basic Intersection Types  
Clearly, in Equation (2), the values of the dimension of line/body intersection \(f_{D}\) include only two cases: \(\{0,1\}\). The cases where the endpoints of the intersecting lines are on the surface of the body, denoted by \(f_{S}\), encompass three possible values: \(0\) indicates that neither of the endpoints of the intersecting line lies on the boundary of the body; \(1\) indicates that one endpoint of the intersecting line lies on the boundary of the body; and \(2\) indicates that both endpoints of the intersecting line lie on the boundary of the body. Assuming that the body is \(A\) and the intersection line is \(l\), the values of \(f_{E}(\textbf{A}/\textit{l}_{l})\) include three cases: \(\{0,1,2\}\); the predicate \(f_{R}\) represents the connection types of the two endpoints of unit intersection, each containing four cases, \([\textit{null},\textit{out},\textit{on},\textit{in}]\), totaling \(16\) cases. Therefore, there is a total of \(2\times 3\times 3\times 16\) = \(288\) possible types of line/body basic intersections. Below, the method of exclusion is used to eliminate meaningless cases.  
1. \(f_{D}=0\), indicating that the line/body intersection occurs at a point, which includes only the two cases shown in Figure 4a,b.
2. \(f_{D}=1,\ f_{S}=0\), meaning both endpoints of the intersection line are inside the body. In this case, \(f_{E}=2\), and it only includes the situation depicted in Figure 4c.
3. \(f_{D}=1,\ f_{S}=1\), indicating that one endpoint of the intersection line is inside the body, while the other is on the body's boundary. Therefore, \(f_{E}=1\). According to the definition of the unit intersection, the endpoint inside the body is an endpoint of the line object without subsequent connecting line segments, resulting in a \(f_{R}\) value of \"_null_\". Hence, it includes only the four cases shown in Figure 4d-g.  
When \(f_{D}=1\) and \(f_{S}=2\), \(f_{E}\) can take two values: [0, 1].  
When \(f_{D}=1\), \(f_{S}=2\), and \(f_{E}=1\), it means that the intersection line (including its interior and both endpoints) lies entirely on the surface of the body. According to the definition of the unit intersection, it is not possible for \(f_{R}\) to be \"_on_\". Excluding symmetrical cases, only the six cases shown in Figure 4h-m are included.  
When \(f_{D}=1\), \(f_{S}=2\), and \(f_{E}=0\), it means that the intersection line, except for its two endpoints, lies entirely inside the body. Each of the two endpoints can take one of four possible values: {null, out, on, in}. This results in a total of 16 meaningful combinations. There are 10 cases, excluding symmetric cases, as shown in Figure 4n-w.  
Therefore, there are a total of 2 intersection points and 21 intersection lines, resulting in 23 basic types between the line and the body (as illustrated in Figure 4).  
After defining all the basic types, the representation of the line/body relationships in Figure 3 according to Equation (1) is as follows:  
R(A, B) = \(<\)1 (1, 1, 1, null, out), 2 (1, 2, 1, out, in), 3 (1, 2, 0, on, on), 4 (1, 2, 1, in), 5 (1, 2, 0, on, out), 6 (0, out, out), 7 (0, out, null)\(>\).  
The following section discusses the method for calculating the refined topological relationships between the line and body.  
Figure 4: Three-dimensional line/body basic types and their formal representation.