#include <math.h>
#include "simpletypes.h"
#include <stdlib.h>
Go to the source code of this file.
|
#define | M_PI 3.14159265359 |
|
#define | M_1_PI (1/M_PI) |
|
#define | M_E 2.718281828 |
|
#define | M_SQRT2PI 2.5066283 |
|
#define | frand(max) (((float)rand())*(max)/RAND_MAX) |
|
#define | FRAND1 (((float)rand())/RAND_MAX) |
|
|
int | absint (int v) |
|
template<class T > |
bool | clamp (T &x, T &y, const T x0, const T y0, const T x1, const T y1) |
|
float | fgauss01 () |
|
float | gauss (float x, float stdev) |
|
float | gauss2 (float x2, float stdev) |
|
double | gaussd (float x, double stdev) |
|
float | gaussd2 (float x2, double stdev) |
|
float | mapAngle360 (float a) |
|
float | mapAngle360 (float a, float mina) |
|
float | mapAngle180 (float a) |
|
float | mapAngle2PI (float a) |
|
float | mapAngle2PI (float a, float mina) |
|
float | mapAnglePI (float a) |
|
float | mapAnglePI (float a, float cnta) |
|
dword | power2 (dword x) |
|
#define frand |
( |
|
max | ) |
(((float)rand())*(max)/RAND_MAX) |
#define FRAND1 (((float)rand())/RAND_MAX) |
#define M_PI 3.14159265359 |
Definition at line 9 of file mathutil.h.
Referenced by Point2D::angle(), VVector< float, 4 >::angle(), Searcher::buildClusters(), ExpectationMap::correctLBUB(), Brain::distributeModel(), SubStructure::getLBUB(), main(), mapAngle2PI(), mapAnglePI(), Searcher::mutate(), MStructure::rebuildExpMap(), Brain::setupSearch(), and Brain::triggerTest().
#define M_SQRT2PI 2.5066283 |
template<class T >
bool clamp |
( |
T & |
x, |
|
|
T & |
y, |
|
|
const T |
x0, |
|
|
const T |
y0, |
|
|
const T |
x1, |
|
|
const T |
y1 |
|
) |
| |
Definition at line 24 of file mathutil.h.
Referenced by Point2D::clamp().
27 if(x<x0) { ret =
true; x = x0;}
28 if(x>x1) { ret =
true; x = x1;}
29 if(y<y0) { ret =
true; y = y0;}
30 if(y>y1) { ret =
true; y = y1;}
float gauss |
( |
float |
x, |
|
|
float |
stdev |
|
) |
| |
|
inline |
Definition at line 68 of file mathutil.h.
References M_SQRT2PI.
DMatrix< T > stdev(const DMatrix< T > &mat)
float gauss2 |
( |
float |
x2, |
|
|
float |
stdev |
|
) |
| |
|
inline |
double gaussd |
( |
float |
x, |
|
|
double |
stdev |
|
) |
| |
|
inline |
Definition at line 74 of file mathutil.h.
References M_SQRT2PI.
DMatrix< T > stdev(const DMatrix< T > &mat)
float gaussd2 |
( |
float |
x2, |
|
|
double |
stdev |
|
) |
| |
|
inline |
float mapAngle180 |
( |
float |
a | ) |
|
|
inline |
float mapAngle2PI |
( |
float |
a | ) |
|
|
inline |
float mapAngle2PI |
( |
float |
a, |
|
|
float |
mina |
|
) |
| |
|
inline |
float mapAngle360 |
( |
float |
a | ) |
|
|
inline |
Definition at line 81 of file mathutil.h.
Referenced by mapAngle180().
82 int d=(int)a/360 - (
int)(a<0);
83 return a-360*(float)d;
float mapAngle360 |
( |
float |
a, |
|
|
float |
mina |
|
) |
| |
|
inline |
Definition at line 86 of file mathutil.h.
87 float ashift = a-mina;
88 int d=(int)ashift/360 - (
int)(ashift<0);
89 return a-360*(float)d;
float mapAnglePI |
( |
float |
a | ) |
|
|
inline |
float mapAnglePI |
( |
float |
a, |
|
|
float |
cnta |
|
) |
| |
|
inline |