 libgpac Documentation of the core library of GPAC

Mathematics and Trigonometric. More... Collaboration diagram for Math:

## 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...

## Detailed Description

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

## ◆ FIX_ONE

 #define FIX_ONE

Fixed unit value

## ◆ INT2FIX

 #define INT2FIX ( v )

Conversion from integer to fixed

## ◆ FLT2FIX

 #define FLT2FIX ( v )

Conversion from float to fixed

## ◆ FIX2INT

 #define FIX2INT ( v )

Conversion from fixed to integer

## ◆ FIX2FLT

 #define FIX2FLT ( v )

Conversion from fixed to float

## ◆ FIX_EPSILON

 #define FIX_EPSILON

Epsilon Fixed (positive value closest to 0)

## ◆ FIX_MAX

 #define FIX_MAX

Maximum Fixed (maximum representable fixed value)

## ◆ FIX_MIN

 #define FIX_MIN

Minimum Fixed (minimum representable fixed value)

## ◆ GF_PI2

 #define GF_PI2

PI/2 expressed as Fixed

## ◆ GF_PI

 #define GF_PI

PI expressed as Fixed

## ◆ GF_2PI

 #define GF_2PI

2*PI expressed as Fixed

## ◆ gf_invfix

 #define gf_invfix ( _a )

1/_a, expressed as fixed number

## ◆ gf_mulfix

 #define gf_mulfix ( _a, _b )

_a*_b, expressed as fixed number

## ◆ gf_muldiv

 #define gf_muldiv ( _a, _b, _c )

_a*_b/_c, expressed as fixed number

## ◆ gf_divfix

 #define gf_divfix ( _a, _b )

_a/_b, expressed as fixed number

## ◆ gf_sqrt

 #define gf_sqrt ( _a )

sqrt(_a), expressed as fixed number

## ◆ gf_ceil

 #define gf_ceil ( _a )

ceil(_a), expressed as fixed number

## ◆ gf_floor

 #define gf_floor ( _a )

floor(_a), expressed as fixed number

## ◆ gf_cos

 #define gf_cos ( _a )

cos(_a), expressed as fixed number

## ◆ gf_sin

 #define gf_sin ( _a )

sin(_a), expressed as fixed number

## ◆ gf_tan

 #define gf_tan ( _a )

tan(_a), expressed as fixed number

## ◆ gf_atan2

 #define gf_atan2 ( _y, _x )

atan2(_y,_x), expressed as fixed number

## ◆ gf_acos

 #define gf_acos ( _a )

acos(_a), expressed as fixed number

## ◆ gf_asin

 #define gf_asin ( _a )

asin(_a), expressed as fixed number

## ◆ Fixed

 typedef Float Fixed

Fixed is 32bit float number

Note
This documentation has been generated for a float version of the GPAC framework.

## ◆ gf_angle_diff()

 Fixed gf_angle_diff ( Fixed a, Fixed b )

compute the difference between two angles, with a result in [-PI, PI]

Parameters
 a first angle b first angle
Returns
angle difference

## ◆ gf_get_bit_size()

 u32 gf_get_bit_size ( u32 MaxVal )

Gets the number of bits needed to represent the value.

Parameters
 MaxVal Maximum value to be represented.
Returns
number of bits required to represent the value.

## ◆ gf_get_next_pow2()

 u32 gf_get_next_pow2 ( u32 val )

Gets the closest power of 2 greater or equal to the value.

Parameters
 val value to be used.
Returns
requested power of 2.