# The Automatic Algorithm of Optimizing the Position of Structured Light Sensors
## 2 Optimization Method for the Number and Position of Multiple Sensors
### Covered Area Judgment  
Calculating the initial covered area  
When dealing with large-scale 3D point cloud data, the computational complexity is high. Therefore, a preliminary covered area estimation is first needed to determine the possible coverage of the sensor. Figure 6a is a schematic diagram of the specular reflection of the light in the plane. Figure 6a represents the vector of the incoming light, N represents the normal vector of the surface, and R represents the specular reflection vector of the incident light I. Within the covered area of the sensor, the normal vector N of the surface and the incident vector I of the sensor are negative. The initial covered area is calculated using Equation (1). When I and N comply with Equation (1), the incident light may pass through the triangular surface where N is located. When they do not match, the incident light does not pass through the triangular surface where N is located. Next, further detection is carried out on the triangular surface that conforms to Equation (1).  
Figure 5: Multi-sensor. The red dashed line represents the projector’s field of view, while the blue dashed line represents the camera’s field of view.  
Figure 6: Schematic diagram of the optical path. (**a**) is a schematic diagram of the specular reflection of the light in the plane. (**b**) is the light propagation diagram of the sensor group.  
\[I\bullet N<0 \tag{1}\]  
Calculating the covered area of the sensor  
After the initial covered area calculation, there is a small portion of the surface that is not within the effective coverage area of the sensor. Therefore, an accurate sensor-covered area calculation is required to exclude the above errors. By traversing the preliminary calculated coverage area, calculate whether there are occluded surfaces between these surfaces and the sensors. If there is an obstructed surface, mark it as a non-covered area. If there is no occluded surface, it is marked as a valid coverage area. This calculation is based on the Moller-Trumbore algorithm [20]. The idea of this algorithm is shown in Figure 7. Calculation formulas such as Equations (2) and (3). In Figure 7, \(P_{0}\) represents the center of gravity of the triangular face to be measured, \(P_{1}\), \(P_{2}\), and \(P_{3}\) represent the three vertices of any other triangles that are within the initial coverage area, \(O\) represents the sensor, and -d denotes the ray direction vector pointing to \(O\) from \(P_{0}\). The parameters \(t\), \(b_{2}\), and \(b_{3}\) in Equation (2)), and \(b_{1}\) in Equation (3) are the parameters to be solved. When all these parameters \(t\), \(b_{2}\), \(b_{3}\), and \(b_{1}\) are greater than 0, it means that there is an intersection of the ray with the triangular plane. Therefore, the triangular face where \(P_{0}\) is not located in the effective covered area of the sensor.  
\[O+t\times\overset{\rightarrow}{d}=(1-b_{2}-b3_{3})\times P_{1}+b_{1}\times P_ {2}+b_{2}\times P_{3} \tag{2}\]  
\[b_{1}=1-b_{2}-b_{3} \tag{3}\]  
In 3D structured light measurement, each sensor group includes at least one projector and one camera. In the measurement of the sensor group, the measurement area is the intersection of the covered areas of the projector and the camera. Therefore, after the calculation of the coverage area of a single sensor is completed, calculating the coverage area of a sensor group is relatively simple and only requires determining the common coverage area of the projector and the camera.