1 /**************************************************************************
2 * slew.c -- the "slew" flight model
4 * Written by Curtis Olson, started May 1997.
6 * Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
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.
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.
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.
23 * (Log is kept at end of this file)
24 **************************************************************************/
30 #include "../flight.h"
31 #include "../../Aircraft/aircraft.h"
32 #include "../../Controls/controls.h"
33 #include "../../constants.h"
37 #define M_PI 3.14159265358979323846 /* pi */
41 #define PI2 (M_PI + M_PI)
45 /* reset flight params to a specific position */
46 void fgSlewInit(double pos_x, double pos_y, double pos_z, double heading) {
49 f = ¤t_aircraft.flight;
71 /* update position based on inputs, positions, velocities, etc. */
76 f = ¤t_aircraft.flight;
77 c = ¤t_aircraft.controls;
79 /* f->Psi += ( c->aileron / 8 );
80 if ( f->Psi > FG_2PI ) {
82 } else if ( f->Psi < 0 ) {
88 f->pos_x = f->pos_x + (cos(f->Psi) * f->vel_x);
89 f->pos_y = f->pos_y + (sin(f->Psi) * f->vel_x); */
94 /* Revision 1.6 1997/08/27 03:30:11 curt
95 /* Changed naming scheme of basic shared structures.
97 * Revision 1.5 1997/07/19 22:35:06 curt
98 * Moved fiddled with PI to avoid compiler warnings.
100 * Revision 1.4 1997/06/21 17:12:51 curt
101 * Capitalized subdirectory names.
103 * Revision 1.3 1997/05/29 22:40:00 curt
104 * Working on incorporating the LaRCsim flight model.
106 * Revision 1.2 1997/05/29 12:30:19 curt
107 * Some initial mods to work better in a timer environment.
109 * Revision 1.1 1997/05/29 02:29:42 curt
110 * Moved to their own directory.
112 * Revision 1.2 1997/05/23 15:40:37 curt
113 * Added GNU copyright headers.
115 * Revision 1.1 1997/05/16 16:04:45 curt