Nasal library: Difference between revisions

→‎aircraftToCart(): Added this function
(→‎getprop(): Added get_cart_ground_intersection)
(→‎aircraftToCart(): Added this function)
Line 849: Line 849:
|example2 = print(abs(-1)); # prints "1"
|example2 = print(abs(-1)); # prints "1"
}}
}}
=== aircraftToCart() ===
This new function in FG 2017.2.1 takes coordinates in aircraft structural coordinate system, and translate them into geocentric coordinates.
Example for (5,6,7):
<syntaxhighlight lang="nasal">
var pos = aircraftToCart({x: -5, y: 6, z: -7});
var coord = geo.Coord.new();
coord.set_xyz(pos.x, pos.y, pos.z);
</syntaxhighlight>
Notice: x and z is inverted sign on purpose.
if you want lat. lon, alt from that, just call: (degrees and meters)
<syntaxhighlight lang="nasal">
coord.lat()
coord.lon()
coord.alt()
</syntaxhighlight>


=== addcommand() ===
=== addcommand() ===
574

edits