]> git.mxchange.org Git - flightgear.git/blob - src/ATC/ATCutils.hxx
Add units to function documentation
[flightgear.git] / src / ATC / ATCutils.hxx
1 // ATCutils.hxx - Utility functions for the ATC / AI subsytem
2 //
3 // Written by David Luff, started March 2002.
4 //
5 // Copyright (C) 2002  David C Luff - david.luff@nottingham.ac.uk
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 #include <Airports/simple.hxx>
22
23 #include <math.h>
24 #include <simgear/math/point3d.hxx>
25 #include <string>
26 SG_USING_STD(string);
27
28 // These are defined here because I had a problem with SG_DEGREES_TO_RADIANS
29 #define DCL_PI  3.1415926535f
30 #define DCL_DEGREES_TO_RADIANS  (DCL_PI/180.0)
31 #define DCL_RADIANS_TO_DEGREES  (180.0/DCL_PI)
32
33 /*******************************
34 *
35 *  Communication functions
36 *
37 ********************************/
38
39 // Convert any number to spoken digits
40 string ConvertNumToSpokenDigits(string n);
41
42 // Convert a 2 digit rwy number to a spoken-style string
43 string ConvertRwyNumToSpokenString(int n);
44
45 // Convert rwy number string to a spoken-style string
46 // eg "05L" to "zero five left"
47 // Assumes we get a two-digit string optionally appended with R or L
48 // eg 01 07L 29R 36
49 // Anything else is not guaranteed to be handled correctly!
50 string ConvertRwyNumToSpokenString(string s);
51
52 // Return the phonetic letter of a letter represented as an integer 1->26
53 string GetPhoneticIdent(int i);
54
55
56 /*******************************
57 *
58 *  Positional functions
59 *
60 ********************************/
61
62 // Given two positions (lat & lon in degrees), get the HORIZONTAL separation (in meters)
63 double dclGetHorizontalSeparation(Point3D pos1, Point3D pos2);
64
65 // Given a point and a line, get the HORIZONTAL shortest distance from the point to a point on the line.
66 // Expects to be fed orthogonal co-ordinates, NOT lat & lon !
67 double dclGetLinePointSeparation(double px, double py, double x1, double y1, double x2, double y2);
68
69 // Given a position (lat/lon/elev), heading, vertical angle, and distance, calculate the new position.
70 // Assumes that the ground is not hit!!!  Expects heading and angle in degrees, distance in meters.
71 Point3D dclUpdatePosition(Point3D pos, double heading, double angle, double distance);
72
73 // Get a heading from one lat/lon to another (in degrees)
74 double GetHeadingFromTo(Point3D A, Point3D B);
75
76 // Given a heading (in degrees), bound it from 0 -> 360
77 void dclBoundHeading(double &hdg);
78
79
80 /*******************************
81 *
82 *       Airport-related functions
83 *
84 ********************************/
85
86 // The next two functions are straight copies of their fg.... equivalents
87 // in fg_init.cxx, and are just here temporarily until some rationalisation occurs.
88
89 // find basic airport location info from airport database
90 bool dclFindAirportID( const string& id, FGAirport *a );
91
92 // get airport elevation
93 double dclGetAirportElev( const string& id );