+static naRef f_flightplan_pathGeod(naContext c, naRef me, int argc, naRef* args)
+{
+ FlightPlan* fp = flightplanGhost(me);
+ if (!fp) {
+ naRuntimeError(c, "flightplan.clone called on non-flightplan object");
+ }
+
+ if ((argc < 1) || !naIsNum(args[0])) {
+ naRuntimeError(c, "bad argument to flightplan.pathGeod");
+ }
+
+ if ((argc > 1) && !naIsNum(args[1])) {
+ naRuntimeError(c, "bad argument to flightplan.pathGeod");
+ }
+
+ int index = (int) args[0].num;
+ double offset = (argc > 1) ? args[1].num : 0.0;
+ naRef result = naNewHash(c);
+ SGGeod g = fp->pointAlongRoute(index, offset);
+ hashset(c, result, "lat", naNum(g.getLatitudeDeg()));
+ hashset(c, result, "lon", naNum(g.getLongitudeDeg()));
+ return result;
+}
+
+