00001 #ifndef CHEMOTAXIS_UTIL_HH_
00002 #define CHEMOTAXIS_UTIL_HH_
00003
00004 #include <math.h>
00005 #include "../../../NFutil/NFutil.hh"
00006
00007
00008
00009
00010 using namespace NFutil;
00011
00012
00017 namespace ChemotaxisUtil {
00018
00019
00036 class GammaSampler {
00037
00038 public:
00044 GammaSampler(double alpha, double beta);
00045
00052 GammaSampler(double alpha, double beta, double meanShift);
00053
00054
00059 double gen();
00060
00069 double gen(double minAcceptableValue, double maxAcceptableValue);
00070
00071 protected:
00072 double alpha;
00073 double oalpha;
00074 double beta;
00075 double a1;
00076 double a2;
00077 double meanShift;
00078
00079 private:
00080 void init(double alpha, double beta, double meanShift);
00081 };
00082
00083
00084
00085
00086
00087 void genUniformRandRotation3d(double rotMatrix[3][3]);
00088 void genRot3dAboutAxis(double rotMatrix[3][3], double axis[3], double angleInRad);
00089 void genRotFromAngles(double rotMatrix[3][3], double angleX, double angleY, double angleZ);
00090
00091 void applyRotation(double rotMatrix[3][3], double vec[3]);
00092 void applyDisplacement(double pos[3], double dir[3], double distance);
00093
00094
00095 }
00096
00097 #endif