org.deegree.commons.utils.math
Class MathUtils

java.lang.Object
  extended by org.deegree.commons.utils.math.MathUtils

public class MathUtils
extends Object

MathUtils

Version:
$Revision: 30119 $, $Date: 2011-03-22 10:02:35 +0100 (Tue, 22 Mar 2011) $
Author:
Andreas Schmitz, last edited by: $Author: aschmitz $

Field Summary
static double EPSILON
           
static double SQRT2
          The value of sqrt(2)
 
Constructor Summary
MathUtils()
           
 
Method Summary
static boolean isZero(double v)
           
static int nextPowerOfTwoValue(double value)
          This method will return the next power of two for the given value, e.g. if value is 511 it will return 512, if value is 513 it will return 1024.
static int previousPowerOfTwo(double value)
          This method will return the next power, two must be raised too to give the next power of two, e.g. if value is 511 it will return 9, if value is 513 it will return 10.
static int round(double v)
          Helper to round a double value to an int without the need to cast.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EPSILON

public static final double EPSILON
See Also:
Constant Field Values

SQRT2

public static final double SQRT2
The value of sqrt(2)

Constructor Detail

MathUtils

public MathUtils()
Method Detail

round

public static int round(double v)
Helper to round a double value to an int without the need to cast.

Parameters:
v -
Returns:
a rounded int

isZero

public static boolean isZero(double v)
Parameters:
v -
Returns:
true, if abs(v) < EPSILON.

previousPowerOfTwo

public static int previousPowerOfTwo(double value)
This method will return the next power, two must be raised too to give the next power of two, e.g. if value is 511 it will return 9, if value is 513 it will return 10.

Parameters:
value - to use
Returns:
the next power to the base of two the given value has

nextPowerOfTwoValue

public static int nextPowerOfTwoValue(double value)
This method will return the next power of two for the given value, e.g. if value is 511 it will return 512, if value is 513 it will return 1024.

Parameters:
value - to use
Returns:
the next power of two of the given value


Copyright © 2011. All Rights Reserved.