Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MathHelper.getAngle(int) will return improper value #8

Closed
GoogleCodeExporter opened this issue Mar 25, 2015 · 1 comment
Closed

MathHelper.getAngle(int) will return improper value #8

GoogleCodeExporter opened this issue Mar 25, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Pass any integer x > 720 or x < -720 and getAngle()'s value will not be 
between 0-360

example:

passing 1080 will return 720


Please provide a source code snippet that we can use to replicate the issue.

From org.achartengine.util.MathHelper.java:

public static int getAngle(int angle) {
    if (angle < 0) {
      return ANGLE + angle;
    }
    if (angle > ANGLE) {
      return angle - ANGLE;
    }
    return angle;
  }


What version of the product binary library are you using?
0.5.0


Please provide any additional information below.

This can be fixed with:

public static int getAngle(int angle) {
    return angle % ANGLE;
  }


Original issue reported on code.google.com by jwso...@gmail.com on 28 Jul 2010 at 3:12

@GoogleCodeExporter
Copy link
Author

Fixed in svn rev. r75.
Actually removed it as it is not needed by the library.

Original comment by dandrome...@gmail.com on 16 Nov 2010 at 5:41

  • Changed state: Fixed
  • Added labels: ****
  • Removed labels: ****

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant