libgpac
Documentation of the core library of GPAC
|
Mathematics and Trigonometric. More...
Modules | |
Math 2d | |
2D Mathematics | |
Math 3d | |
3D Mathematics | |
2D Vector Path | |
Vectorial 2D Path manipulation. | |
Macros | |
#define | FIX_ONE |
#define | INT2FIX(v) |
#define | FLT2FIX(v) |
#define | FIX2INT(v) |
#define | FIX2FLT(v) |
#define | FIX_EPSILON |
#define | FIX_MAX |
#define | FIX_MIN |
#define | GF_PI2 |
#define | GF_PI |
#define | GF_2PI |
#define | gf_invfix(_a) |
#define | gf_mulfix(_a, _b) |
#define | gf_muldiv(_a, _b, _c) |
#define | gf_divfix(_a, _b) |
#define | gf_sqrt(_a) |
#define | gf_ceil(_a) |
#define | gf_floor(_a) |
#define | gf_cos(_a) |
#define | gf_sin(_a) |
#define | gf_tan(_a) |
#define | gf_atan2(_y, _x) |
#define | gf_acos(_a) |
#define | gf_asin(_a) |
Typedefs | |
typedef Float | Fixed |
Functions | |
Fixed | gf_angle_diff (Fixed a, Fixed b) |
u32 | gf_get_bit_size (u32 MaxVal) |
Field bit-size. More... | |
u32 | gf_get_next_pow2 (u32 val) |
Get power of 2. More... | |
This section documents the math and trigo functions used in the GPAC framework. GPAC can be compiled with fixed-point support, representing float values on a 16.16 signed integer, which implies a developer must take care of float computations when using GPAC.
A developer should not need to know in which mode the framework has been compiled as long as he uses the math functions of GPAC which work in both float and fixed-point mode.
Using fixed-point version is decided at compilation time and cannot be changed. The feature is signaled through the GPAC_FIXED_POINT macro: when defined, GPAC has been compiled in fixed-point mode
#define FIX_ONE |
Fixed unit value
#define INT2FIX | ( | v | ) |
Conversion from integer to fixed
#define FLT2FIX | ( | v | ) |
Conversion from float to fixed
#define FIX2INT | ( | v | ) |
Conversion from fixed to integer
#define FIX2FLT | ( | v | ) |
Conversion from fixed to float
#define FIX_EPSILON |
Epsilon Fixed (positive value closest to 0)
#define FIX_MAX |
Maximum Fixed (maximum representable fixed value)
#define FIX_MIN |
Minimum Fixed (minimum representable fixed value)
#define GF_PI2 |
PI/2 expressed as Fixed
#define GF_PI |
PI expressed as Fixed
#define GF_2PI |
2*PI expressed as Fixed
#define gf_invfix | ( | _a | ) |
1/_a, expressed as fixed number
#define gf_mulfix | ( | _a, | |
_b | |||
) |
_a*_b, expressed as fixed number
#define gf_muldiv | ( | _a, | |
_b, | |||
_c | |||
) |
_a*_b/_c, expressed as fixed number
#define gf_divfix | ( | _a, | |
_b | |||
) |
_a/_b, expressed as fixed number
#define gf_sqrt | ( | _a | ) |
sqrt(_a), expressed as fixed number
#define gf_ceil | ( | _a | ) |
ceil(_a), expressed as fixed number
#define gf_floor | ( | _a | ) |
floor(_a), expressed as fixed number
#define gf_cos | ( | _a | ) |
cos(_a), expressed as fixed number
#define gf_sin | ( | _a | ) |
sin(_a), expressed as fixed number
#define gf_tan | ( | _a | ) |
tan(_a), expressed as fixed number
#define gf_atan2 | ( | _y, | |
_x | |||
) |
atan2(_y,_x), expressed as fixed number
#define gf_acos | ( | _a | ) |
acos(_a), expressed as fixed number
#define gf_asin | ( | _a | ) |
asin(_a), expressed as fixed number
Fixed is 32bit float number
compute the difference between two angles, with a result in [-PI, PI]
a | first angle |
b | first angle |
Gets the number of bits needed to represent the value.
MaxVal | Maximum value to be represented. |