Package org.web3d.util
Class MathUtils
java.lang.Object
org.web3d.util.MathUtils
Utility class for miscellaneous calculations,
primarily used in pre-processing images.
- Version:
- $Revision: 1.2 $
- Author:
- Rex Melton
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int
computeLog
(int value) Compute the n where 2^n = value.static int
nearestPowerTwo
(int val, boolean imageScaleUp) Determine the nearest power of two value for a given argument.
-
Constructor Details
-
MathUtils
public MathUtils()
-
-
Method Details
-
nearestPowerTwo
public static int nearestPowerTwo(int val, boolean imageScaleUp) Determine the nearest power of two value for a given argument. This function uses the formal ln(x) / ln(2) = log2(x)- Parameters:
val
-imageScaleUp
-- Returns:
- The power-of-two-ized value
-
computeLog
public static int computeLog(int value) Compute the n where 2^n = value.- Parameters:
value
- The value to compute.- Returns:
-