public final class FloatMaths extends Object
| Constructor and Description |
|---|
FloatMaths() |
| Modifier and Type | Method and Description |
|---|---|
static float |
abs(float a)
float abs function
|
static float |
alternateSqrt(float x)
Interesting way to approximate a square root....
|
static float |
approxSqrt(float x)
Fast approximate square root
|
static float |
bound(float v,
float min,
float max)
Bound a value within a given range
|
static float |
cos(double a)
Float-returning version of Math.cos
|
static float |
cos(float a)
Float-returning version of Math.cos
|
static float |
fastInverseSqrt(float x)
Fast inverse square root on floats - amusing hack used in Quake
|
static float |
fastPower(float a,
float b)
Computes a fast approximation to
Math.pow(a, b). |
static float |
lerp(float t,
float a,
float b)
Linear interpolation between a and b
|
static float |
mod(float n,
float d)
Mod function implemented for float values
|
static float |
round(float f,
int dp)
Float round to a specified number of decimal places
|
static float |
sin(double a)
Float-returning version of Math.sin
|
static float |
sin(float a)
Float-returning version of Math.sin
|
static float |
smoothFactor(float x)
Smooth factor function for linear interpolation, with dy/dx=0 at x=0 and x=1
|
static float |
smoothStep(float a,
float b,
float x) |
static float |
square(float x)
Square function
|
public static float round(float f,
int dp)
public static final float fastPower(float a,
float b)
Math.pow(a, b). Adapted
from a - a positive numberb - a numberpublic static final float lerp(float t,
float a,
float b)
public static final float smoothFactor(float x)
public static float mod(float n,
float d)
public static final float smoothStep(float a,
float b,
float x)
public static final float bound(float v,
float min,
float max)
public static float abs(float a)
public static float square(float x)
public static float alternateSqrt(float x)
x - public static float approxSqrt(float x)
public static float fastInverseSqrt(float x)
public static float sin(double a)
public static float cos(double a)
public static float sin(float a)
public static float cos(float a)
Copyright © 2012. All Rights Reserved.