#include <PVLE/Util/Assert.h>
#include <boost/math/special_functions/fpclassify.hpp>


Go to the source code of this file.
Defines | |
| #define | computePolynom1 computePolynom1T<float> |
| #define | computePolynom1f computePolynom1T<float> |
| #define | computePolynom1d computePolynom1T<double> |
| #define | get_y_polynom1 get_y_polynom1T<float> |
| #define | get_y_polynom1f get_y_polynom1T<float> |
| #define | get_y_polynom1d get_y_polynom1T<double> |
| #define | computePolynom1_surface computePolynom1_surfaceT<float> |
| #define | computePolynom1_surfacef computePolynom1_surfaceT<float> |
| #define | computePolynom1_surfaced computePolynom1_surfaceT<double> |
| #define | computePolynom2 computePolynom2T<float> |
| #define | computePolynom2f computePolynom2T<float> |
| #define | computePolynom2d computePolynom2T<double> |
| #define | get_y_polynom2 get_y_polynom2T<float> |
| #define | get_y_polynom2f get_y_polynom2T<float> |
| #define | get_y_polynom2d get_y_polynom2T<double> |
Functions | |
| bool | equivalent (const float &a, const float &b, const float &error=1e-6f) |
Renvoie true si les deux flottants a et b sont égaux, à une marge d'erreur près. | |
| bool | equivalent (const double &a, const double &b, const double &error=1e-14) |
Renvoie true si les deux flottants double précision a et b sont égaux, à une marge d'erreur près. | |
| int | round (const float &v) |
| Arrondi simple d'un flottant en entier, au plus proche (12.754841 => 13). | |
| int | round (const double &v) |
| Arrondi simple d'un flottant double en entier, au plus proche (12.754841 => 13). | |
| template<typename T > | |
| T | round (const T &v, int nb_chiffres_significatifs) |
| Arrondit au plus proche un nombre en gardant un nombre donné de chiffres significatifs (12703 => 13000 pour 2 chiffres significatifs). Fonctionne pour n'importe quel réel (2.35 => 2.4 ; 0.0221 => 0.022 ; etc.). | |
| template<typename T > | |
| T | round_inf (const T &v, int nb_chiffres_significatifs) |
| Comme arrondi(), mais effectue un arrondi par défaut (12703 => 12000). | |
| template<typename T > | |
| T | round_sup (const T &v, int nb_chiffres_significatifs) |
| Comme arrondi(), mais effectue un arrondi par excès (12103 => 13000). | |
| template<typename T > | |
| T | sigmoid (const T &x) |
Fonction sigmoïde : 1/(1+e(-x)). | |
| template<class T > | |
| T | clamp_copy (const T &val, const T &min, const T &max) |
| Tronque (clamp) une valeur entre deux bornes et en renvoie une copie. | |
| template<class T > | |
| void | clamp (T &val, const T &min, const T &max) |
| Comme clamp_copy(), mais agit directement sur la valeur passée en paramètre. | |
| template<class T > | |
| void | clampl (T &val, const T &min) |
| Clamp "lower" : tronque si la valeur est inférieure à la borne minimale. | |
| template<class T > | |
| void | clampu (T &val, const T &max) |
| Clamp "upper" : tronque si la valeur est supérieure à la borne maximale. | |
| template<class T > | |
| T | _min (T a, T b) |
| Definition of max() that has no problem across platforms... | |
| template<class T > | |
| T | _max (T a, T b) |
| Definition of min() that has no problem across platforms... | |
| unsigned int | log2 (unsigned int val) |
| Mathematical log2 (gives the power of 2 that gives the number - Ex: 2^3=8 => log2(8)=3). | |
| unsigned long | log2 (unsigned long val) |
| template<class T > | |
| void | computePolynom1T (T ax, T ay, T bx, T by, T &out_a, T &out_b) |
| Détermine les coefficients d'un polynôme de degré 1 (= une droite du plan) passant par 2 points donnés. | |
| template<class T > | |
| T | get_y_polynom1T (T ax, T ay, T bx, T by, T x) |
| Donne l'ordonnée d'un point appartenant à une droite du plan dont on connaît deux points. | |
| template<class T > | |
| static void | computePolynom1_surfaceT (T A, T x1, T x2, T y2, T &out_a, T &out_b) |
Calcule les coefficients d'une droite dont on connait :
| |
| template<class T > | |
| void | computePolynom2T (T ax, T ay, T bx, T by, T cx, T cy, T &out_a, T &out_b, T &out_c) |
| Détermine les coefficients d'un polynôme de degré 2 (= une parabole du plan) passant par 3 points donnés. | |
| template<class T > | |
| T | get_y_polynom2T (T ax, T ay, T bx, T by, T cx, T cy, T x) |
| Donne l'ordonnée d'un point appartenant à une parabole du plan dont on connaît trois points. | |
| template<class T > | |
| T | applique_mult (T val, T mult) |
| Applique un multiplicateur pour un coefficient dont la valeur neutre est 1 ((val-1)*mult+1). | |
| template<class T > | |
| T | applique_mult (T val, T mult, T centre) |
| Applique un multiplicateur pour un coefficient dont la valeur neutre est donnée ((val-centre)*mult+centre). | |
| double | math_fmod (double a, double b) |
| Mathematical modulus (result is >=0). | |
| float | math_fmod (float a, float b) |
| Mathematical modulus (result is >=0). | |
| float | math_fmodf (float a, float b) |
| Mathematical modulus (result is >=0). | |
| int | math_mod (int a, int b) |
| Mathematical modulus (result is >=0). | |
| unsigned int | math_mod (unsigned int a, unsigned int b) |
| Mathematical modulus (result is >=0). | |
.. sorry ! But they're obvious)
Definition in file Math.h.
| #define computePolynom1_surface computePolynom1_surfaceT<float> |
| #define computePolynom1_surfaced computePolynom1_surfaceT<double> |
| #define computePolynom1_surfacef computePolynom1_surfaceT<float> |
| T _max | ( | T | a, | |
| T | b | |||
| ) | [inline] |
| T _min | ( | T | a, | |
| T | b | |||
| ) | [inline] |
| T applique_mult | ( | T | val, | |
| T | mult, | |||
| T | centre | |||
| ) | [inline] |
| T applique_mult | ( | T | val, | |
| T | mult | |||
| ) | [inline] |
| void clamp | ( | T & | val, | |
| const T & | min, | |||
| const T & | max | |||
| ) | [inline] |
Comme clamp_copy(), mais agit directement sur la valeur passée en paramètre.
Definition at line 99 of file Math.h.
Referenced by createHeightColorization(), Explosion::hitBefore(), and Explosion::step().
| T clamp_copy | ( | const T & | val, | |
| const T & | min, | |||
| const T & | max | |||
| ) | [inline] |
Tronque (clamp) une valeur entre deux bornes et en renvoie une copie.
Exemple : -8 entre 0 et 100 renverra 0.
Definition at line 95 of file Math.h.
Referenced by spotLightProcessing().
| void clampl | ( | T & | val, | |
| const T & | min | |||
| ) | [inline] |
Clamp "lower" : tronque si la valeur est inférieure à la borne minimale.
Definition at line 102 of file Math.h.
Referenced by create1DTextureHeightColorization(), and CartographyColorizator::valsFromHF().
| void clampu | ( | T & | val, | |
| const T & | max | |||
| ) | [inline] |
Clamp "upper" : tronque si la valeur est supérieure à la borne maximale.
Definition at line 105 of file Math.h.
Referenced by create1DTextureHeightColorization(), LightSourceManager::request(), and CartographyColorizator::valsFromHF().
| static void computePolynom1_surfaceT | ( | T | A, | |
| T | x1, | |||
| T | x2, | |||
| T | y2, | |||
| T & | out_a, | |||
| T & | out_b | |||
| ) | [inline, static] |
| void computePolynom1T | ( | T | ax, | |
| T | ay, | |||
| T | bx, | |||
| T | by, | |||
| T & | out_a, | |||
| T & | out_b | |||
| ) | [inline] |
| void computePolynom2T | ( | T | ax, | |
| T | ay, | |||
| T | bx, | |||
| T | by, | |||
| T | cx, | |||
| T | cy, | |||
| T & | out_a, | |||
| T & | out_b, | |||
| T & | out_c | |||
| ) | [inline] |
| bool equivalent | ( | const double & | a, | |
| const double & | b, | |||
| const double & | error = 1e-14 | |||
| ) | [inline] |
| bool equivalent | ( | const float & | a, | |
| const float & | b, | |||
| const float & | error = 1e-6f | |||
| ) | [inline] |
Renvoie true si les deux flottants a et b sont égaux, à une marge d'erreur près.
Definition at line 37 of file Math.h.
Referenced by Physics::NearCallback::operator()().
| T get_y_polynom1T | ( | T | ax, | |
| T | ay, | |||
| T | bx, | |||
| T | by, | |||
| T | x | |||
| ) | [inline] |
Donne l'ordonnée d'un point appartenant à une droite du plan dont on connaît deux points.
Pour plusieurs points sur la même droite, mieux vaut utiliser computePolynom1T<>() pour éviter des calculs inutiles.
Definition at line 146 of file Math.h.
References ASSERT.
| T get_y_polynom2T | ( | T | ax, | |
| T | ay, | |||
| T | bx, | |||
| T | by, | |||
| T | cx, | |||
| T | cy, | |||
| T | x | |||
| ) | [inline] |
Donne l'ordonnée d'un point appartenant à une parabole du plan dont on connaît trois points.
Pour plusieurs points sur la même parabole, mieux vaut utiliser computePolynom2T<>() pour éviter des calculs inutiles.
| unsigned int log2 | ( | unsigned int | val | ) | [inline] |
| float math_fmod | ( | float | a, | |
| float | b | |||
| ) | [inline] |
| double math_fmod | ( | double | a, | |
| double | b | |||
| ) | [inline] |
| float math_fmodf | ( | float | a, | |
| float | b | |||
| ) | [inline] |
Mathematical modulus (result is >=0).
Definition at line 228 of file Math.h.
Referenced by CameraShake::updateCameras().
| unsigned int math_mod | ( | unsigned int | a, | |
| unsigned int | b | |||
| ) | [inline] |
| int math_mod | ( | int | a, | |
| int | b | |||
| ) | [inline] |
| T round | ( | const T & | v, | |
| int | nb_chiffres_significatifs | |||
| ) | [inline] |
| int round | ( | const double & | v | ) | [inline] |
| int round | ( | const float & | v | ) | [inline] |
| T round_inf | ( | const T & | v, | |
| int | nb_chiffres_significatifs | |||
| ) | [inline] |
| T round_sup | ( | const T & | v, | |
| int | nb_chiffres_significatifs | |||
| ) | [inline] |
| T sigmoid | ( | const T & | x | ) | [inline] |
1.5.9