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