]> git.mxchange.org Git - flightgear.git/blob - src/FDM/YASim/Thruster.cpp
Updated to YASim-0.1.1
[flightgear.git] / src / FDM / YASim / Thruster.cpp
1 #include "Math.hpp"
2 #include "Thruster.hpp"
3 namespace yasim {
4
5 Thruster::Thruster()
6 {
7     _dir[0] = 1; _dir[1] = 0; _dir[2] = 0;
8     for(int i=0; i<3; i++) _pos[i] = _wind[i] = 0;
9     _throttle = 0;
10     _mixture = 0;
11     _P = _T = _rho = 0;
12 }
13
14 Thruster::~Thruster()
15 {
16 }
17
18 void Thruster::getPosition(float* out)
19 {
20     for(int i=0; i<3; i++) out[i] = _pos[i];
21 }
22
23 void Thruster::setPosition(float* pos)
24 {
25     for(int i=0; i<3; i++) _pos[i] = pos[i];
26 }
27
28 void Thruster::getDirection(float* out)
29 {
30     for(int i=0; i<3; i++) out[i] = _dir[i];
31 }
32
33 void Thruster::setDirection(float* dir)
34 {
35     Math::unit3(dir, _dir);
36 }
37
38 void Thruster::setThrottle(float throttle)
39 {
40     _throttle = Math::clamp(throttle, 0, 1);
41 }
42
43 void Thruster::setMixture(float mixture)
44 {
45     _mixture = Math::clamp(mixture, 0, 1);
46 }
47
48 void Thruster::setWind(float* wind)
49 {
50     for(int i=0; i<3; i++) _wind[i] = wind[i];
51 }
52
53 void Thruster::setAir(float pressure, float temp)
54 {
55     _P = pressure;
56     _T = temp;
57     _rho = _P / (287.1 * _T);
58 }
59
60 }; // namespace yasim