Loading...
Searching...
No Matches
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

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

## Macros

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

## Functions

template<class T>
T | irr::core::abs_ (const T &a)
| returns abs of two values. Own implementation to get rid of STL (VS6 problems)
REALINLINE s32 | irr::core::ceil32 (f32 x)
template<class T>
const T | irr::core::clamp (const T &value, const T &low, const T &high)
| clamps a value between low and high
REALINLINE void | irr::core::clearFPUException ()
f32 | irr::core::degToRad (f32 degrees)
| Utility function to convert a degrees value to radians.
f64 | irr::core::degToRad (f64 degrees)
| Utility function to convert a degrees value to radians.
bool | irr::core::equals (const f32 a, const f32 b, const f32 tolerance=ROUNDING_ERROR_f32)
| returns if a equals b, taking possible rounding errors into account
bool | irr::core::equals (const f64 a, const f64 b, const f64 tolerance=ROUNDING_ERROR_f64)
| returns if a equals b, taking possible rounding errors into account
bool | irr::core::equals (const s32 a, const s32 b, const s32 tolerance=ROUNDING_ERROR_S32)
| returns if a equals b, taking an explicit rounding tolerance into account
bool | irr::core::equals (const s64 a, const s64 b, const s64 tolerance=ROUNDING_ERROR_S64)
| returns if a equals b, taking an explicit rounding tolerance into account
bool | irr::core::equals (const u32 a, const u32 b, const s32 tolerance=ROUNDING_ERROR_S32)
| returns if a equals b, taking an explicit rounding tolerance into account
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).
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)
REALINLINE s32 | irr::core::floor32 (f32 x)
f32 | FR (u32 x)
| Floating-point representation of an integer value.
f32 | irr::core::FR (s32 x)
f32 | irr::core::FR (u32 x)
| Floating-point representation of an integer value.
f32 | irr::core::fract (f32 x)
REALINLINE u32 | irr::core::if_c_a_else_0 (const s32 condition, const u32 a)
| conditional set based on mask and arithmetic shift
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
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
u32 | IR (f32 x)
u32 | irr::core::IR (f32 x)
bool | irr::core::isnotzero (const f32 a, const f32 tolerance=ROUNDING_ERROR_f32)
| returns if a equals not zero, taking rounding errors into account
bool | irr::core::iszero (const f32 a, const f32 tolerance=ROUNDING_ERROR_f32)
| returns if a equals zero, taking rounding errors into account
bool | irr::core::iszero (const f64 a, const f64 tolerance=ROUNDING_ERROR_f64)
| returns if a equals zero, taking rounding errors into account
bool | irr::core::iszero (const s32 a, const s32 tolerance=0)
| returns if a equals zero, taking rounding errors into account
bool | irr::core::iszero (const s64 a, const s64 tolerance=0)
| returns if a equals zero, taking rounding errors into account
bool | irr::core::iszero (const u32 a, const u32 tolerance=0)
| returns if a equals zero, taking rounding errors into account
template<class T>
T | irr::core::lerp (const T &a, const T &b, const f32 t)
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)
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)
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)
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)
f32 | irr::core::radToDeg (f32 radians)
| Utility function to convert a radian value to degrees.
f64 | irr::core::radToDeg (f64 radians)
| Utility function to convert a radian value to degrees.
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 f32 | irr::core::reciprocal_squareroot (const f32 f)
REALINLINE f64 | irr::core::reciprocal_squareroot (const f64 x)
REALINLINE s32 | irr::core::reciprocal_squareroot (const s32 x)
REALINLINE s32 | irr::core::round32 (f32 x)
f32 | irr::core::round_ (f32 x)
s32 | irr::core::s32_clamp (s32 value, s32 low, s32 high)
s32 | irr::core::s32_max (s32 a, s32 b)
s32 | irr::core::s32_min (s32 a, s32 b)
REALINLINE void | irr::core::setbit_cond (u32 &state, s32 condition, u32 mask)
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)
template<class T1, class T2>
void | irr::core::swap (T1 &a, T2 &b)
| swaps the content of the passed parameters

## Variables

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

## Macro Definition Documentation

## AIR

#define AIR | ( |  | x | ) |

Value:
(IR(x)&0x7fffffff)
IR
u32 IR(f32 x)
Definition irrMath.h:353

Absolute integer representation of a floating-point value.

Definition at line 357 of file irrMath.h.

## F32_A_GREATER_B

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

Value:
((a) > (b))

Definition at line 391 of file irrMath.h.

## F32_AS_S32

#define F32_AS_S32 | ( |  | f | ) |

Value:
(*((s32 *) &(f)))

Definition at line 339 of file irrMath.h.

## F32_AS_U32

#define F32_AS_U32 | ( |  | f | ) |

Value:
(*((u32 *) &(f)))

Definition at line 340 of file irrMath.h.

## F32_AS_U32_POINTER

#define F32_AS_U32_POINTER | ( |  | f | ) |

Value:
( ((u32 *) &(f)))

Definition at line 341 of file irrMath.h.

## F32_EQUAL_0

#define F32_EQUAL_0 | ( |  | n | ) |

Value:
((n) == 0.0f)

Definition at line 390 of file irrMath.h.

## F32_EQUAL_1

#define F32_EQUAL_1 | ( |  | n | ) |

Value:
((n) == 1.0f)

Definition at line 389 of file irrMath.h.

## F32_EXPON_MANTISSA

#define F32_EXPON_MANTISSA 0x7FFFFFFFU

Definition at line 346 of file irrMath.h.

## F32_GREATER_0

#define F32_GREATER_0 | ( |  | n | ) |

Value:
((n) > 0.0f)

Definition at line 387 of file irrMath.h.

## F32_GREATER_EQUAL_0

#define F32_GREATER_EQUAL_0 | ( |  | n | ) |

Value:
((n) >= 0.0f)

Definition at line 388 of file irrMath.h.

## F32_LOWER_0

#define F32_LOWER_0 | ( |  | n | ) |

Value:
((n) < 0.0f)

Definition at line 385 of file irrMath.h.

## F32_LOWER_EQUAL_0

#define F32_LOWER_EQUAL_0 | ( |  | n | ) |

Value:
((n) <= 0.0f)

Definition at line 386 of file irrMath.h.

Referenced by irr::core::plane3d< f32 >::isFrontFacing(), and irr::core::triangle3d< f32 >::isFrontFacing().

## F32_SIGN_BIT

#define F32_SIGN_BIT 0x80000000U

Definition at line 345 of file irrMath.h.

## F32_VALUE_0

#define F32_VALUE_0 0x00000000

Definition at line 343 of file irrMath.h.

## F32_VALUE_1

#define F32_VALUE_1 0x3f800000

Definition at line 344 of file irrMath.h.

Referenced by irr::core::CMatrix4< T >::isIdentity_integer_base().

## FLT_MAX

#define FLT_MAX 3.402823466E+38F

Definition at line 31 of file irrMath.h.

Referenced by irr::core::strtof10().

## FLT_MIN

#define FLT_MIN 1.17549435e-38F

Definition at line 35 of file irrMath.h.

Referenced by irr::core::CMatrix4< T >::getInverse().

## IEEE_1_0

#define IEEE_1_0 0x3f800000

integer representation of 1.0

Definition at line 368 of file irrMath.h.

## IEEE_255_0

#define IEEE_255_0 0x437f0000

integer representation of 255.0

Definition at line 370 of file irrMath.h.

## REALINLINE

#define REALINLINE inline

Definition at line 399 of file irrMath.h.

Referenced by irr::core::ceil32(), irr::core::clearFPUException(), irr::core::floor32(), irr::core::if_c_a_else_0(), irr::core::if_c_a_else_b(), irr::core::if_c_a_else_b(), irr::core::reciprocal(), irr::core::reciprocal(), irr::core::reciprocal_approxim(), irr::core::reciprocal_squareroot(), irr::core::reciprocal_squareroot(), irr::core::reciprocal_squareroot(), irr::core::round32(), irr::core::setbit_cond(), irr::core::squareroot(), irr::core::squareroot(), irr::core::squareroot(), and irr::core::squareroot().

## Function Documentation

## FR()

f32 irr::core::FR | ( | u32 | x | ) |

inline

Floating-point representation of an integer value.

Definition at line 363 of file irrMath.h.

Referenced by irr::video::pack_textureBlendFunc().

## IR()

u32 irr::core::IR | ( | f32 | x | ) |

inline

code is taken from IceFPU Integer representation of a floating-point value.

Definition at line 353 of file irrMath.h.

Referenced by irr::video::unpack_textureBlendFunc().

- Irrlicht Engine Documentation © 2003-2012 by Nikolaus Gebhardt. Generated on for Irrlicht 3D Engine by Doxygen 1.15.0