|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrobocode.util.Utils
public class Utils
Utility class that provide methods for normalizing angles.
Field Summary | |
---|---|
static double |
NEAR_DELTA
|
Method Summary | |
---|---|
static Random |
getRandom()
Returns random number generator. |
static boolean |
isNear(double value1,
double value2)
Tests if the two double values are near to each other. |
static double |
normalAbsoluteAngle(double angle)
Normalizes an angle to an absolute angle. |
static double |
normalAbsoluteAngleDegrees(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 |
normalNearAbsoluteAngleDegrees(double angle)
Normalizes an angle to be near an absolute angle. |
static double |
normalRelativeAngle(double angle)
Normalizes an angle to a relative angle. |
static double |
normalRelativeAngleDegrees(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 |
Field Detail |
---|
public static final double NEAR_DELTA
Method Detail |
---|
public static double normalAbsoluteAngle(double angle)
angle
- the angle to normalize
public static double normalAbsoluteAngleDegrees(double angle)
angle
- the angle to normalize
public static double normalRelativeAngle(double angle)
angle
- the angle to normalize
public static double normalRelativeAngleDegrees(double angle)
angle
- the angle to normalize
public static double normalNearAbsoluteAngleDegrees(double angle)
isNear
method is used for defining when the angle is near one of angles listed
above.
angle
- the angle to normalize
normalAbsoluteAngle(double)
,
isNear(double, double)
public static double normalNearAbsoluteAngle(double angle)
isNear
method is used for defining when the angle is near one of angles listed
above.
angle
- the angle to normalize
normalAbsoluteAngle(double)
,
isNear(double, double)
public static boolean isNear(double value1, double value2)
double
values are near to each other.
It is recommended to use this method instead of testing if the two
doubles are equal using an this expression: value1 == value2
.
The reason being, that this expression might never become
true
due to the precision of double values.
Whether or not the specified doubles are near to each other is defined by
the following expression:
(Math.abs(value1 - value2) < .00001)
value1
- the first double valuevalue2
- the second double value
true
if the two doubles are near to each other;
false
otherwise.public static Random getRandom()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |