Utils (Robocode 1.2.4-Beta API)

Overview | Package | Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## robocode.util
Class Utils

    java.lang.Object
      robocode.util.Utils

    public class Utils

extends java.lang.Object

Utility class that provide methods for normalizing angles.

Author:
  Mathew A. Nelson (original), Flemming N. Larsen (contributor)

Method Summary
`static boolean` | `isNear(double angle1, double angle2)` Tests if the two specified angles are near to each other.
`static double` | `normalAbsoluteAngle(double angle)` Normalizes an angle to an absolute angle.
`static double` | `normalNearAbsoluteAngle(double angle)` Normalizes an angle to be near an absolute angle.
`static double` | `normalRelativeAngle(double angle)` Normalizes an angle to a relative angle.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### normalAbsoluteAngle

    public static double normalAbsoluteAngle(double angle)

  Normalizes an angle to an absolute angle. The normalized angle will be in the range from 0 to 2*PI, where 2*PI itself is not included.

  Parameters:
    `angle` - the angle to normalize
  Returns:
    the normalized angle that will be in the range of [0,2*PI[

### normalRelativeAngle

    public static double normalRelativeAngle(double angle)

  Normalizes an angle to a relative angle. The normalized angle will be in the range from -PI to PI, where PI itself is not included.

  Parameters:
    `angle` - the angle to normalize
  Returns:
    the normalized angle that will be in the range of [-PI,PI[

### normalNearAbsoluteAngle

    public static double normalNearAbsoluteAngle(double angle)

  Normalizes an angle to be near an absolute angle. The normalized angle will be in the range from 0 to 2*PI, where 2*PI itself is not included. If the normalized angle is near to 0, PI/2, PI, 3*PI/2 or 2*PI, that angle will be returned. The `isNear` method is used for defining when the angle is near one of angles listed above.

  Parameters:
    `angle` - the angle to normalize
  Returns:
    the normalized angle that will be in the range of [0,2*PI[
  See Also:
    `normalAbsoluteAngle(double)`, `isNear(double, double)`

### isNear

    public static boolean isNear(double angle1,
                                 double angle2)

  Tests if the two specified angles are near to each other. Whether or not the specified angles are near t each other is defined by the following expression: `(Math.abs(angle1 - angle2) < .00001)`

  Parameters:
    `angle1` - the first angle
    `angle2` - the second angle
  Returns:
    `true` if the two angles are near to each other; `false` otherwise.

Overview | Package | Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD