]> git.mxchange.org Git - simgear.git/blob - simgear/route/routetest.cxx
Roy Vegard Ovesen:
[simgear.git] / simgear / route / routetest.cxx
1 #include <simgear/compiler.h>
2 #include <simgear/constants.h>
3
4 #include STL_IOSTREAM
5
6 #include "route.hxx"
7 #include "waypoint.hxx"
8
9 SG_USING_STD(cout);
10 SG_USING_STD(endl);
11  
12 int main() {
13     SGRoute route;
14
15     route.add_waypoint( SGWayPoint(0, 0, 0, SGWayPoint::CARTESIAN, "Start") );
16     route.add_waypoint( SGWayPoint(1, 0, 0, SGWayPoint::CARTESIAN, "1") );
17     route.add_waypoint( SGWayPoint(2, 0, 0, SGWayPoint::CARTESIAN, "2") );
18     route.add_waypoint( SGWayPoint(2, 2, 0, SGWayPoint::CARTESIAN, "3") );
19     route.add_waypoint( SGWayPoint(4, 2, 0, SGWayPoint::CARTESIAN, "4") );
20    
21     route.set_current( 1 );
22
23     cout << "( 0.5, 0 ) = " << route.distance_off_route( 0.5, 0 ) << endl;
24     cout << "( 0.5, 1 ) = " << route.distance_off_route( 0.5, 1 ) << endl;
25     cout << "( 0.5, -1 ) = " << route.distance_off_route( 0.5, 1 ) << endl;
26
27     route.set_current( 3 );
28
29     cout << "( 2, 4 ) = " << route.distance_off_route( 2, 4 ) << endl;
30     cout << "( 2.5, 4 ) = " << route.distance_off_route( 2.5, 4 ) << endl;
31
32     return 0;
33 }