org.dartra.util
Class MathTools

java.lang.Object
  extended byorg.dartra.util.MathTools

public class MathTools
extends java.lang.Object

Math tools for the J2ME CLDC 1.1 configuration. This implements the methods missing from java.lang.Math in CLDC 1.1.

Based on "henson.midp.Float", (C) by Nikolay Klimchuk.

Author:
Erwin Vervaet

Method Summary
static double atan(double x)
          Returns the arc tangent of an angle, in the range of -pi/2 through pi/2.
static double atan2(double y, double x)
          Converts rectangular coordinates (xy) to polar (r, theta).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

atan

public static double atan(double x)
Returns the arc tangent of an angle, in the range of -pi/2 through pi/2. Special cases:

A result must be within 1 ulp of the correctly rounded result. Results must be semi-monotonic.

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

atan2

public static double atan2(double y,
                           double x)
Converts rectangular coordinates (xy) to polar (r, theta). This method computes the phase theta by computing an arc tangent of y/x in the range of -pi to pi. Special cases:

A result must be within 2 ulps of the correctly rounded result. Results must be semi-monotonic.

Parameters:
y - the ordinate coordinate
x - the abscissa coordinate
Returns:
the theta component of the point (rtheta) in polar coordinates that corresponds to the point (xy) in Cartesian coordinates.