~ubuntu-branches/ubuntu/quantal/flightgear/quantal

« back to all changes in this revision

Viewing changes to src/FDM/YASim/Thruster.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Ove Kaaven
  • Date: 2002-03-27 21:50:15 UTC
  • Revision ID: james.westby@ubuntu.com-20020327215015-0rvi3o8iml0a8s93
Tags: upstream-0.7.9
ImportĀ upstreamĀ versionĀ 0.7.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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