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

  • SEARCH
  • Home
  • 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 6683103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:46:55+00:00 2026-05-26T04:46:55+00:00

I am trying to include the projectile motion for my game app.When the user

  • 0

I am trying to include the projectile motion for my game app.When the user touches the imageview it calculates the initial angle based on the motion of the imageview.But in logcat I am seeing that these angle values are negative .Can anyone explain why is this so .I want the use r to just set the value of angle between 0 and 90 degree.

Find below my code for calculating angle:-

float dy = motion.getY()-mImage.getPivotY();
float dx = motion.getX()-mImage.getPivotX();

double r = Math.atan2(dy, dx);

int angle = (int)Math.toDegrees(r);

where motion is of type MotionEvent.

  • 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-26T04:46:56+00:00Added an answer on May 26, 2026 at 4:46 am

    Vertical screen coordinates such as that being returned by motion.getY() and mImage.getPivotY() define the origin as the top of the screen moving positively from top to bottom.

    Standard mathematical convention is the opposite of this. You will need to factor this into your equation. In this case by using -dy.

    By way of explanation taking your original equation:

    float dy = motion.getY()-mImage.getPivotY();

    and adjusting the screen coordinates to canonical coordinates

    float dy2 = (Screen.getHeight() – motion.getY()) – (Screen.getHeight()
    – mImage.getPivotY());

    Which gives:

    float dy2 = mImage.getPivotY() – motion.getY()

    Hence:

    float dy2 = -dy

    This is why you are seeing a negative value.

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

Sidebar

Related Questions

I've been trying to include a structure called student in a student.h file, but
I am trying include c++ library (DLL) in my c# project but every time
I am trying include a python package (NLTK) with a Hadoop streaming job, but
I am trying to include the following Tag In Google App Engine Web Application:
Trying to include a hoverIntent based on the following code: private void ViewerTab_MouseLeave(object sender,
Trying to include ThickBox (from http://jquery.com/demo/thickbox/ ) in an ASP.NET application. Visual Studio is
I am trying to include a value from a database table within the value
I'm trying to include the Sparkle framework in my application. I don't really understand
I'm trying to include an image in an email, which is being sent using
I'm trying to include an EPS figure in a document that will be compiled

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.