Artificial intelligent assistant

How determine if a point is in scan arc of a robot? I have a robot with a scan arc starting at $p1$ and ending at $p2$. The radius of this arc is $r$ and the angular aperture is $\phi$. The rotation angle of the robot is $\theta$. How can I determine if a point $c$ is in the scan arc of the robot. ![enter image description here](

Obviously, the distance to $c$ must be less than or equal to $r$. For testing the angle, since you don’t care about which side of the robot the object is on, using a dot product is convenient. Recall that $\mathbf v\cdot\mathbf w = \|\mathbf v\|\,\|\mathbf w\|\cos\alpha$, where $\alpha$ is the angle between the vectors. If you take $\mathbf v=(\cos\theta,\sin\theta)$, the unit vector in the direction of the robot’s facing and $\mathbf w=c=(x_c,y_c)$, the angle $\alpha$ is then the relative bearing of the object. For the object to be in the field of vision, you must have $\cos\alpha \ge \cos\frac\phi2$. Putting this all together, the object is visible iff $${x_c\cos\theta+y_c\sin\theta \over \sqrt{x_c^2+y_c^2}}\ge\cos\frac\phi2$$ and $\sqrt{x_c^2+y_c^2}\le r$.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy b8c0db9a4883ea819f2e22e963e3122e