gorteganesh / achartengine

Automatically exported from code.google.com/p/achartengine
0 stars 0 forks source link

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

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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 commented 9 years ago
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