]> git.mxchange.org Git - flightgear.git/blob - src/FDM/YASim/FGGround.cpp
MSVC (warning) fixes.
[flightgear.git] / src / FDM / YASim / FGGround.cpp
1 #include <FDM/flight.hxx>
2
3 #include "Glue.hpp"
4 #include "Ground.hpp"
5
6 #include "FGGround.hpp"
7 namespace yasim {
8
9 FGGround::FGGround(FGInterface *iface) : _iface(iface)
10 {
11     _toff = 0.0;
12 }
13
14 FGGround::~FGGround()
15 {
16 }
17
18 void FGGround::getGroundPlane(const double pos[3],
19                               double plane[4], float vel[3])
20 {
21     // Return values for the callback.
22     double loadCapacity, frictionFactor, agl;
23     double cp[3], dvel[3];
24     int type;
25     _iface->get_agl_m(_toff, pos, cp, plane, dvel,
26                       &type, &loadCapacity, &frictionFactor, &agl);
27
28     // The plane below the actual contact point.
29     plane[3] = plane[0]*cp[0] + plane[1]*cp[1] + plane[2]*cp[2];
30
31     for(int i=0; i<3; i++) vel[i] = dvel[i];
32 }
33
34 bool FGGround::caughtWire(const double pos[4][3])
35 {
36     return _iface->caught_wire_m(_toff, pos);
37 }
38
39 bool FGGround::getWire(double end[2][3], float vel[2][3])
40 {
41     double dvel[2][3];
42     bool ret = _iface->get_wire_ends_m(_toff, end, dvel);
43     for (int i=0; i<2; ++i)
44       for (int j=0; j<3; ++j)
45         vel[i][j] = dvel[i][j];
46     return ret;
47 }
48
49 void FGGround::releaseWire(void)
50 {
51     _iface->release_wire();
52 }
53
54 float FGGround::getCatapult(const double pos[3], double end[2][3],
55                             float vel[2][3])
56 {
57     double dvel[2][3];
58     float dist = _iface->get_cat_m(_toff, pos, end, dvel);
59     for (int i=0; i<2; ++i)
60       for (int j=0; j<3; ++j)
61         vel[i][j] = dvel[i][j];
62     return dist;
63 }
64
65 void FGGround::setTimeOffset(double toff)
66 {
67     _toff = toff;
68 }
69
70
71 }; // namespace yasim
72