How convert a point on an X and Y grid to a angle degree?

Join the discussion
Registration is free. Start your own thread to ask a follow-up.
4 replies · 2K views
Xarzu
<Moderator's note: Moved from a technical forum and thus no template.>

Hello Forum,

This post is a spin-off from this post:

https://www.physicsforums.com/threa...een-watching-the-sun-set.925257/#post-5840279

If I have an X and Y point on a grid that represents the intersection of two formulas: A straight line (aX = Y) where "a" represents a constant number with a circle (X 2 + Y 2 = radius 2, how would I convert that point into a degree of an angle? The angle would represent the line function albeit only go one direction on the grid. It would be some degree.

If I were to guess, this might be very simple and have something to do with cosine rules.
 
Last edited by a moderator:
Physics news on Phys.org
Yes. Have you drawn the situation? And what do you know about how cosine and sine are defined?
 
fresh_42 said:
Yes. Have you drawn the situation? And what do you know about how cosine and sine are defined?
I have an X and Y point of intersection. Yes, I have drawn the situation thanks to a C++ program (if you are following the other thread). Anyway, it is just a line going out from the middle of the grid now. I want to convert this line to an angle somehow. How do I do that? If it were an angle, then this would help me to convert into time since the circle represents a 24 hour period. Any ideas?

I am not really sure what you mean.
 
Xarzu said:
If I have an X and Y point on a grid that represents the intersection of two formulas: A straight line (aX = Y) where "a" represents a constant number with a circle (X2 + Y2 = radius2, how would I convert that point into a degree of an angle? The angle would represent the line function albeit only go one direction on the grid. It would be some degree.
It sounds like you're trying to find the angle that the line y = ax makes with the horizontal, so the circle isn't needed at all.
The coefficient a represents the slope of the line, where slope = tangent(angle).

For example, the line y = 2x has a slope of 2, so ##2 = tan(\theta)##, with ##\theta## being often used to represent an angle.
Take the inverse tangent (##\tan^{-1}## or ##\arctan##) of both sides to get
##\tan^{-1}(2) = \theta##. In degrees, ##\theta## is about 63.4°.
 
  • Like
Likes   Reactions: Xarzu