# An Augmented Warning System for Pedestrians: User Interface Design and Algorithm Development
## 2 Materials and Methods
### Projection Algorithms Development
Here, (x, y, z) represents the transformed 3D position of pedestrian, vehicle, and conflict point in the pedestrian's local coordinates. In summary, the pedestrian's 3D local coordinates use the pedestrian's head location as origin; positive x represents the direction toward the right lateral of the pedestrian, positive y represents the pedestrian's cranial direction, and z represents the pedestrian's facing direction. All positions mentioned above were projected to the projection plane by using Equation (1). The location of the projected point on the projection plane was (x \(\times\) d/z, y \(\times\) d/z). However, the coordinates needed to be updated in real-time based on where the pedestrian was looking so that the projection could have an accurate rotation angle. As mentioned above, it was assumed that pedestrians do not look to either side without turning their heads. Thus, a real-time coordinates rotation was needed for the projection matrix to cooperate with the pedestrian's head rotation so that the projection could be updated in real-time. After using a rotation matrix on \(\left[ \begin{array}{c}\mathrm{x}\\ \mathrm{y}\\ \mathrm{z}\end{array} \right]\), \(\left[ \begin{array}{c}\mathrm{C}_{\mathrm{x}}\\ \mathrm{C}_{\mathrm{y}}\\ \mathrm{C}_{\mathrm{z}}\end{array} \right]\) could be found for the point that needed to be projected. Then, the projection matrix could be used as follows:  
\[\left[ \begin{array}{ccc}1&0&0&0\\ 0&1&0&0\\ 0&0&1&0\\ 0&0&\frac{1}{d}&0\end{array} \right]\times\left[ \begin{array}{c}\mathrm{C}_ {\mathrm{x}}\\ \mathrm{C}_{\mathrm{y}}\\ \mathrm{C}_{\mathrm{z}}\\ 1\end{array} \right]=\left[ \begin{array}{c}\mathrm{P}_{\mathrm{x}}\\ \mathrm{P}_{\mathrm{y}}\\ \mathrm{P}_{\mathrm{z}}\\ \mathrm{P}_{\mathrm{w}}\end{array} \right] \tag{2}\]  
\[\left[ \begin{array}{c}\mathrm{P}_{\mathrm{x}}\\ \mathrm{P}_{\mathrm{y}}\\ \mathrm{P}_{\mathrm{z}}\\ \mathrm{P}_{\mathrm{w}}\end{array} \right]\]  
is the vector calculated after the perspective projection matrix was performed. As mentioned in Equation (2), the projected vehicle point's coordinates located on the projection plane should be (\(\mathrm{P}_{\mathrm{x}}/\mathrm{P}_{\mathrm{w}}\), \(\mathrm{P}_{\mathrm{y}}/\mathrm{P}_{\mathrm{w}}\)). The perspective projection method was also used to project the conflict position. After projecting these two positions on the projection plane, the vehicle's path could be formed by connecting the vehicle point and the conflict point. Figure 4 shows an example of forming the vehicle path based on the projected vehicle and conflict points. Figure 4: An example of forming an arrow based on projected points. A vehicle turning situation is a special situation that needed to be considered. To form the vehicle turning path, the vehicle turning position needed to be converted into the pedestrian's local coordinates and then projected to the projection plane using the same methods mentioned earlier. The projection methods may not always be able to project all the points within the warning window size based on the vehicle's and the pedestrian's instant locations. In this study, five specific scenarios were studied. One basic scenario was when the vehicle, the vehicle turning position, and the conflict point were all in front of the projection plane and could be projected inside the warning window. The vehicle path could be formed by simply connecting all three projected points. Figure 5 shows an example of the basic scenario. However, there were four other scenarios in which a simple connection of the points was not feasible, i.e., not all the points could be projected on the projection plane, as shown in Figure 6.  
In scenario 1, the vehicle turning position and the conflict position were in front of the projection plane, while the vehicle location was behind the projection plane, and the projected vehicle turning point was outside the warning window.