com.planeth.common.math
Class MathToolBox

java.lang.Object
  extended bycom.planeth.common.math.MathToolBox

public final class MathToolBox
extends java.lang.Object

MathToolBox

Author:
Andreas Grässer, gal@planet-h.com.
created May 14, 2005

Method Summary
static double acos(double value)
          Returns the arc cosine
static double asin(double value)
          Returns the arc sine
static double atan(double value)
          Returns the arc tangent
static double cos(double angleRad)
          Returns the cosine
static double degToRad(double deg)
          Converts from degrees to radians
static double getAreaCircle(double diameter)
          Calculates the area of a circle
static double getCircumference(double diameter)
          Calculates the circumference
static double getHypotenuse(double cathetusA, double cathetusB)
          Calculates the Hypotenuse of an right angled triangle
static double getVolumeSphere(double diameter)
          Calculates the volume of a sphere
static double radToDeg(double rad)
          Converts from radians to degrees
static double randomAngleDeg()
          Returns a random angle in degrees
static double randomAngleRad()
          Returns a random angle in radians
static double randomDouble(double min, double max)
          Returns a random double in the selected range
static int randomInt(int min, int max)
          Returns a random integer in the selected range
static double round(double value, int digits)
          Rounds a double to the defined digits
static double sin(double angleRad)
          Returns the sine
static double tan(double angleRad)
          Returns the tangent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

degToRad

public static double degToRad(double deg)
Converts from degrees to radians

Parameters:
deg -
Returns:
rad

radToDeg

public static double radToDeg(double rad)
Converts from radians to degrees

Parameters:
rad -
Returns:
deg

getVolumeSphere

public static double getVolumeSphere(double diameter)
Calculates the volume of a sphere

Parameters:
diameter - diameter of the sphere
Returns:
the volume of the sphere

getAreaCircle

public static double getAreaCircle(double diameter)
Calculates the area of a circle

Parameters:
diameter - diameter of the circle
Returns:
the area of the circle

getCircumference

public static double getCircumference(double diameter)
Calculates the circumference

Parameters:
diameter - diameter of the circle
Returns:
the circumference

getHypotenuse

public static double getHypotenuse(double cathetusA,
                                   double cathetusB)
Calculates the Hypotenuse of an right angled triangle

Parameters:
cathetusA -
cathetusB -
Returns:
the Hypotenuse of an right angled triangle

atan

public static double atan(double value)
Returns the arc tangent

Parameters:
value - the value whose arc tangent is to be returned
Returns:
the arc tangent of the argument

tan

public static double tan(double angleRad)
Returns the tangent

Parameters:
angleRad - angle in radians
Returns:
the tangent of the argument

asin

public static double asin(double value)
Returns the arc sine

Parameters:
value - the value whose arc sine is to be returned.
Returns:
the arc sine of the argument.

sin

public static double sin(double angleRad)
Returns the sine

Parameters:
angleRad - angle in radians
Returns:
the sine of the argument.

acos

public static double acos(double value)
Returns the arc cosine

Parameters:
value - the value whose arc cosine is to be returned.
Returns:
the arc cosine of the argument.

cos

public static double cos(double angleRad)
Returns the cosine

Parameters:
angleRad - angle in radians
Returns:
cosine of the argument.

round

public static double round(double value,
                           int digits)
Rounds a double to the defined digits

Parameters:
value - Value to be rounded
digits - Number of digits to round
Returns:
the rounded value

randomInt

public static int randomInt(int min,
                            int max)
Returns a random integer in the selected range

Parameters:
min -
max -
Returns:
Returns a random integer in the selected range

randomDouble

public static double randomDouble(double min,
                                  double max)
Returns a random double in the selected range

Parameters:
min -
max -
Returns:
Returns a random double in the selected range

randomAngleRad

public static double randomAngleRad()
Returns a random angle in radians

Returns:
Returns a random angle in radians

randomAngleDeg

public static double randomAngleDeg()
Returns a random angle in degrees

Returns:
Returns a random angle in degrees