HE_Mesh  5.1.2
wblut.math.WB_Math Class Reference

Static Public Member Functions

static double fastAbs (final double x)
 
static double max (final double x, final double y)
 
static double min (final double x, final double y)
 
static float max (final float x, final float y)
 
static float min (final float x, final float y)
 
static int max (final int x, final int y)
 
static int min (final int x, final int y)
 
static double max (final double x, final double y, final double z)
 
static double min (final double x, final double y, final double z)
 
static float max (final float x, final float y, final float z)
 
static float min (final float x, final float y, final float z)
 
static int max (final int x, final int y, final int z)
 
static int min (final int x, final int y, final int z)
 
static final int max (final int...numbers)
 
static final int min (final int...numbers)
 
static final float max (final float...numbers)
 
static final float min (final float...numbers)
 
static final double max (final double...numbers)
 
static final double min (final double...numbers)
 
static final int floor (final float x)
 
static final float fastLog2 (final float i)
 
static final float fastPow2 (final float i)
 
static final float fastPow (final float a, final float b)
 
static final float fastInvSqrt (float x)
 
static final float fastSqrt (final float x)
 
static int getExp (final double v)
 
static double hypot (final double a, final double b)
 
static double logBase2 (final double value)
 
static boolean isPowerOfTwo (final int value)
 
static int powerOfTwoCeiling (final int reference)
 
static int powerOfTwoFloor (final int reference)
 
static double clamp (final double v, final double min, final double max)
 
static int clamp (final int v, final int min, final int max)
 
static double radians (final double degrees)
 
static double degrees (final double radians)
 
static WB_Coord abs (final WB_Coord v)
 
static WB_Coord sign (final WB_Coord v)
 
static WB_Coord floor (final WB_Coord v)
 
static WB_Coord ceiling (final WB_Coord v)
 
static double fract (final double x)
 
static WB_Coord fract (final WB_Coord v)
 
static WB_Coord mod (final WB_Coord u, final WB_Coord v)
 
static WB_Coord mod (final WB_Coord u, final double v)
 
static WB_Coord min (final WB_Coord u, final WB_Coord v)
 
static WB_Coord min (final WB_Coord u, final double v)
 
static WB_Coord max (final WB_Coord u, final WB_Coord v)
 
static WB_Coord max (final WB_Coord u, final double v)
 
static WB_Coord clamp (final WB_Coord u, final WB_Coord min, final WB_Coord max)
 
static WB_Coord clamp (final WB_Coord u, final double min, final double max)
 
static double mix (final double x, final double y, final double a)
 
static WB_Coord mix (final WB_Coord u, final WB_Coord v, final double a)
 
static WB_Coord mix (final WB_Coord u, final WB_Coord v, final WB_Coord a)
 
static double step (final double edge, final double x)
 
static WB_Vector step (final double edge, final WB_Coord v)
 
static WB_Vector step (final WB_Coord edge, final WB_Coord v)
 
static double smoothstep (final double edge0, final double edge1, final double x)
 
static WB_Vector smoothstep (final double edge0, final double edge1, final WB_Coord v)
 
static WB_Vector smoothstep (final WB_Coord edge0, final WB_Coord edge1, final WB_Coord v)
 

Detailed Description

A collection of fast and approximated math functions. Not as robust as the JAVA implementations when dealing with special values (NaN etc). Some functions only give an approximation.

Author
Frederik Vanhoutte, W:Blut

Member Function Documentation

static WB_Coord wblut.math.WB_Math.abs ( final WB_Coord  v)
static
static WB_Coord wblut.math.WB_Math.ceiling ( final WB_Coord  v)
static
static double wblut.math.WB_Math.clamp ( final double  v,
final double  min,
final double  max 
)
static

Clamps a value to a given range.

Parameters
vthe value to clamp.
minthe floor.
maxthe ceiling
Returns
the nearest value such that min <= v <= max.
static int wblut.math.WB_Math.clamp ( final int  v,
final int  min,
final int  max 
)
static

Clamps an integer value to a given range.

Parameters
vthe value to clamp.
minthe floor.
maxthe ceiling
Returns
the nearest value such that min <= v <= max.
static WB_Coord wblut.math.WB_Math.clamp ( final WB_Coord  u,
final WB_Coord  min,
final WB_Coord  max 
)
static
static WB_Coord wblut.math.WB_Math.clamp ( final WB_Coord  u,
final double  min,
final double  max 
)
static
static double wblut.math.WB_Math.degrees ( final double  radians)
static
static double wblut.math.WB_Math.fastAbs ( final double  x)
static

Fast absolute value.

Parameters
xthe x
Returns
abs(x)
static final float wblut.math.WB_Math.fastInvSqrt ( float  x)
static

Fast inverse sqrt approximation for floats.

Parameters
xthe x
Returns
result
static final float wblut.math.WB_Math.fastLog2 ( final float  i)
static

Fast log2 approximation for floats.

Parameters
ithe i
Returns
result
static final float wblut.math.WB_Math.fastPow ( final float  a,
final float  b 
)
static

Fast power approximation for floats.

Parameters
athe a
bexponent
Returns
result
static final float wblut.math.WB_Math.fastPow2 ( final float  i)
static

Fast square power approximation for floats.

Parameters
ithe i
Returns
result
static final float wblut.math.WB_Math.fastSqrt ( final float  x)
static

Fast sqrt approximation for floats.

Parameters
xthe x
Returns
result
static final int wblut.math.WB_Math.floor ( final float  x)
static

Largest integer smaller than value.

Parameters
xthe x
Returns
result
static WB_Coord wblut.math.WB_Math.floor ( final WB_Coord  v)
static
static double wblut.math.WB_Math.fract ( final double  x)
static
static WB_Coord wblut.math.WB_Math.fract ( final WB_Coord  v)
static
static int wblut.math.WB_Math.getExp ( final double  v)
static
Parameters
v
Returns
static double wblut.math.WB_Math.hypot ( final double  a,
final double  b 
)
static

sqrt(a^2 + b^2) without under/overflow. *

Parameters
a
b
Returns
static boolean wblut.math.WB_Math.isPowerOfTwo ( final int  value)
static

Convenience method for testing whether a value is a power of two.

Parameters
valuethe value to test for power of 2
Returns
true if power of 2, else false
static double wblut.math.WB_Math.logBase2 ( final double  value)
static

Convenience method to compute the log base 2 of a value.

Parameters
valuethe value to take the log of.
Returns
the log base 2 of the specified value.
static double wblut.math.WB_Math.max ( final double  x,
final double  y 
)
static

Fast max.

Parameters
xthe x
ythe y
Returns
max(x,y)
static float wblut.math.WB_Math.max ( final float  x,
final float  y 
)
static

Fast max.

Parameters
xthe x
ythe y
Returns
max(x,y)
static int wblut.math.WB_Math.max ( final int  x,
final int  y 
)
static

Fast max.

Parameters
xthe x
ythe y
Returns
max(x,y)
static double wblut.math.WB_Math.max ( final double  x,
final double  y,
final double  z 
)
static

Maximum of three values.

Parameters
xthe x
ythe y
zthe z
Returns
max(x,y,z)
static float wblut.math.WB_Math.max ( final float  x,
final float  y,
final float  z 
)
static
static int wblut.math.WB_Math.max ( final int  x,
final int  y,
final int  z 
)
static
static final int wblut.math.WB_Math.max ( final int...  numbers)
static
static final float wblut.math.WB_Math.max ( final float...  numbers)
static
static final double wblut.math.WB_Math.max ( final double...  numbers)
static
static WB_Coord wblut.math.WB_Math.max ( final WB_Coord  u,
final WB_Coord  v 
)
static
static WB_Coord wblut.math.WB_Math.max ( final WB_Coord  u,
final double  v 
)
static
static double wblut.math.WB_Math.min ( final double  x,
final double  y 
)
static

Fast min.

Parameters
xthe x
ythe y
Returns
min(x,y)
static float wblut.math.WB_Math.min ( final float  x,
final float  y 
)
static

Fast min.

Parameters
xthe x
ythe y
Returns
min(x,y)
static int wblut.math.WB_Math.min ( final int  x,
final int  y 
)
static

Fast min.

Parameters
xthe x
ythe y
Returns
min(x,y)
static double wblut.math.WB_Math.min ( final double  x,
final double  y,
final double  z 
)
static

Minimum of three values.

Parameters
xthe x
ythe y
zthe z
Returns
min(x,y,z)
static float wblut.math.WB_Math.min ( final float  x,
final float  y,
final float  z 
)
static
static int wblut.math.WB_Math.min ( final int  x,
final int  y,
final int  z 
)
static
static final int wblut.math.WB_Math.min ( final int...  numbers)
static
static final float wblut.math.WB_Math.min ( final float...  numbers)
static
static final double wblut.math.WB_Math.min ( final double...  numbers)
static
static WB_Coord wblut.math.WB_Math.min ( final WB_Coord  u,
final WB_Coord  v 
)
static
static WB_Coord wblut.math.WB_Math.min ( final WB_Coord  u,
final double  v 
)
static
static double wblut.math.WB_Math.mix ( final double  x,
final double  y,
final double  a 
)
static
static WB_Coord wblut.math.WB_Math.mix ( final WB_Coord  u,
final WB_Coord  v,
final double  a 
)
static
static WB_Coord wblut.math.WB_Math.mix ( final WB_Coord  u,
final WB_Coord  v,
final WB_Coord  a 
)
static
static WB_Coord wblut.math.WB_Math.mod ( final WB_Coord  u,
final WB_Coord  v 
)
static
static WB_Coord wblut.math.WB_Math.mod ( final WB_Coord  u,
final double  v 
)
static
static int wblut.math.WB_Math.powerOfTwoCeiling ( final int  reference)
static

Returns the value that is the nearest power of 2 greater than or equal to the given value.

Parameters
referencethe reference value. The power of 2 returned is greater than or equal to this value.
Returns
the value that is the nearest power of 2 greater than or equal to the reference value
static int wblut.math.WB_Math.powerOfTwoFloor ( final int  reference)
static

Returns the value that is the nearest power of 2 less than or equal to the given value.

Parameters
referencethe reference value. The power of 2 returned is less than or equal to this value.
Returns
the value that is the nearest power of 2 less than or equal to the reference value
static double wblut.math.WB_Math.radians ( final double  degrees)
static
static WB_Coord wblut.math.WB_Math.sign ( final WB_Coord  v)
static
static double wblut.math.WB_Math.smoothstep ( final double  edge0,
final double  edge1,
final double  x 
)
static
static WB_Vector wblut.math.WB_Math.smoothstep ( final double  edge0,
final double  edge1,
final WB_Coord  v 
)
static
static WB_Vector wblut.math.WB_Math.smoothstep ( final WB_Coord  edge0,
final WB_Coord  edge1,
final WB_Coord  v 
)
static
static double wblut.math.WB_Math.step ( final double  edge,
final double  x 
)
static
static WB_Vector wblut.math.WB_Math.step ( final double  edge,
final WB_Coord  v 
)
static
static WB_Vector wblut.math.WB_Math.step ( final WB_Coord  edge,
final WB_Coord  v 
)
static

The documentation for this class was generated from the following file: