deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official

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: 18171 $, $Date: 2009-06-17 16:00:07 +0200 (Mi, 17 Jun 2009) $
Author:
Andreas Schmitz, last edited by: $Author: mschneider $

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

deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org

]]>