de.unihalle.informatik.MiToBo.apps.xylem
Class MathHelper

java.lang.Object
  extended by de.unihalle.informatik.MiToBo.apps.xylem.MathHelper

public final class MathHelper
extends Object


Field Summary
static double PI_HALF
           
 
Method Summary
static double acot(double value)
          Return the arcus cotangens of value in radian.
static double angleDiff360(double angleOne, double angleTwo)
           
static double calcMean(double[] values)
          Return the mean value of an array of double.
static double calcMedian(double[] values)
          Returns the median value of an array of double.
static double[] calcMinMax(double[] values)
          Returns the min and max value.
static double calcVariance(double[] values)
          Returns the variance of an array of double.
static double cot(double value)
          Return the cotangens of value.
static Point2D.Double point2DDiff(Point2D.Double pointOne, Point2D.Double pointTwo)
          Substract two Point2D.Double .
static Point2D.Double point2DSum(Point2D.Double pointOne, Point2D.Double pointTwo)
          Sums up two Point2D.Double .
static Point2D.Double toCartesianAsPoint2D(double angleDegree)
          Converts an angle in degree to its corresponding in cartesian coordinates.
static double[] toCartesianAsVector(double angleDegree)
          Converts an angle in degree to its correspondant in cartesian coordinates.
static double toPositiveAngle360(double angle)
          Simple way to convert negative angles to 0-360 degree.
static double[] unitVector(double[] vector)
          Return the unit vector of vector.
static double[] vectorDiff(double[] vecOne, double[] vecTwo)
          Subtract two vectors.
static double vectorNorm(double[] vector)
          Returns the norm of a vector.
static double[] vectorSum(double[] vecOne, double[] vecTwo)
          Sums up two vectors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PI_HALF

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

acot

public static final double acot(double value)
Return the arcus cotangens of value in radian.

This function is implemented as described in "Teubner - Taschenbuch der Mathematik [Bronstein/Samendjajew]".

Parameters:
value - A rational floating point number.
Returns:
The Arcuscotangens of value.

angleDiff360

public static final double angleDiff360(double angleOne,
                                        double angleTwo)
Parameters:
angleOne -
angleTwo -
Returns:

calcMean

public static double calcMean(double[] values)
Return the mean value of an array of double.

Parameters:
values -
Returns:

calcMedian

public static double calcMedian(double[] values)
Returns the median value of an array of double.

Parameters:
values -
Returns:

calcMinMax

public static double[] calcMinMax(double[] values)
Returns the min and max value.

Parameters:
values -
Returns:

calcVariance

public static double calcVariance(double[] values)
Returns the variance of an array of double.

Parameters:
values -
Returns:

cot

public static final double cot(double value)
Return the cotangens of value. In case of 0 the returned value is not a number - the tangens function is not defined for zero -> 1/Infinty is not a number.

Parameters:
value - The argument of the cotangens function.
Returns:
The result of the cotangens function.

point2DDiff

public static final Point2D.Double point2DDiff(Point2D.Double pointOne,
                                               Point2D.Double pointTwo)
Substract two Point2D.Double .

Parameters:
pointOne -
pointTwo -
Returns:

point2DSum

public static final Point2D.Double point2DSum(Point2D.Double pointOne,
                                              Point2D.Double pointTwo)
Sums up two Point2D.Double .

Parameters:
pointOne -
pointTwo -
Returns:

toCartesianAsPoint2D

public static final Point2D.Double toCartesianAsPoint2D(double angleDegree)
Converts an angle in degree to its corresponding in cartesian coordinates.

Parameters:
angleDegree - An angle in degree.
Returns:
A Point2D.Double containing the coordinate in cartesian coordinate system

toCartesianAsVector

public static final double[] toCartesianAsVector(double angleDegree)
Converts an angle in degree to its correspondant in cartesian coordinates.

Parameters:
angleDegree - An angle between 0 and 359 degree.
Returns:
An array with the x and y cartesian coordinate.

toPositiveAngle360

public static final double toPositiveAngle360(double angle)
Simple way to convert negative angles to 0-360 degree.

Parameters:
angle - An angle in the range of [-360,360]
Returns:

vectorDiff

public static double[] vectorDiff(double[] vecOne,
                                  double[] vecTwo)
Subtract two vectors.

Parameters:
vecOne -
vecTwo -
Returns:

vectorNorm

public static double vectorNorm(double[] vector)
Returns the norm of a vector.

Parameters:
vector -
Returns:

unitVector

public static double[] unitVector(double[] vector)
Return the unit vector of vector.

Parameters:
vector -
Returns:

vectorSum

public static final double[] vectorSum(double[] vecOne,
                                       double[] vecTwo)
Sums up two vectors.

Parameters:
vecOne -
vecTwo -
Returns:


Copyright © 2010–2015 Martin Luther University Halle-Wittenberg. All rights reserved.