Mathematical functions & constants.


Defines

#define  SI_DODECA_EPS   1.0e-12
#define  SI_FLOAT_MIN   FLT_MIN
#define  SI_FLOAT_MAX   FLT_MAX
#define  SI_TWO_PI   ( 2 * M_PI )
#define  SI_QUADRA_EPS   0.0001
#define  SI_PROJ_EPS1   0.0002
#define  SI_PROJ_EPS2   0.001
#define  SI_EPSILON   0.0001
#define  SI_PENTA_EPS   1.0e-05
#define  SI_HEXA_EPS   1.0e-6
#define  M_E   2.7182818284590452354
#define  M_LOG2E   1.4426950408889634074
#define  M_LOG10E   0.43429448190325182765
#define  M_LN2   0.69314718055994530942
#define  M_PI_4   0.78539816339744830962
#define  M_1_PI   0.31830988618379067154
#define  M_2_PI   0.63661977236758134308
#define  M_SQRT1_2   0.70710678118654752440
#define  M_LN10   2.30258509299404568402
#define  M_PI   3.14159265358979323846
#define  M_PI_2   1.57079632679489661923
#define  M_2_SQRTPI   1.12837916709551257390
#define  M_SQRT2   1.41421356237309504880
#define  MAXINT   INT_MAX
#define  _SI_LIMIT(x, a, b)   if (x < a) x = a; if (x > b) x = b;
#define  M_2PI   ( 2 * M_PI )
#define  M_Inv_PI   ( 1.0 / M_PI )
#define  M_Inv_2PI   ( 0.5 / M_PI )
#define  DEG_TO_RAD(deg)   ((deg)*M_PI/180.0)
#define  RAD_TO_DEG(rad)   ((rad)*180.0*M_Inv_PI)
#define  TRUE   1
#define  FALSE   0
#define  SI_TRUE   TRUE
#define  SI_FALSE   FALSE

Typedefs

typedef enum tagE3DAXISTYPE  E3DAxisType
typedef double  DOUBLE

Enumerations

enum   tagE3DAXISTYPE {
  X_AXIS = 0,
  Y_AXIS = 1,
  Z_AXIS = 2
}
enum   {
  NO_COORD_AXIS = 0x00,
  X_COORD_AXIS = 0x01,
  Y_COORD_AXIS = 0x02,
  Z_COORD_AXIS = 0x04,
  ALL_COORD_AXES = (X_COORD_AXIS | Y_COORD_AXIS | Z_COORD_AXIS)
}

Functions

float  angleDistance (double angle1, double angle2)
float  arcSinCos (double sinus, double cosinus)
float  InvertParamCubic (float Param, float x0, float x1, float x2, float x3)

Variables

const DOUBLE  PICO_EPS = 1.0e-12
const DOUBLE  NANO_EPS = 1.0e-09
const DOUBLE  HEXA_EPS = 1.0e-06
const DOUBLE  MILLI_EPS = 1.0e-03
const DOUBLE  SI_HUGE = DBL_MAX

Define Documentation

#define SI_DODECA_EPS   1.0e-12

Twelve-digit precision epsilon value. Used for floating-point comparisons.

#define SI_FLOAT_MIN   FLT_MIN

Minimum representable floating point value. (Taken from <float.h>)

#define SI_FLOAT_MAX   FLT_MAX

Maximum representable floating point value. (Taken from <float.h>)

#define SI_TWO_PI   ( 2 * M_PI )

The value of 2*pi.

#define SI_QUADRA_EPS   0.0001

Four-digit precision epsilon value. Used for floating-point comparisons.

#define SI_PROJ_EPS1   0.0002

Safe volume epsilon (outer sphere)

#define SI_PROJ_EPS2   0.001

Safe volume epsilon (inner sphere)

#define SI_EPSILON   0.0001

Floating point comparison value with zero. (Equivalent to SI_QUADRA_EPS).

#define SI_PENTA_EPS   1.0e-05

Five-digit precision epsilon value. Used for floating-pont comparisons.

#define SI_HEXA_EPS   1.0e-6

Six-digit precision epsilon value. Used for floating-pont comparisons.

#define M_E   2.7182818284590452354

Value of 'e'. 'e' is defined as lim(x->inf)[(1 + 1/x)^x].

#define M_LOG2E   1.4426950408889634074

The base 2 logarithm of 'e'.

#define M_LOG10E   0.43429448190325182765

The base 10 logarithm of 'e'.

#define M_LN2   0.69314718055994530942

The natural logarithm (ln) of 2.

#define M_PI_4   0.78539816339744830962

The value of 'pi'/4.

#define M_1_PI   0.31830988618379067154

The value of 1/'pi'.

#define M_2_PI   0.63661977236758134308

The value of 2/'pi'.

#define M_SQRT1_2   0.70710678118654752440

The square-root of 1/2.

#define M_LN10   2.30258509299404568402

The natural logarithm (ln) of 10.

#define M_PI   3.14159265358979323846

The value of 'pi'.

#define M_PI_2   1.57079632679489661923

The value of 'pi'/2.

#define M_2_SQRTPI   1.12837916709551257390

The value of 2/sqrt('pi').

#define M_SQRT2   1.41421356237309504880

The value of sqrt(2).

#define MAXINT   INT_MAX

The maximum representable integer.

#define _SI_LIMIT ( x,
a,
 )     if (x < a) x = a; if (x > b) x = b;

Limits a value to a specified range.

Parameters:
x  The value to limit.
a  The lower limit of the range.
b  The upper limit of the range.

#define M_2PI   ( 2 * M_PI )

The value of 2*'pi'

#define M_Inv_PI   ( 1.0 / M_PI )

The value of 1/'pi' (equivalent to M_1_PI).

#define M_Inv_2PI   ( 0.5 / M_PI )

The value of 1/(2*'pi').

#define DEG_TO_RAD ( deg   )     ((deg)*M_PI/180.0)

Converts an angle in degrees to a cooresponding angle in radians.

Parameters:
deg  The angle in degrees.
Returns:
The angle in radians.
See also:
RAD_TO_DEG

#define RAD_TO_DEG ( rad   )     ((rad)*180.0*M_Inv_PI)

Converts an angle in radians to a cooresponding angle in degrees.

Parameters:
rad  The angle in radians.
Returns:
The angle in degrees.
See also:
DEG_TO_RAD

#define TRUE   1

TRUE is defined as 1. Used in logical expressions.

#define FALSE   0

FALSE is defined as 0. Used in logical expressions.

#define SI_TRUE   TRUE

SI_TRUE is defined as TRUE. Used in logical expressions.

#define SI_FALSE   FALSE

SI_TRUE is defined as FALSE. Used in logical expressions.


Typedef Documentation

typedef enum tagE3DAXISTYPE E3DAxisType

Used to identify a given main axis.

typedef double DOUBLE

DOUBLE is an equivalent to double


Enumeration Type Documentation

enum tagE3DAXISTYPE

Used to identify a given main axis.

Enumerator:
X_AXIS  Main axis if the x-axis.
Y_AXIS  Main axis if the y-axis.
Z_AXIS  Main axis if the z-axis.

anonymous enum

Helper mask to pack which coordinates are valid, used, not used, etc.

Enumerator:
NO_COORD_AXIS  No coordinates.
X_COORD_AXIS  X-axis coordinates
Y_COORD_AXIS  Y-axis coordinates
Z_COORD_AXIS  Z-axis coordinates
ALL_COORD_AXES  All coordinates


Function Documentation

float angleDistance ( double  angle1,
double  angle2  
)

Returns difference between two angles (between 0 and 'pi')

Parameters:
angle1  The first angle (in radians).
angle2  The second angle (in radians).
Returns:
float The angle between the two angles (in radians).

float arcSinCos ( double  sinus,
double  cosinus  
)

Returns the angle based on the value of the sine and cosine values given (between -'pi' and 'pi).

Parameters:
sinus  The sine value of the angle.
cosinus  The cosine value of the angle.
Returns:
float The value of the angle (in radians).

float InvertParamCubic ( float  Param,
float  x0,
float  x1,
float  x2,
float  x3  
)

Returns the inverse of the 3rd-order Bernstein polynomial, at value Param.

Parameters:
Param  Value to at which the inverse is taken.
x0  0th order Berstein polynomial coefficient.
x1  1st order Berstein polynomial coefficient.
x2  2nd order Berstein polynomial coefficient.
x3  3rd order Berstein polynomial coefficient.
Returns:
float Inverse value of the Berstein polynomial at value Param.


Variable Documentation

const DOUBLE PICO_EPS = 1.0e-12

The value used to compare floating-point numbers within pico-units (1E-12).

const DOUBLE NANO_EPS = 1.0e-09

The value used to compare floating-point numbers within nano-units (1E-9).

const DOUBLE HEXA_EPS = 1.0e-06

The value used to compare floating-point numbers within micro-units (1E-6).

const DOUBLE MILLI_EPS = 1.0e-03

The value used to compare floating-point numbers within milli-units (1E-3).

const DOUBLE SI_HUGE = DBL_MAX

The maximum representable double precision floating-point number (taken from <float.h>).