# Multi-Layered Interactive Target Guidance with Visual Safety in Convex-Shaped Obstacle Environments
## Appendix A Differentiability of \(l_{c,k}\) and \(l_{o,k}\)  
In this section, the differentiability of \(l_{c,k}\) and \(l_{o,k}\), defined in Section 2.3, is considered.  
The projected point \(P_{\mathcal{O}_{k}}(p)\in\mathbb{R}^{3}\) from a point \(p\in\mathbb{R}^{3}\) onto an obstacle \(\mathcal{O}_{k}\), defined in (13), can be obtained as a solution of the following convex optimization problem:  
\[\begin{split} P_{\mathcal{O}_{k}}(p)=&\underset{q \in\mathbb{R}^{3}}{\text{argmin}}&\frac{1}{2}\|q-p\|^{2}\\ &\text{subject to}&\quad o_{kj}(q)\leq 0,\ \ \forall j=1,2,\ldots,n_{k}.\end{split} \tag{13}\]Let \(l_{k}(p)\) be the distance between \(p\) and its projected point onto an obstacle \(\mathcal{O}_{k}\), i.e., \(l_{k}(p)\coloneqq\|p-P_{\mathcal{O}_{k}}(p)\|\). The following fact about the continuous differentiability of \(l_{k}(p)\) is then presented.  
**Lemma A1**.: _Suppose that the vectors \(\frac{\partial\omega_{ij}(p)}{\partial p}\) for \(p\) such that \(\omega_{kj}(p)=0\) for all \(j\in\{1,2,\ldots,n_{k}\}\) is linearly independent. Then, \(l_{k}(p)\) is continuously differentiable in the set \(\{p\in\mathbb{R}^{3}\mid\omega_{kj}(p)>0,\ \forall j\in\{1,2,\ldots,n_{k}\}\}\), and the derivative of \(l_{k}(p)\) is given by \(\frac{\partial l_{k}}{\partial p}(p)=\frac{p-P_{\mathcal{O}_{k}}(p)}{\|p-P_{ \mathcal{O}_{k}}(p)\|}\)._  
Proof.: Let us first define the Lagrange function as \(L(q,\lambda)=\frac{1}{2}\|p-q\|^{2}-\sum_{j=1}^{n_{k}}\lambda_{j}\omega_{kj}(q)\), where \(\lambda\coloneqq[\lambda_{1}\ldots\lambda_{n_{k}}]^{T}\) are the multipliers. Then, the following holds:  
\[\frac{\partial^{2}L}{\partial q^{2}}(P_{\mathcal{O}_{k}}(p),\lambda^{*})= \frac{\partial^{2}}{\partial q^{2}}\bigg{(}\frac{1}{2}\|p-P_{\mathcal{O}_{k}} (p)\|^{2}\bigg{)}-\sum_{j=1}^{n_{k}}\lambda_{j}^{*}\frac{\partial^{2}\omega_{ kj}}{\partial q^{2}}(P_{\mathcal{O}_{k}}(p)), \tag{10}\]  
where \((P_{\mathcal{O}_{k}}(p),\lambda^{*})\) is the solution of (10) which satisfies the Karush-Kuhn-Tucker conditions. Furthermore, \(\frac{\partial^{2}}{\partial q^{2}}(\frac{1}{2}\|p-P_{\mathcal{O}_{k}}(p)\|^ {2})\) is the identity matrix, \(\frac{\partial^{2}\omega_{ij}}{\partial q^{2}}(P_{\mathcal{O}_{k}}(p))\succeq 0\) is derived from the convexity of \(\omega_{kj}\), and \(\lambda_{j}^{*}\leq 0\). Thus, \(\frac{\partial^{2}L}{\partial q^{2}}(P_{\mathcal{O}_{k}}(p),\lambda^{*})\succ 0\) holds from (10). In addition, since \(\frac{\partial\omega_{kj}}{\partial q}(q)\) is linearly independent, there exists the directional derivative of \((P_{\mathcal{O}_{k}}(p),\lambda^{*})\)[(Theorems 2-4)].  
From the Karush-Kuhn-Tucker conditions, the following holds:  
\[\frac{\partial L}{\partial q}(P_{\mathcal{O}_{k}}(p),\lambda^{*})=(P_{ \mathcal{O}_{k}}(p)-p)^{T}+\sum_{j=1}^{n_{k}}\lambda_{j}^{*}\frac{\partial \omega_{kj}}{\partial q}(P_{\mathcal{O}_{k}}(p))=0. \tag{11}\]  
Let \(\hat{q}\) be the directional derivative of \(P_{\mathcal{O}_{k}}(p)\) along \(v\). Then, \(\sum_{i=1}^{n_{k}}\lambda_{i}^{*}\frac{\partial\omega_{ij}}{\partial q}(P_{ \mathcal{O}_{k}}(p))\hat{q}=0\) holds from (11) and [35] ([Theorems 2-4]). Thus, \((p-P_{\mathcal{O}_{k}}(p))^{T}\hat{q}=0\) holds. Hence, the directional derivative of \(l_{k}(p)\) along \(v\) is given by  
\[\frac{(p-P_{\mathcal{O}_{k}}(p))^{T}}{\|p-P_{\mathcal{O}_{k}}(p)\|}(v-\hat{q})= \frac{(p-P_{\mathcal{O}_{k}}(p))^{T}}{\|p-P_{\mathcal{O}_{k}}(p)\|}v, \tag{12}\]  
and \(\frac{\partial l_{k}}{\partial p}(p)=\frac{(p-P_{\mathcal{O}_{k}}(p))^{T}}{\|p -P_{\mathcal{O}_{k}}(p)\|}\) holds. Since the continuity of \(P_{\mathcal{O}_{k}}(p)\) outside the obstacle \(\{p\mid\omega_{kj}(p)>0,\ \forall j\in\{1,2,\ldots,n_{k}\}\}\) is derived from [35] (Theorems 2-4), the partial derivative \(\frac{\partial l_{k}}{\partial p}(p)\) is continuous. Therefore, it is concluded that \(l_{c,k}=l_{k}(p_{ux})\) and \(l_{o,k}=l_{k}(p_{ux})\) are continuously differentiable.