]> git.mxchange.org Git - simgear.git/blob - simgear/route/waytest.cxx
FG_ to SG_ namespace changes.
[simgear.git] / simgear / route / waytest.cxx
1 #include <simgear/constants.h>
2 #include "waypoint.hxx"
3
4 int main() {
5     SGWayPoint a1(-93.216923, 44.880547, 0.0, SGWayPoint::WGS84, "KMSP");
6     SGWayPoint a2(-93.216923, 44.880547, 0.0, SGWayPoint::SPHERICAL, "KMSP");
7
8     // KMSN (Madison)
9     double cur_lon = -89.336939;
10     double cur_lat = 43.139541;
11     double cur_alt = 0.0;
12
13     double course, distance;
14
15     a1.CourseAndDistance( cur_lon, cur_lat, cur_alt, &course, &distance );
16     cout << "Course to " << a1.get_id() << " is " << course << endl;
17     cout << "Distance to " << a1.get_id() << " is " << distance * METER_TO_NM
18          << endl;
19
20     a2.CourseAndDistance( cur_lon, cur_lat, cur_alt, &course, &distance );
21     cout << "Course to " << a2.get_id() << " is " << course << endl;
22     cout << "Distance to " << a2.get_id() << " is " << distance * METER_TO_NM
23          << endl;
24     cout << endl;
25
26     SGWayPoint b1(-88.237037, 43.041038, 0.0, SGWayPoint::WGS84, "KUES");
27     SGWayPoint b2(-88.237037, 43.041038, 0.0, SGWayPoint::SPHERICAL, "KUES");
28
29     b1.CourseAndDistance( cur_lon, cur_lat, cur_alt, &course, &distance );
30     cout << "Course to " << b1.get_id() << " is " << course << endl;
31     cout << "Distance to " << b1.get_id() << " is " << distance * METER_TO_NM
32          << endl;
33
34     b2.CourseAndDistance( cur_lon, cur_lat, cur_alt, &course, &distance );
35     cout << "Course to " << b2.get_id() << " is " << course << endl;
36     cout << "Distance to " << b2.get_id() << " is " << distance * METER_TO_NM
37          << endl;
38     cout << endl;
39
40     cur_lon = 10;
41     cur_lat = 10;
42
43     SGWayPoint c1(-20, 10, 0, SGWayPoint::CARTESIAN, "Due East");
44     c1.CourseAndDistance( cur_lon, cur_lat, cur_alt, &course, &distance );
45     cout << "Course to " << c1.get_id() << " is " << course << endl;
46     cout << "Distance to " << c1.get_id() << " is " << distance << endl;
47    
48     SGWayPoint c2(20, 20, 0, SGWayPoint::CARTESIAN, "Due SW");
49     c2.CourseAndDistance( cur_lon, cur_lat, cur_alt, &course, &distance );
50     cout << "Course to " << c2.get_id() << " is " << course << endl;
51     cout << "Distance to " << c2.get_id() << " is " << distance << endl;
52    
53     SGWayPoint c3(20, 0, 0, SGWayPoint::CARTESIAN, "Due NW");
54     c3.CourseAndDistance( cur_lon, cur_lat, cur_alt, &course, &distance );
55     cout << "Course to " << c3.get_id() << " is " << course << endl;
56     cout << "Distance to " << c3.get_id() << " is " << distance << endl;
57    
58     return 0;
59 }