I have a 1000×1000 grid with a fixed point (p1) in the centre and a variable point (p2). How can I calculate, in degrees, the angle indicated in red? The vertical blue line will always be fixed as 0 degrees.

Many thanks in advance.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
arctan(p2.y/p2.x) + 90works for the upper-left quadrant. Depending on how you want to calculate the other quadrants you can either use the same formula or use the inverse asabs(result - 180)