]> git.mxchange.org Git - flightgear.git/blob - src/FDM/Slew/slew.cxx
source tree reorganization prior to flightgear 0.7
[flightgear.git] / src / FDM / Slew / slew.cxx
1 // slew.cxx -- the "slew" flight model
2 //
3 // Written by Curtis Olson, started May 1997.
4 //
5 // Copyright (C) 1997  Curtis L. Olson  - curt@infoplane.com
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 //
21 // $Id$
22
23
24 #include <math.h>
25
26 #include "slew.hxx"
27
28 #include <FDM/flight.hxx>
29 #include <Aircraft/aircraft.hxx>
30 #include <Controls/controls.hxx>
31 #include <Include/fg_constants.h>
32
33
34 // reset flight params to a specific position
35 void fgSlewInit(double pos_x, double pos_y, double pos_z, double heading) {
36     FGInterface *f;
37     
38     f = current_aircraft.fdm_state;
39
40     /*
41     f->pos_x = pos_x;
42     f->pos_y = pos_y;
43     f->pos_z = pos_z;
44
45     f->vel_x = 0.0;
46     f->vel_y = 0.0;
47     f->vel_z = 0.0;
48
49     f->Phi = 0.0;
50     f->Theta = 0.0;
51     f->Psi = 0.0;
52
53     f->vel_Phi = 0.0;
54     f->vel_Theta = 0.0;
55     f->vel_Psi = 0.0;
56
57     f->Psi = heading;
58     */
59 }
60
61
62 // update position based on inputs, positions, velocities, etc.
63 void fgSlewUpdate( void ) {
64     FGInterface *f;
65     FGControls *c;
66
67     f = current_aircraft.fdm_state;
68     c = current_aircraft.controls;
69
70     /* f->Psi += ( c->aileron / 8 );
71     if ( f->Psi > FG_2PI ) {
72         f->Psi -= FG_2PI;
73     } else if ( f->Psi < 0 ) {
74         f->Psi += FG_2PI;
75     }
76
77     f->vel_x = -c->elev;
78
79     f->pos_x = f->pos_x + (cos(f->Psi) * f->vel_x);
80     f->pos_y = f->pos_y + (sin(f->Psi) * f->vel_x); */
81 }
82
83