]> git.mxchange.org Git - flightgear.git/blob - src/ATCDCL/ATCProjection.hxx
Merge branch 'tbm/graphics-bug' into next
[flightgear.git] / src / ATCDCL / ATCProjection.hxx
1 // ATCProjection.hxx - A convienience projection class for the ATC/AI system.
2 //
3 // Written by David Luff, started 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20
21 #ifndef _FG_ATC_PROJECTION_HXX
22 #define _FG_ATC_PROJECTION_HXX
23
24 #include <simgear/math/point3d.hxx>
25
26 // FGATCProjection - a class to project an area local to an airport onto an orthogonal co-ordinate system
27 class FGATCProjection {
28
29 public:
30     FGATCProjection();
31     FGATCProjection(const Point3D& centre);
32     ~FGATCProjection();
33
34     void Init(const Point3D& centre);
35
36     // Convert a lat/lon co-ordinate (degrees) to the local projection (meters)
37     Point3D ConvertToLocal(const Point3D& pt);
38
39     // Convert a local projection co-ordinate (meters) to lat/lon (degrees)
40     Point3D ConvertFromLocal(const Point3D& pt);
41
42 private:
43     Point3D _origin;    // lat/lon of local area origin
44     double _correction_factor;  // Reduction in surface distance per degree of longitude due to latitude.  Saves having to do a cos() every call.
45
46 };
47
48
49 // FGATCAlignedProjection - a class to project an area local to a runway onto an orthogonal co-ordinate system
50 // with the origin at the threshold and the runway aligned with the y axis.
51 class FGATCAlignedProjection {
52
53 public:
54     FGATCAlignedProjection();
55     FGATCAlignedProjection(const Point3D& centre, double heading);
56     ~FGATCAlignedProjection();
57
58     void Init(const Point3D& centre, double heading);
59
60     // Convert a lat/lon co-ordinate (degrees) to the local projection (meters)
61     Point3D ConvertToLocal(const Point3D& pt);
62
63     // Convert a local projection co-ordinate (meters) to lat/lon (degrees)
64     Point3D ConvertFromLocal(const Point3D& pt);
65
66 private:
67     Point3D _origin;    // lat/lon of local area origin (the threshold)
68     double _theta;      // the rotation angle for alignment in radians
69     double _correction_factor;  // Reduction in surface distance per degree of longitude due to latitude.  Saves having to do a cos() every call.
70
71 };
72
73 #endif  // _FG_ATC_PROJECTION_HXX