While picking apart the machine code of an old video game, I came across a routine that was doing something I haven't personally seen before regarding trigonometry. I'm sure it's very common knowledge and that I just happen to not know about it... But I can't figure out why it works and am hopeful someone could spell it out for me.
It goes something like this: given a reference angle [imath]\theta[/imath] and a point of interest [imath](x,y)[/imath], determine whether the point is "in front of" or "behind" the reference angle... or in other words, test if the angle to the point is more than 90 degrees off from the reference angle.
Mechanically, the test is very simple:
If true, the point [imath](x,y)[/imath] is situated "behind" with respect to the reference angle. This Desmos setup demonstrates the technique.
Why does this work? I can see that it's related to projecting a point onto circles with radii given by the coordinates of the point of interest, but how that unto itself is useful or why adding them gives a meaningful result eludes me. Does this have a name, like, Someguy's Formula or something?
It goes something like this: given a reference angle [imath]\theta[/imath] and a point of interest [imath](x,y)[/imath], determine whether the point is "in front of" or "behind" the reference angle... or in other words, test if the angle to the point is more than 90 degrees off from the reference angle.
Mechanically, the test is very simple:
[imath]x cos\theta + y sin\theta < 0[/imath]
If true, the point [imath](x,y)[/imath] is situated "behind" with respect to the reference angle. This Desmos setup demonstrates the technique.
Why does this work? I can see that it's related to projecting a point onto circles with radii given by the coordinates of the point of interest, but how that unto itself is useful or why adding them gives a meaningful result eludes me. Does this have a name, like, Someguy's Formula or something?