us.ihmc.utilities.math.geometry
Class AngleTools

java.lang.Object
  extended by us.ihmc.utilities.math.geometry.AngleTools

public class AngleTools
extends java.lang.Object


Field Summary
static double EPSILON
           
static double PI
           
static double TwoPI
           
 
Method Summary
static double angleMinusPiToPi(javax.vecmath.Vector2d startVector, javax.vecmath.Vector2d endVector)
           
static double computeAngleAverage(double angleA, double angleB)
           
static double computeAngleDifferenceMinusPiToPi(double angleA, double angleB)
          computeAngleDifferenceMinusPiToPi: returns (angleA - angleB), where the return value is [-pi, pi)
static double computeAngleDifferenceMinusTwoPiToZero(double angleA, double angleB)
          computeAngleDifferenceMinusPiToPi: returns (angleA - angleB), where the return value is [-2.0*pi, 0.0)
static int findClosestNinetyDegreeYaw(double yawInRadians)
          Finds the closest 90 degree yaw and returns number of 90 degrees (0 = 0; 1 = 90; 2 = 180; 3 = 270).
static double generateRandomAngle(java.util.Random random)
          Returns an evenly distributed random number between -2PI and 2PI
static double shiftAngleToStartOfRange(double angleToShift, double startOfAngleRange)
          This will shift an angle to be in the range [startOfAngleRange, (startOfAngleRange + 2*pi)
static double trimAngleMinusPiToPi(double angle)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PI

public static final double PI
See Also:
Constant Field Values

TwoPI

public static final double TwoPI
See Also:
Constant Field Values

EPSILON

public static final double EPSILON
See Also:
Constant Field Values
Method Detail

trimAngleMinusPiToPi

public static double trimAngleMinusPiToPi(double angle)

angleMinusPiToPi

public static double angleMinusPiToPi(javax.vecmath.Vector2d startVector,
                                      javax.vecmath.Vector2d endVector)

computeAngleAverage

public static double computeAngleAverage(double angleA,
                                         double angleB)

findClosestNinetyDegreeYaw

public static int findClosestNinetyDegreeYaw(double yawInRadians)
Finds the closest 90 degree yaw and returns number of 90 degrees (0 = 0; 1 = 90; 2 = 180; 3 = 270).

Parameters:
yawInRadians - double
Returns:
int between 0 and 3 for the number of 90 degree yawed.

computeAngleDifferenceMinusPiToPi

public static double computeAngleDifferenceMinusPiToPi(double angleA,
                                                       double angleB)
computeAngleDifferenceMinusPiToPi: returns (angleA - angleB), where the return value is [-pi, pi)

Parameters:
angleA - double
angleB - double
Returns:
double

computeAngleDifferenceMinusTwoPiToZero

public static double computeAngleDifferenceMinusTwoPiToZero(double angleA,
                                                            double angleB)
computeAngleDifferenceMinusPiToPi: returns (angleA - angleB), where the return value is [-2.0*pi, 0.0)

Parameters:
angleA - double
angleB - double
Returns:
double

shiftAngleToStartOfRange

public static double shiftAngleToStartOfRange(double angleToShift,
                                              double startOfAngleRange)
This will shift an angle to be in the range [startOfAngleRange, (startOfAngleRange + 2*pi)

Parameters:
angleToShift - the angle to shift
startOfAngleRange - start of the range.
Returns:
the shifted angle

generateRandomAngle

public static double generateRandomAngle(java.util.Random random)
Returns an evenly distributed random number between -2PI and 2PI

Parameters:
random - Random number generator
Returns:
number between -2PI and 2PI