public class FastMath
extends java.lang.Object
| Constructor and Description |
|---|
FastMath() |
| Modifier and Type | Method and Description |
|---|---|
static float |
abs(float value) |
static float |
absMax(float value1,
float value2) |
static boolean |
absMaxCmp(float value1,
float value2,
float cmp)
test if any absolute value is greater than 'cmp'
|
static boolean |
absMaxCmp(int value1,
int value2,
int cmp)
test if any absolute value is greater than 'cmp'
|
static double |
clamp(double value,
double min,
double max) |
static float |
clamp(float value,
float min,
float max) |
static int |
clamp(int value,
int min,
int max) |
static double |
clampDegree(double degree)
Returns normalized degree in range of -180° to +180°
|
static float |
clampN(float value) |
static double |
clampRadian(double radian)
Returns normalized radian in range of -PI to +PI
|
static byte |
clampToByte(int value) |
static int |
log2(int x)
Integer version of log2(x)
from http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog
|
static float |
pow(int x)
Integer version of 2^x
|
static float |
round2(float value) |
static boolean |
withinSquaredDist(float dx,
float dy,
float distance) |
static boolean |
withinSquaredDist(int dx,
int dy,
int distance) |
public static float abs(float value)
public static float absMax(float value1,
float value2)
public static boolean absMaxCmp(float value1,
float value2,
float cmp)
public static boolean absMaxCmp(int value1,
int value2,
int cmp)
public static int clamp(int value,
int min,
int max)
public static float clamp(float value,
float min,
float max)
public static double clamp(double value,
double min,
double max)
public static double clampDegree(double degree)
public static float clampN(float value)
public static double clampRadian(double radian)
public static byte clampToByte(int value)
public static int log2(int x)
public static float pow(int x)
public static float round2(float value)
public static boolean withinSquaredDist(int dx,
int dy,
int distance)
public static boolean withinSquaredDist(float dx,
float dy,
float distance)