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