arsa  2.7
Classes | Namespaces | Macros | Functions | Variables
irrMath.h File Reference
#include "IrrCompileConfig.h"
#include "irrTypes.h"
#include <math.h>
#include <float.h>
#include <stdlib.h>
#include <limits.h>

Go to the source code of this file.

Classes

union  irr::core::FloatIntUnion32
 
union  irr::core::inttofloat
 

Namespaces

 irr
 Everything in the Irrlicht Engine can be found in this namespace.
 
 irr::core
 Basic classes such as vectors, planes, arrays, lists, and so on can be found in this namespace.
 

Macros

#define FLT_MAX   3.402823466E+38F
 
#define FLT_MIN   1.17549435e-38F
 
#define F32_AS_S32(f)   (*((s32 *) &(f)))
 
#define F32_AS_U32(f)   (*((u32 *) &(f)))
 
#define F32_AS_U32_POINTER(f)   ( ((u32 *) &(f)))
 
#define F32_VALUE_0   0x00000000
 
#define F32_VALUE_1   0x3f800000
 
#define F32_SIGN_BIT   0x80000000U
 
#define F32_EXPON_MANTISSA   0x7FFFFFFFU
 
#define AIR(x)   (IR(x)&0x7fffffff)
 Absolute integer representation of a floating-point value. More...
 
#define IEEE_1_0   0x3f800000
 integer representation of 1.0 More...
 
#define IEEE_255_0   0x437f0000
 integer representation of 255.0 More...
 
#define F32_LOWER_0(n)   ((n) < 0.0f)
 
#define F32_LOWER_EQUAL_0(n)   ((n) <= 0.0f)
 
#define F32_GREATER_0(n)   ((n) > 0.0f)
 
#define F32_GREATER_EQUAL_0(n)   ((n) >= 0.0f)
 
#define F32_EQUAL_1(n)   ((n) == 1.0f)
 
#define F32_EQUAL_0(n)   ((n) == 0.0f)
 
#define F32_A_GREATER_B(a, b)   ((a) > (b))
 
#define REALINLINE   inline
 

Functions

f32 irr::core::radToDeg (f32 radians)
 Utility function to convert a radian value to degrees. More...
 
f64 irr::core::radToDeg (f64 radians)
 Utility function to convert a radian value to degrees. More...
 
f32 irr::core::degToRad (f32 degrees)
 Utility function to convert a degrees value to radians. More...
 
f64 irr::core::degToRad (f64 degrees)
 Utility function to convert a degrees value to radians. More...
 
template<class T >
const T & irr::core::min_ (const T &a, const T &b)
 returns minimum of two values. Own implementation to get rid of the STL (VS6 problems) More...
 
template<class T >
const T & irr::core::min_ (const T &a, const T &b, const T &c)
 returns minimum of three values. Own implementation to get rid of the STL (VS6 problems) More...
 
template<class T >
const T & irr::core::max_ (const T &a, const T &b)
 returns maximum of two values. Own implementation to get rid of the STL (VS6 problems) More...
 
template<class T >
const T & irr::core::max_ (const T &a, const T &b, const T &c)
 returns maximum of three values. Own implementation to get rid of the STL (VS6 problems) More...
 
template<class T >
irr::core::abs_ (const T &a)
 returns abs of two values. Own implementation to get rid of STL (VS6 problems) More...
 
template<class T >
irr::core::lerp (const T &a, const T &b, const f32 t)
 
template<class T >
constirr::core::clamp (const T &value, const T &low, const T &high)
 clamps a value between low and high More...
 
template<class T1 , class T2 >
void irr::core::swap (T1 &a, T2 &b)
 swaps the content of the passed parameters More...
 
template<class T >
irr::core::roundingError ()
 
template<>
f32 irr::core::roundingError ()
 
template<>
f64 irr::core::roundingError ()
 
template<>
s32 irr::core::roundingError ()
 
template<>
u32 irr::core::roundingError ()
 
template<>
s64 irr::core::roundingError ()
 
template<>
u64 irr::core::roundingError ()
 
template<class T >
irr::core::relativeErrorFactor ()
 
template<>
f32 irr::core::relativeErrorFactor ()
 
template<>
f64 irr::core::relativeErrorFactor ()
 
template<class T >
bool irr::core::equals (const T a, const T b, const T tolerance=roundingError< T >())
 returns if a equals b, taking possible rounding errors into account More...
 
template<class T >
bool irr::core::equalsRelative (const T a, const T b, const T factor=relativeErrorFactor< T >())
 
bool irr::core::equalsByUlp (f32 a, f32 b, int maxUlpDiff)
 We compare the difference in ULP's (spacing between floating-point numbers, aka ULP=1 means there exists no float between). More...
 
bool irr::core::iszero (const f64 a, const f64 tolerance=ROUNDING_ERROR_f64)
 returns if a equals zero, taking rounding errors into account More...
 
bool irr::core::iszero (const f32 a, const f32 tolerance=ROUNDING_ERROR_f32)
 returns if a equals zero, taking rounding errors into account More...
 
bool irr::core::isnotzero (const f32 a, const f32 tolerance=ROUNDING_ERROR_f32)
 returns if a equals not zero, taking rounding errors into account More...
 
bool irr::core::iszero (const s32 a, const s32 tolerance=0)
 returns if a equals zero, taking rounding errors into account More...
 
bool irr::core::iszero (const u32 a, const u32 tolerance=0)
 returns if a equals zero, taking rounding errors into account More...
 
bool irr::core::iszero (const s64 a, const s64 tolerance=0)
 returns if a equals zero, taking rounding errors into account More...
 
s32 irr::core::s32_min (s32 a, s32 b)
 
s32 irr::core::s32_max (s32 a, s32 b)
 
s32 irr::core::s32_clamp (s32 value, s32 low, s32 high)
 
u32 irr::core::IR (f32 x)
 
f32 irr::core::FR (u32 x)
 Floating-point representation of an integer value. More...
 
f32 irr::core::FR (s32 x)
 
REALINLINE u32 irr::core::if_c_a_else_b (const s32 condition, const u32 a, const u32 b)
 conditional set based on mask and arithmetic shift More...
 
REALINLINE u16 irr::core::if_c_a_else_b (const s16 condition, const u16 a, const u16 b)
 conditional set based on mask and arithmetic shift More...
 
REALINLINE u32 irr::core::if_c_a_else_0 (const s32 condition, const u32 a)
 conditional set based on mask and arithmetic shift More...
 
REALINLINE void irr::core::setbit_cond (u32 &state, s32 condition, u32 mask)
 
f32 irr::core::round_ (f32 x)
 
REALINLINE f32 irr::core::squareroot (const f32 f)
 
REALINLINE f64 irr::core::squareroot (const f64 f)
 
REALINLINE s32 irr::core::squareroot (const s32 f)
 
REALINLINE s64 irr::core::squareroot (const s64 f)
 
REALINLINE f64 irr::core::reciprocal_squareroot (const f64 x)
 
REALINLINE f32 irr::core::reciprocal_squareroot (const f32 f)
 
REALINLINE s32 irr::core::reciprocal_squareroot (const s32 x)
 
REALINLINE f32 irr::core::reciprocal (const f32 f)
 
REALINLINE f64 irr::core::reciprocal (const f64 f)
 
REALINLINE f32 irr::core::reciprocal_approxim (const f32 f)
 
REALINLINE s32 irr::core::floor32 (f32 x)
 
REALINLINE s32 irr::core::ceil32 (f32 x)
 
REALINLINE s32 irr::core::round32 (f32 x)
 
f32 irr::core::f32_max3 (const f32 a, const f32 b, const f32 c)
 
f32 irr::core::f32_min3 (const f32 a, const f32 b, const f32 c)
 
f32 irr::core::fract (f32 x)
 

Variables

const s32 irr::core::ROUNDING_ERROR_S32 = 0
 Rounding error constant often used when comparing f32 values. More...
 
const s64 irr::core::ROUNDING_ERROR_S64 = 0
 
const f32 irr::core::ROUNDING_ERROR_f32 = 0.000001f
 
const f64 irr::core::ROUNDING_ERROR_f64 = 0.00000001
 
const f32 irr::core::PI = 3.14159265359f
 Constant for PI. More...
 
const f32 irr::core::RECIPROCAL_PI = 1.0f/PI
 Constant for reciprocal of PI. More...
 
const f32 irr::core::HALF_PI = PI/2.0f
 Constant for half of PI. More...
 
const f64 irr::core::PI64 = 3.1415926535897932384626433832795028841971693993751
 Constant for 64bit PI. More...
 
const f64 irr::core::RECIPROCAL_PI64 = 1.0/PI64
 Constant for 64bit reciprocal of PI. More...
 
const f32 irr::core::DEGTORAD = PI / 180.0f
 32bit Constant for converting from degrees to radians More...
 
const f32 irr::core::RADTODEG = 180.0f / PI
 32bit constant for converting from radians to degrees (formally known as GRAD_PI) More...
 
const f64 irr::core::DEGTORAD64 = PI64 / 180.0
 64bit constant for converting from degrees to radians (formally known as GRAD_PI2) More...
 
const f64 irr::core::RADTODEG64 = 180.0 / PI64
 64bit constant for converting from radians to degrees More...
 

Macro Definition Documentation

◆ AIR

#define AIR (   x)    (IR(x)&0x7fffffff)

Absolute integer representation of a floating-point value.

Definition at line 394 of file irrMath.h.

◆ F32_A_GREATER_B

#define F32_A_GREATER_B (   a,
  b 
)    ((a) > (b))

Definition at line 428 of file irrMath.h.

◆ F32_AS_S32

#define F32_AS_S32 (   f)    (*((s32 *) &(f)))

Definition at line 376 of file irrMath.h.

◆ F32_AS_U32

#define F32_AS_U32 (   f)    (*((u32 *) &(f)))

Definition at line 377 of file irrMath.h.

◆ F32_AS_U32_POINTER

#define F32_AS_U32_POINTER (   f)    ( ((u32 *) &(f)))

Definition at line 378 of file irrMath.h.

◆ F32_EQUAL_0

#define F32_EQUAL_0 (   n)    ((n) == 0.0f)

Definition at line 427 of file irrMath.h.

◆ F32_EQUAL_1

#define F32_EQUAL_1 (   n)    ((n) == 1.0f)

Definition at line 426 of file irrMath.h.

◆ F32_EXPON_MANTISSA

#define F32_EXPON_MANTISSA   0x7FFFFFFFU

Definition at line 383 of file irrMath.h.

◆ F32_GREATER_0

#define F32_GREATER_0 (   n)    ((n) > 0.0f)

Definition at line 424 of file irrMath.h.

◆ F32_GREATER_EQUAL_0

#define F32_GREATER_EQUAL_0 (   n)    ((n) >= 0.0f)

Definition at line 425 of file irrMath.h.

◆ F32_LOWER_0

#define F32_LOWER_0 (   n)    ((n) < 0.0f)

Definition at line 422 of file irrMath.h.

◆ F32_LOWER_EQUAL_0

#define F32_LOWER_EQUAL_0 (   n)    ((n) <= 0.0f)

Definition at line 423 of file irrMath.h.

◆ F32_SIGN_BIT

#define F32_SIGN_BIT   0x80000000U

Definition at line 382 of file irrMath.h.

◆ F32_VALUE_0

#define F32_VALUE_0   0x00000000

Definition at line 380 of file irrMath.h.

◆ F32_VALUE_1

#define F32_VALUE_1   0x3f800000

Definition at line 381 of file irrMath.h.

◆ FLT_MAX

#define FLT_MAX   3.402823466E+38F

Definition at line 31 of file irrMath.h.

◆ FLT_MIN

#define FLT_MIN   1.17549435e-38F

Definition at line 35 of file irrMath.h.

◆ IEEE_1_0

#define IEEE_1_0   0x3f800000

integer representation of 1.0

Definition at line 405 of file irrMath.h.

◆ IEEE_255_0

#define IEEE_255_0   0x437f0000

integer representation of 255.0

Definition at line 407 of file irrMath.h.

◆ REALINLINE

#define REALINLINE   inline

Definition at line 436 of file irrMath.h.