forked from beltoforion/Galaxy-Renderer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CumulativeDistributionFunction.h
52 lines (36 loc) · 1.24 KB
/
CumulativeDistributionFunction.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef _CUMULATIVE_DISTRIBUTION_FUNCTION_H
#define _CUMULATIVE_DISTRIBUTION_FUNCTION_H
//-------------------------------------------------------------------------------------------------
#include <vector>
class CumulativeDistributionFunction
{
public:
typedef double (CumulativeDistributionFunction::*dist_fun_t)(double x);
CumulativeDistributionFunction();
virtual ~CumulativeDistributionFunction();
double ProbFromVal(double fVal);
double ValFromProb(double fVal);
void SetupRealistic(double I0, double k, double a, double RBulge, double min, double max, int nSteps);
private:
dist_fun_t m_pDistFun;
double m_fMin;
double m_fMax;
double m_fWidth;
int m_nSteps;
// parameters for realistic star distribution
double m_I0;
double m_k;
double m_a;
double m_RBulge;
std::vector<double> m_vM1;
std::vector<double> m_vY1;
std::vector<double> m_vX1;
std::vector<double> m_vM2;
std::vector<double> m_vY2;
std::vector<double> m_vX2;
void BuildCDF(int nSteps);
double IntensityBulge(double R, double I0, double k);
double IntensityDisc(double R, double I0, double a);
double Intensity(double x);
};
#endif // CUMULATIVEDISTRIBUTIONFUNCTION_H