]> git.mxchange.org Git - flightgear.git/blob - src/FDM/YASim/Thruster.cpp
Initial revision of Andy Ross's YASim code. This is (Y)et (A)nother Flight
[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     _propAdvance = 0;
12     _rho = 0;
13 }
14
15 Thruster::~Thruster()
16 {
17 }
18
19 void Thruster::getPosition(float* out)
20 {
21     for(int i=0; i<3; i++) out[i] = _pos[i];
22 }
23
24 void Thruster::setPosition(float* pos)
25 {
26     for(int i=0; i<3; i++) _pos[i] = pos[i];
27 }
28
29 void Thruster::getDirection(float* out)
30 {
31     for(int i=0; i<3; i++) out[i] = _dir[i];
32 }
33
34 void Thruster::setDirection(float* dir)
35 {
36     Math::unit3(dir, _dir);
37 }
38
39 void Thruster::setThrottle(float throttle)
40 {
41     _throttle = throttle;
42 }
43
44 void Thruster::setMixture(float mixture)
45 {
46     _mixture = mixture;
47 }
48
49 void Thruster::setPropAdvance(float propAdvance)
50 {
51     _propAdvance = propAdvance;
52 }
53
54 void Thruster::setWind(float* wind)
55 {
56     for(int i=0; i<3; i++) _wind[i] = wind[i];
57 }
58
59 void Thruster::setDensity(float rho)
60 {
61     _rho = rho;
62 }
63
64 void Thruster::cloneInto(Thruster* out)
65 {
66     for(int i=0; i<3; i++) {
67         out->_pos[i] = _pos[i];
68         out->_dir[i] = _dir[i];
69     }
70     out->_throttle = _throttle;
71     out->_mixture  = _mixture;
72     out->_propAdvance = _propAdvance;
73 }
74
75 }; // namespace yasim