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