com.steema.teechart.misc
Class MathUtils

java.lang.Object
  extended by com.steema.teechart.misc.MathUtils

public class MathUtils
extends java.lang.Object

Title: MathUtils class

Description:

Copyright (c) 2005-2007 by Steema Software SL. All Rights Reserved.

Company: Steema Software SL


Field Summary
static double PISTEP
           
 
Constructor Summary
MathUtils()
           
 
Method Summary
static double atan2(double y, double x)
          Note: This method has been implemented here in MathUtils class because J2ME Math class does not include it.
static double calcDistance(Point p, int x0, int y0, int x1, int y1)
           
static int compareDoubles(double d1, double d2)
          Note: This code has been copied from Java JDK Double.compare method, because J2ME Double class does not include it.
static double exp(double a)
          Note: This method has been implemented here in MathUtils class because J2ME Math class does not include it.
static double log(double value)
          Note: This function has been added to MathUtils because J2ME Math class does not include it.
static double log(double x, double numBase)
           
static Point pointAtDistance(Point aFrom, Point aTo, int aDist)
           
static boolean pointInLineTolerance(Point p, int x0, int y0, int x1, int y1, int tolerance)
           
static double pow(double a, double b)
          Note: This method has been implemented here in MathUtils class because J2ME Math class does not include it.
static int round(double value)
          Returns the integer nearest to "value" parameter
static double sqr(double x)
           
static double trunc(double d)
          Note: This method has been implemented here in MathUtils class because J2ME Math class does not include it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PISTEP

public static final double PISTEP
See Also:
Constant Field Values
Constructor Detail

MathUtils

public MathUtils()
Method Detail

sqr

public static final double sqr(double x)

log

public static double log(double value)
Note: This function has been added to MathUtils because J2ME Math class does not include it. Returns Math.log of value parameter.

Parameters:
value - double
Returns:
double

log

public static double log(double x,
                         double numBase)

round

public static int round(double value)
Returns the integer nearest to "value" parameter

Parameters:
value - double
Returns:
int

pointAtDistance

public static Point pointAtDistance(Point aFrom,
                                    Point aTo,
                                    int aDist)

calcDistance

public static double calcDistance(Point p,
                                  int x0,
                                  int y0,
                                  int x1,
                                  int y1)

pointInLineTolerance

public static boolean pointInLineTolerance(Point p,
                                           int x0,
                                           int y0,
                                           int x1,
                                           int y1,
                                           int tolerance)

compareDoubles

public static int compareDoubles(double d1,
                                 double d2)
Note: This code has been copied from Java JDK Double.compare method, because J2ME Double class does not include it. Compares Double d1 with d2. Returns 0 if both are equal. Returns -1 if d1 is lower than d2, and 1 if d1 is bigger than d2.

Parameters:
d1 - double
d2 - double
Returns:
int

atan2

public static double atan2(double y,
                           double x)
Note: This method has been implemented here in MathUtils class because J2ME Math class does not include it. Returns Math.atan2.

Parameters:
y - double
x - double
Returns:
double

pow

public static double pow(double a,
                         double b)
Note: This method has been implemented here in MathUtils class because J2ME Math class does not include it. Returns Math.pow.

Parameters:
a - double
b - double
Returns:
double

exp

public static double exp(double a)
Note: This method has been implemented here in MathUtils class because J2ME Math class does not include it. Returns Math.exp.

Parameters:
a - double
Returns:
double

trunc

public static double trunc(double d)
Note: This method has been implemented here in MathUtils class because J2ME Math class does not include it. Truncate a number to the next nearest integer towards 0

Parameters:
d - double
Returns:
double