HE_Mesh  6.0.1
wblut.math.WB_Epsilon Class Reference

Static Public Member Functions

static double clampEpsilon (final double x, final double min, final double max)
 
static boolean isEqualHybrid (final double x, final double y)
 
static boolean isEqualAbs (final double x, final double y)
 
static boolean isEqualAbs (final double x, final double y, final double threshold)
 
static boolean isEqualRel (final double x, final double y)
 
static boolean isZero (final double x)
 
static boolean isZeroSq (final double x)
 
static int compareHybrid (final double x, final double y)
 
static int compareAbs (final double x, final double y)
 
static int compareRel (final double x, final double y)
 

Static Public Attributes

static double EPSILON = 1e-12
 
static double SQEPSILON = EPSILON * EPSILON
 
static double EPSILONANGLE = 1e-5 * Math.PI / 180.0
 

Detailed Description

WB_Epsilon contains functions for tolerance based floating point calculations.

Author
Frederik Vanhoutte, W:Blut

Member Function Documentation

static double wblut.math.WB_Epsilon.clampEpsilon ( final double  x,
final double  min,
final double  max 
)
static

Clamp value to range with error margin.

Parameters
x
min
max
Returns
clamped value
static int wblut.math.WB_Epsilon.compareAbs ( final double  x,
final double  y 
)
static

Compare with error margin using isEqualAbs.

Parameters
x
y
Returns
0 if equal, -1 if x<y, +1 if x>1

References wblut.math.WB_Epsilon.isEqualAbs().

static int wblut.math.WB_Epsilon.compareHybrid ( final double  x,
final double  y 
)
static

Compare with error margin using isEqualHybrid.

Parameters
x
y
Returns
0 if equal, -1 if x<y, +1 if x>1

References wblut.math.WB_Epsilon.isEqualHybrid().

static int wblut.math.WB_Epsilon.compareRel ( final double  x,
final double  y 
)
static

Compare with error margin using isEqualRel.

Parameters
x
y
Returns
0 if equal, -1 if x<y, +1 if x>1

References wblut.math.WB_Epsilon.isEqualRel().

static boolean wblut.math.WB_Epsilon.isEqualAbs ( final double  x,
final double  y 
)
static

Equality with absolute error range.

Parameters
x
y
Returns
true, if equal

References wblut.math.WB_Epsilon.EPSILON, and wblut.math.WB_Math.fastAbs().

static boolean wblut.math.WB_Epsilon.isEqualAbs ( final double  x,
final double  y,
final double  threshold 
)
static
static boolean wblut.math.WB_Epsilon.isEqualHybrid ( final double  x,
final double  y 
)
static

Equality with error range. Absolute for small values, relative for large values

Parameters
x
y
Returns
true, if equal

References wblut.math.WB_Epsilon.EPSILON, wblut.math.WB_Math.fastAbs(), and wblut.math.WB_Math.max().

static boolean wblut.math.WB_Epsilon.isEqualRel ( final double  x,
final double  y 
)
static

Equality with relative error range.

Parameters
x
y
Returns
true, if equal

References wblut.math.WB_Epsilon.EPSILON, wblut.math.WB_Math.fastAbs(), and wblut.math.WB_Math.max().

static boolean wblut.math.WB_Epsilon.isZero ( final double  x)
static

Check if value is zero with error range.

Parameters
x
Returns
true, if zero

References wblut.math.WB_Epsilon.EPSILON, and wblut.math.WB_Math.fastAbs().

static boolean wblut.math.WB_Epsilon.isZeroSq ( final double  x)
static

Check if value is zero within squared error range.

Parameters
x
Returns
true, if zero

References wblut.math.WB_Math.fastAbs(), and wblut.math.WB_Epsilon.SQEPSILON.

Member Data Documentation

double wblut.math.WB_Epsilon.EPSILON = 1e-12
static

General precision.

double wblut.math.WB_Epsilon.EPSILONANGLE = 1e-5 * Math.PI / 180.0
static
double wblut.math.WB_Epsilon.SQEPSILON = EPSILON * EPSILON
static

General precision when square is used > EPSILON*EPSILON.


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