]> git.mxchange.org Git - flightgear.git/blob - Slew/slew.cxx
C++-ifying.
[flightgear.git] / Slew / slew.cxx
1 /**************************************************************************
2  * slew.cxx -- the "slew" flight model
3  *
4  * Written by Curtis Olson, started May 1997.
5  *
6  * Copyright (C) 1997  Curtis L. Olson  - curt@infoplane.com
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of the
11  * License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  *
22  * $Id$
23  * (Log is kept at end of this file)
24  **************************************************************************/
25
26
27 #include <math.h>
28
29 #include "slew.hxx"
30
31 #include <Flight/flight.hxx>
32 #include <Aircraft/aircraft.hxx>
33 #include <Controls/controls.h>
34 #include <Include/fg_constants.h>
35
36
37 /* reset flight params to a specific position */
38 void fgSlewInit(double pos_x, double pos_y, double pos_z, double heading) {
39     fgFLIGHT *f;
40
41     f = current_aircraft.flight;
42
43     /*
44     f->pos_x = pos_x;
45     f->pos_y = pos_y;
46     f->pos_z = pos_z;
47
48     f->vel_x = 0.0;
49     f->vel_y = 0.0;
50     f->vel_z = 0.0;
51
52     f->Phi = 0.0;
53     f->Theta = 0.0;
54     f->Psi = 0.0;
55
56     f->vel_Phi = 0.0;
57     f->vel_Theta = 0.0;
58     f->vel_Psi = 0.0;
59
60     f->Psi = heading;
61     */
62 }
63
64
65 /* update position based on inputs, positions, velocities, etc. */
66 void fgSlewUpdate( void ) {
67     fgFLIGHT *f;
68     fgCONTROLS *c;
69
70     f = current_aircraft.flight;
71     c = current_aircraft.controls;
72
73     /* f->Psi += ( c->aileron / 8 );
74     if ( f->Psi > FG_2PI ) {
75         f->Psi -= FG_2PI;
76     } else if ( f->Psi < 0 ) {
77         f->Psi += FG_2PI;
78     }
79
80     f->vel_x = -c->elev;
81
82     f->pos_x = f->pos_x + (cos(f->Psi) * f->vel_x);
83     f->pos_y = f->pos_y + (sin(f->Psi) * f->vel_x); */
84 }
85
86
87 /* $Log$
88 /* Revision 1.1  1998/10/16 23:27:50  curt
89 /* C++-ifying.
90 /*
91  * Revision 1.13  1998/04/25 22:06:29  curt
92  * Edited cvs log messages in source files ... bad bad bad!
93  *
94  * Revision 1.12  1998/04/08 23:35:30  curt
95  * Tweaks to Gnu automake/autoconf system.
96  *
97  * Revision 1.11  1998/02/07 15:29:39  curt
98  * Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
99  * <chotchkiss@namg.us.anritsu.com>
100  *
101  * Revision 1.10  1998/01/27 00:47:53  curt
102  * Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
103  * system and commandline/config file processing code.
104  *
105  * Revision 1.9  1998/01/19 19:27:06  curt
106  * Merged in make system changes from Bob Kuehne <rpk@sgi.com>
107  * This should simplify things tremendously.
108  *
109  * Revision 1.8  1998/01/19 18:40:30  curt
110  * Tons of little changes to clean up the code and to remove fatal errors
111  * when building with the c++ compiler.
112  *
113  * Revision 1.7  1997/12/15 23:54:42  curt
114  * Add xgl wrappers for debugging.
115  * Generate terrain normals on the fly.
116  *
117  * Revision 1.6  1997/08/27 03:30:11  curt
118  * Changed naming scheme of basic shared structures.
119  *
120  * Revision 1.5  1997/07/19 22:35:06  curt
121  * Moved fiddled with PI to avoid compiler warnings.
122  *
123  * Revision 1.4  1997/06/21 17:12:51  curt
124  * Capitalized subdirectory names.
125  *
126  * Revision 1.3  1997/05/29 22:40:00  curt
127  * Working on incorporating the LaRCsim flight model.
128  *
129  * Revision 1.2  1997/05/29 12:30:19  curt
130  * Some initial mods to work better in a timer environment.
131  *
132  * Revision 1.1  1997/05/29 02:29:42  curt
133  * Moved to their own directory.
134  *
135  * Revision 1.2  1997/05/23 15:40:37  curt
136  * Added GNU copyright headers.
137  *
138  * Revision 1.1  1997/05/16 16:04:45  curt
139  * Initial revision.
140  *
141  */