NASA World Wind

gov.nasa.worldwind.util
Class WWMath

java.lang.Object
  extended by gov.nasa.worldwind.util.WWMath

public class WWMath
extends java.lang.Object

A collection of useful math methods, all static.


Constructor Summary
WWMath()
           
 
Method Summary
static boolean isPowerOfTwo(int value)
          Convenience method for testing is a value is a power of two.
static double logBase2(double value)
          Convenience method to compute the log-2 of a value.
static int nearestPowerOfTwo(int reference)
          Returns a resolution value that is the nearest power of 2 greater than or equal to the given value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WWMath

public WWMath()
Method Detail

isPowerOfTwo

public static boolean isPowerOfTwo(int value)
Convenience method for testing is a value is a power of two.

Parameters:
value - the value to test for power of 2
Returns:
true if power of 2, else false

logBase2

public static double logBase2(double value)
Convenience method to compute the log-2 of a value.

Parameters:
value - the value to take the log of.
Returns:
the log base 2 of the specified value.

nearestPowerOfTwo

public static int nearestPowerOfTwo(int reference)
Returns a resolution value that is the nearest power of 2 greater than or equal to the given value.

Parameters:
reference - the reference value. The power of 2 returned is greater than or equal to this value.
Returns:
power of two resolution

NASA World Wind