I am trying to understand how to detect if a line segment based upon a direction would be within a +/- rotation. I can't seem to understand how though. What I appear to be lacking is the jumping off point to figure it out.
![](https://uploads.gamedev.net/forums/monthly_2020_09/511fd5cf92154646b4dfdf5a95353856.linesegmentdirection.png)
What I have are two objects, A (the blue square) and B (the purple square). Using the direction and position of object B I would like to know if the line segment to A is within a certain rotation range. An example of this being correct is Figure A but an example of it being incorrect is Figure B because the line segment crossing over the range (presented by the green line for in range and red line for the range being crossed over)