1 #include <simgear/compiler.h>
2 #include <simgear/constants.h>
6 #include "waypoint.hxx"
12 SGWayPoint a1(-93.216923, 44.880547, 0.0, SGWayPoint::WGS84, "KMSP");
13 SGWayPoint a2(-93.216923, 44.880547, 0.0, SGWayPoint::SPHERICAL, "KMSP");
16 double cur_lon = -89.336939;
17 double cur_lat = 43.139541;
20 double course, distance;
22 a1.CourseAndDistance( cur_lon, cur_lat, cur_alt, &course, &distance );
23 cout << "Course to " << a1.get_id() << " is " << course << endl;
24 cout << "Distance to " << a1.get_id() << " is " << distance * SG_METER_TO_NM
27 a2.CourseAndDistance( cur_lon, cur_lat, cur_alt, &course, &distance );
28 cout << "Course to " << a2.get_id() << " is " << course << endl;
29 cout << "Distance to " << a2.get_id() << " is " << distance * SG_METER_TO_NM
33 SGWayPoint b1(-88.237037, 43.041038, 0.0, SGWayPoint::WGS84, "KUES");
34 SGWayPoint b2(-88.237037, 43.041038, 0.0, SGWayPoint::SPHERICAL, "KUES");
36 b1.CourseAndDistance( cur_lon, cur_lat, cur_alt, &course, &distance );
37 cout << "Course to " << b1.get_id() << " is " << course << endl;
38 cout << "Distance to " << b1.get_id() << " is " << distance * SG_METER_TO_NM
41 b2.CourseAndDistance( cur_lon, cur_lat, cur_alt, &course, &distance );
42 cout << "Course to " << b2.get_id() << " is " << course << endl;
43 cout << "Distance to " << b2.get_id() << " is " << distance * SG_METER_TO_NM
50 SGWayPoint c1(-20, 10, 0, SGWayPoint::CARTESIAN, "Due East");
51 c1.CourseAndDistance( cur_lon, cur_lat, cur_alt, &course, &distance );
52 cout << "Course to " << c1.get_id() << " is " << course << endl;
53 cout << "Distance to " << c1.get_id() << " is " << distance << endl;
55 SGWayPoint c2(20, 20, 0, SGWayPoint::CARTESIAN, "Due SW");
56 c2.CourseAndDistance( cur_lon, cur_lat, cur_alt, &course, &distance );
57 cout << "Course to " << c2.get_id() << " is " << course << endl;
58 cout << "Distance to " << c2.get_id() << " is " << distance << endl;
60 SGWayPoint c3(20, 0, 0, SGWayPoint::CARTESIAN, "Due NW");
61 c3.CourseAndDistance( cur_lon, cur_lat, cur_alt, &course, &distance );
62 cout << "Course to " << c3.get_id() << " is " << course << endl;
63 cout << "Distance to " << c3.get_id() << " is " << distance << endl;