]> git.mxchange.org Git - flightgear.git/blob - src/FDM/YASim/Thruster.cpp
-Removed .cvsignore from itself, since .cvsignore is now in the CVS
[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     int i;
9     for(i=0; i<3; i++) _pos[i] = _wind[i] = 0;
10     _throttle = 0;
11     _mixture = 0;
12     _pressure = _temp = _rho = 0;
13 }
14
15 Thruster::~Thruster()
16 {
17 }
18
19 void Thruster::getPosition(float* out)
20 {
21     int i;
22     for(i=0; i<3; i++) out[i] = _pos[i];
23 }
24
25 void Thruster::setPosition(float* pos)
26 {
27     int i;
28     for(i=0; i<3; i++) _pos[i] = pos[i];
29 }
30
31 void Thruster::getDirection(float* out)
32 {
33     int i;
34     for(i=0; i<3; i++) out[i] = _dir[i];
35 }
36
37 void Thruster::setDirection(float* dir)
38 {
39     Math::unit3(dir, _dir);
40 }
41
42 void Thruster::setThrottle(float throttle)
43 {
44     _throttle = Math::clamp(throttle, 0, 1);
45 }
46
47 void Thruster::setMixture(float mixture)
48 {
49     _mixture = Math::clamp(mixture, 0, 1);
50 }
51
52 void Thruster::setWind(float* wind)
53 {
54     int i;
55     for(i=0; i<3; i++) _wind[i] = wind[i];
56 }
57
58 void Thruster::setAir(float pressure, float temp)
59 {
60     _pressure = pressure;
61     _temp = temp;
62     _rho = _pressure / (287.1 * _temp);
63 }
64
65 }; // namespace yasim