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 float |
clampN(float value) |
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 boolean |
withinSquaredDist(float dx,
float dy,
float distance) |
static boolean |
withinSquaredDist(int dx,
int dy,
int distance) |
public static int log2(int x)
public static float pow(int x)
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 float clampN(float value)
public static byte clampToByte(int value)
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 boolean withinSquaredDist(int dx,
int dy,
int distance)
public static boolean withinSquaredDist(float dx,
float dy,
float distance)