]> git.mxchange.org Git - simgear.git/blob - simgear/math/polar3d.hxx
4a0c7ed798bb9af3da09341baefb43be1ccba29f
[simgear.git] / simgear / math / polar3d.hxx
1 /**
2  * \file polar3d.hxx
3  * Routines to deal with polar math and transformations.
4  */
5
6 // Written by Curtis Olson, started June 1997.
7 //
8 // Copyright (C) 1997  Curtis L. Olson  - http://www.flightgear.org/~curt
9 //
10 // This library is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU Library General Public
12 // License as published by the Free Software Foundation; either
13 // version 2 of the License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 // Library General Public License for more details.
19 //
20 // You should have received a copy of the GNU Library General Public
21 // License along with this library; if not, write to the
22 // Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 // Boston, MA  02111-1307, USA.
24 //
25 // $Id$
26
27
28 #ifndef _POLAR3D_HXX
29 #define _POLAR3D_HXX
30
31
32 #ifndef __cplusplus                                                          
33 # error This library requires C++
34 #endif                                   
35
36
37 #include <math.h>
38
39 #include <simgear/constants.h>
40 #include <simgear/math/point3d.hxx>
41
42
43 /** 
44  * Find the Altitude above the Ellipsoid (WGS84) given the Earth
45  * Centered Cartesian coordinate vector Distances are specified in
46  * meters.
47  * @param cp point specified in cartesian coordinates
48  * @return altitude above the (wgs84) earth in meters
49  */
50 double sgGeodAltFromCart(const Point3D& cp);
51
52
53 /**
54  * Convert a polar coordinate to a cartesian coordinate.  Lon and Lat
55  * must be specified in radians.  The SG convention is for distances
56  * to be specified in meters
57  * @param p point specified in polar coordinates
58  * @return the same point in cartesian coordinates
59  */
60 Point3D sgPolarToCart3d(const Point3D& p);
61
62
63 /**
64  * Convert a cartesian coordinate to polar coordinates (lon/lat
65  * specified in radians.  Distances are specified in meters.
66  * @param cp point specified in cartesian coordinates
67  * @return the same point in polar coordinates
68  */
69 Point3D sgCartToPolar3d(const Point3D& cp);
70
71
72 /**
73  * Calculate new lon/lat given starting lon/lat, and offset radial, and
74  * distance.  NOTE: starting point is specifed in radians, distance is
75  * specified in meters (and converted internally to radians)
76  * ... assumes a spherical world.
77  * @param orig specified in polar coordinates
78  * @param course offset radial
79  * @param dist offset distance
80  * @return destination point in polar coordinates
81  */
82 Point3D calc_gc_lon_lat( const Point3D& orig, double course, double dist );
83
84
85 /**
86  * Calculate course/dist given two spherical points.
87  * @param start starting point
88  * @param dest ending point
89  * @param course resulting course
90  * @param dist resulting distance
91  */
92 void calc_gc_course_dist( const Point3D& start, const Point3D& dest, 
93                                  double *course, double *dist );
94
95 #if 0
96 /**
97  * Calculate course/dist given two spherical points.
98  * @param start starting point
99  * @param dest ending point
100  * @param course resulting course
101  * @param dist resulting distance
102  */
103 void calc_gc_course_dist( const Point3D& start, const Point3D& dest, 
104                                  double *course, double *dist );
105 #endif // 0
106
107 #endif // _POLAR3D_HXX
108