1
0
Fork 0
flightgear/src
Richard Harrison b80b9a8fc0 Added Nasal methods for ground intersection test and aircraft coordinate conversion
New Nasal method get_cart_ground_intersection

Returns where the given position in the specified direction will intersect with the ground. Returns whether or not a certain position and direction pair intersect with the ground, and if so the intersection point.

Useful for radars, terrain avoidance (GPWS), etc.

Input parameters:
1. vec3d(x,y,z) position
2. vec3d(x,y,z) direction

Returns nil or geod hash (lat:rad,lon:rad,elevation:Meters) intersection

Example Usage:

var end = geo.Coord.new(start);
end.apply_course_distance(heading, speed_horz_fps*FT2M);
end.set_alt(end.alt() - speed_down_fps*FT2M);

var dir_x = end.x() - start.x();
var dir_y = end.y() - start.y();
var dir_z = end.z() - start.z();
var xyz = { "x":start.x(),  "y" : start.y(),  "z" : start.z() };
var dir = { "x":dir_x,      "y" : dir_y,      "z" : dir_z };

var geod = get_cart_ground_intersection(xyz, dir);
if (geod != nil) {
         end.set_latlon(geod.lat, geod.lon, geod.elevation);
          var dist = start.direct_distance_to(end)*M2FT;
         var time = dist / speed_fps;
         setprop("/sim/model/radar/time-until-impact", time);
     }

-----------

Nasal method aircraftToCart : This allows easily computing offsets in aircraft-relative coordinates, and converting to global cartesian (ECEF) reference frame.
2017-05-11 20:05:14 +02:00
..
AIModel Fix crash in AI code when buggy groundnet declares pushback hold point on runway 2017-04-14 12:25:00 +02:00
Aircraft Adapt includes according to relocation of SimGear's iostreams-related files 2017-02-12 21:30:51 +01:00
Airports Improve handling of the pushBackRoute attribute in groundnet's Parking nodes 2017-05-04 10:30:51 +02:00
ATC Fix crash in src/ATC/trafficcontrol.cxx (invalid iterator dereferenced) 2017-05-10 16:54:55 +02:00
Autopilot Fixed route manager returning freed char* pointers via tied properties 2017-02-25 15:17:03 +01:00
Canvas Quiet Canvas font-loading. 2016-11-30 12:15:54 +00:00
Cockpit Merge branch 'next-2' into multiplayer-dev 2017-04-02 02:22:48 +02:00
Environment Fix crash in PT_vs_hpt() due to invalid data in ISA_def 2017-05-10 16:54:55 +02:00
FDM YASim: revert a change in Model.cpp that caused segfaults on some systems. 2017-05-10 16:27:46 +02:00
GUI Prevent PUI menubar obscuring startup tips 2017-05-11 08:39:48 +01:00
Include Unit-test for initPosition. 2017-03-27 15:38:05 +01:00
Input Fix crash on Mac OS X when FG does not finish input init 2017-02-25 15:05:09 +01:00
Instrumentation Adapt includes according to relocation of SimGear's iostreams-related files 2017-02-12 21:30:51 +01:00
Main End segfault_handler() with std::abort() rather than kill() on ourselves 2017-05-11 12:19:31 +02:00
Model Revert "Fixes for HUD, model-manager listeners." 2017-02-02 17:02:39 +01:00
MultiPlayer Silence a warning. 2017-05-02 12:45:32 +01:00
Navaids Fix warnings about unreferenced local variables 2017-05-04 09:41:29 +02:00
Network Generic protocol fix for integer-factors. 2017-03-16 15:54:38 +00:00
Radio Adapt includes according to relocation of SimGear's iostreams-related files 2017-02-12 21:30:51 +01:00
Scenery Fixed building FG with GDAL 2017-03-11 13:34:19 +01:00
Scripting Added Nasal methods for ground intersection test and aircraft coordinate conversion 2017-05-11 20:05:14 +02:00
Sound Multiplayer: ensure that avionics sounds are null for MP models. 2017-04-02 13:54:03 +02:00
Systems Build- and run-time concept of developer mode. 2017-02-27 23:37:59 +00:00
Time Time: Calculation and exposure of the moon vector from the local position. 2016-11-08 11:16:24 +01:00
Traffic Build- and run-time concept of developer mode. 2017-02-27 23:37:59 +00:00
Viewer Prevent PUI menubar obscuring startup tips 2017-05-11 08:39:48 +01:00
CMakeLists.txt Cleanup of ATCDCL 2014-04-30 10:22:51 +02:00