Summ:  Fields Constr. Methods    Details:  Fields Constr. Methods      Class:  Constants Prev Next
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
    
static double PIOver2
    
static double PIOver4
    
static double TwoPI
    

 

 

Constructors Summary
MathUtils()
    

 

 

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 double coerce(double value, double interval)
    
Coerces value to human readable representation.
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 round(double value, int degree)
    
Rounds value to specified degree.
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

 

Since: 1.0
See also: Constants

 

 

 

PIOver4

 

public static final double PIOver4

 

Since: 1.0
See also: Constants

 

 

 

PIAndHalf

 

public static final double PIAndHalf

 

Since: 1.0
See also: Constants

 

 

 

TwoPI

 

public static final double TwoPI

 

Since: 1.0
See also: Constants

 

 

 

 

MathUtils

 

public MathUtils( )

 

 

 

 

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

 

 

 

coerce

 

public static double coerce( double value,
double interval)

 

Coerces value to human readable representation.

 

Parameters:
value-
value to coerce.
interval-
interval that is used to determine range.
Returns:
coerced value.

 

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

 

 

 

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

 

 

 

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

 

 

 

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

 

 

© 2005 - 2010 ArtfulBits. All rights reserved.