Summ:  Fields Methods    Details:  Fields Methods      Class:  Constants Prev
com.artfulbits.aiCharts.Base
Class MathUtils

java.lang.Object com.artfulbits.aiCharts.Base.MathUtils

Declaration: public final class MathUtils extends Object

 

Represents mathematical utilities class.

 

Since: 1.0

 

 

Fields Summary
static double PIAndHalf
    
PI + 0.5 * PI.
static double PIOver2
    
0.5 * PI.
static double PIOver4
    
0.25 * PI.
static double TwoPI
    
2 * PI.

 

 

Methods Summary
static double cellingTo(double value, double div)
    
Rounds target value to make it multiples div.
static double clamp(double value, double min, double max)
    
Shifts value to fall into specified interval.
static int clamp(int value, int min, int max)
    
Shifts value to fall into specified interval.
static boolean equals(java.lang.Double arg1, double arg2)
    
Determines whether instance of arg1 equals arg2.
static double floorTo(double value, double div)
    
Rounds target value to make it multiples div.
static double log10(double value)
    
Returns the closest double approximation of the base 10 logarithm of the argument
static double round(double value, int degree)
    
Rounds value to specified degree.
static double roundDouble(double value)
    
Rounds specified value.
static double[] solveQuadratic(double a, double b, double c)
    
Determines roots of quadratic equation Ax^2 + Bx + C = 0.

 

Methods inherited from class: java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

 

 

 

PIOver2

 

public static final double PIOver2

 

0.5 * PI.

 

Since: 1.0
See also: Constants

 

 

 

PIOver4

 

public static final double PIOver4

 

0.25 * PI.

 

Since: 1.0
See also: Constants

 

 

 

PIAndHalf

 

public static final double PIAndHalf

 

PI + 0.5 * PI.

 

Since: 1.0
See also: Constants

 

 

 

TwoPI

 

public static final double TwoPI

 

2 * PI.

 

Since: 1.0
See also: Constants

 

 

 

 

cellingTo

 

public static double cellingTo( double value,
double div)

 

Rounds target value to make it multiples div.

 

Parameters:
value-
target value.
div-
division.
Returns:
rounded value.

 

Since: 1.0

 

 

 

floorTo

 

public static double floorTo( double value,
double div)

 

Rounds target value to make it multiples div.

 

Parameters:
value-
target value.
div-
division
Returns:
rounded value.

 

Since: 1.0

 

 

 

round

 

public static double round( double value,
int degree)

 

Rounds value to specified degree.

 

Parameters:
value-
value to round.
degree-
required degree.
Returns:
rounded value.

 

Since: 1.0

 

 

 

clamp

 

public static double clamp( double value,
double min,
double max)

 

Shifts value to fall into specified interval.

 

Parameters:
value-
value to shift.
min-
start of interval.
max-
end of interval.
Returns:
min if value < min
max if value > max
initial value if value fall in specified interval.

 

Since: 1.0

 

 

 

clamp

 

public static int clamp( int value,
int min,
int max)

 

Shifts value to fall into specified interval.

 

Parameters:
value-
value to shift.
min-
start of interval.
max-
end of interval.
Returns:
min if value < min
max if value > max
initial value if value fall in specified interval.

 

Since: 1.0

 

 

 

solveQuadratic

 

public static double[] solveQuadratic( double a,
double b,
double c)

 

Determines roots of quadratic equation Ax^2 + Bx + C = 0.

 

Parameters:
a-
A coefficient.
b-
B coefficient
c-
C coefficient
Returns:
array of double roots of equation or null if roots could not be found on the real axis.

 

Since: 1.0

 

 

 

log10

 

public static double log10( double value)

 

Returns the closest double approximation of the base 10 logarithm of the argument

 

Parameters:
value-
the value whose base 10 log has to be computed.
Returns:
the natural logarithm of the argument.

 

 

 

equals

 

public static boolean equals( java.lang.Double arg1,
double arg2)

 

Determines whether instance of arg1 equals arg2.

 

Parameters:
arg1-
instance of java.lang.Double.
arg2-
double value to compare.
Returns:
true if values are equal, otherwise false.

 

Since: 1.0

 

 

 

roundDouble

 

public static double roundDouble( double value)

 

Rounds specified value.

 

Parameters:
value-
target value to be rounded.
Returns:
rounded value.

 

Since: 1.0

 

 

© 2005 - 2010 ArtfulBits. All rights reserved.