Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7625469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:11:47+00:00 2026-05-31T05:11:47+00:00

How do you calculate the angle between one object and another assuming your first

  • 0

How do you calculate the angle between one object and another assuming your first object is your origin and the up vector is, well up? I struggled with this problem in android and java for about six hours and there wasn’t any really good questions or answers that gave a correct way to calculate it.

If the question is not super clear:
I have an object on the screen and I want to know what the angle is from this object with up being the y axis (or 90 degrees) to another object on the screen. So if the first object is at 1,1 and the second object is at 2,2, then the angle should be 315. This is because 0 degrees is to the right, 90 degrees is up (y axis), 180 degrees is left, and 270 degrees is down.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T05:11:47+00:00Added an answer on May 31, 2026 at 5:11 am

    There might be more elegant solutions, but I found this works well:

    float angle = (float)Math.toDegrees(Math.atan2((double)(y1 - y2),(double)(x1 - x2)));
    angle = (angle + 180.0f) % 360.0f;
    angle = 360.0f - angle;
    

    This gives the angle starting with 0 right, 90 up, 180 left, and 270 down. I answered my own question because it took me over a day to find this and it wasn’t on the internet. I hope it helps someone. I’ll leave the question unanswered for a day or two, to see if anyone can find a more elegant solution or a better way of expressing the answer. This answer is in java and has been tested on Android.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to calculate the angle between two lines formed by three points(one of
In the last week I tried to calculate angle between three points - first
I want to calculate the angle between two vectors a and b. Lets assume
I wanted to calculate the angle between two vectors but I have seen these
I want to calculate a clockwise angle between two line segment A and B.
I'm trying to calculate the smallest difference between two angles. This is my current
For a game i'm trying to calculate the angle between where i'm looking at
For my application I need to calculate an angle between two different lines: 1)
I have some face normals and I need to calculate the angle between the
How to calculate obtuse angle between two vectors if both vectors and x axis

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.