1 #include <simgear/constants.h>
2 #include "waypoint.hxx"
5 SGWayPoint a1(-93.216923, 44.880547, 0.0, SGWayPoint::WGS84, "KMSP");
6 SGWayPoint a2(-93.216923, 44.880547, 0.0, SGWayPoint::SPHERICAL, "KMSP");
9 double cur_lon = -89.336939;
10 double cur_lat = 43.139541;
13 double course, distance;
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
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
26 SGWayPoint b1(-88.237037, 43.041038, 0.0, SGWayPoint::WGS84, "KUES");
27 SGWayPoint b2(-88.237037, 43.041038, 0.0, SGWayPoint::SPHERICAL, "KUES");
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
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
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;
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;
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;