## 3 RRT-Based Path Planning  
The problem under consideration cannot be solved by convex optimization tools. The reason lies in the non-convex constraints of (12) and (13), the non-smoothness of the residual energy model (9) due to the shadow region created by the buildings, and the nonlinear UAV model (1). Moreover, the minimization of the flight time and the optimization of the UAV path are difficult to decouple. To overcome these difficulties, we develop an RRT-based path planning method. As aforementioned, the RRT method can easily tackle the nonlinear UAV model, secure communication requirements and the NFZ by randomly generating samples. Let \(\mathcal{T}\) be the random tree. \(\mathcal{T}\) consists of a number of vertices. Each vertex is associated with the status of the UAV including its position, heading, linear speed, vertical speed, angular speed, and whether it has LoS with the sun, the intended node and the eavesdroppers. It is assumed that the UAV knows the locations of the intended node, the eavesdroppers and the sun's direction vector; otherwise, it is impossible to guarantee the secure communication and verify the LoS with these entities. The operation period is descritized by a sampling interval \(\delta\). This sampling interval restricts the movement of the UAV in a single step. Following the framework of RRT, we can keep generating random samples between the allowed altitudes \(Z^{min}\) and \(Z^{max}\) in the environment. For any sample, we look for the closest vertex in the tree \(\mathcal{T}\) to this sample. We generate a new vertex with appropriate control inputs satisfying (3), so that the new vertex cannot be closer to the sample after a movement in the interval \(\delta\). The new vertex is added to the tree \(\mathcal{T}\) if constraint (7) does not hold for any prism in the considered environment. Otherwise, this vertex is deleted. If the candidate vertex is added to the tree \(\mathcal{T}\), we further verify whether constraints (12) and (13) hold and if the LoS exists between this vertex and the sun. When a given number of vertices fall into the destination set \(\mathcal{D}\), we can terminate the tree growing process. From the generated random tree \(\mathcal{T}\), we can find a number of paths to evaluate. For finding the paths, we consider each of the vertices falling into the destination set \(\mathcal{D}\). Specifically, from this vertex, we look backward to identify its parent vertex until the root (i.e., the vertex indicating the initial position of the UAV) is reached. Let \(\mathcal{R}\) denote the set of paths found by the above procedure. These paths are feasible for the UAV, since any vertex is generated by appropriate control inputs. Additionally, any vertex is outside the prisms (which is safe for the UAV). The last step is to make the final selection of the path. As the considered problem is a multi-objective problem, we select the path that maximizes the following metric:  
\[\max_{\mathcal{P}\in\mathcal{R}}\frac{Q(\mathcal{P})\int_{0}^{T(\mathcal{P})}l _{0}(t)dt}{T(\mathcal{P})}, \tag{19}\]  
where \(T(\mathcal{P})\) represents the UAV flight time following the path \(\mathcal{P}\), \(Q(\mathcal{P})\) represents the residual energy of the UAV, and \(\int_{0}^{T(\mathcal{P})}l_{0}(t)dt\) gives the total time in which the transmission by the UAV is secure. It is worth pointing out that (19) is not the only metric to evaluate a path. An alternative can be a linear combination of the three objectives. Since we need to choose two weights in that kind of metric, we use (19) in this paper to evaluate a path. After evaluating all the possible paths, we can finally find the one having the maximum value of (19). All the procedures of this method are summarized in Figure 3.  
It is worth pointing out that, although the currently considered scenario involves a stationary intended node, the proposed method can also be used for the cases with a moving intended node. Thanks to the computational efficiency, the task of adding new vertices and removing old vertices can be done online.