From dcb132192311c8c8a0657c34d912b5e55a3e2418 Mon Sep 17 00:00:00 2001 From: mfranz Date: Thu, 20 Nov 2008 11:24:45 +0000 Subject: [PATCH] make constants D2R, R2D, M2FT, FT2M global --- Nasal/aircraft.nas | 7 ------- Nasal/globals.nas | 8 ++++++++ Nasal/view.nas | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Nasal/aircraft.nas b/Nasal/aircraft.nas index 74bf8bf2b..2dae6cbde 100644 --- a/Nasal/aircraft.nas +++ b/Nasal/aircraft.nas @@ -3,13 +3,6 @@ -# constants -# ============================================================================== -var D2R = math.pi / 180; -var R2D = 180 / math.pi; - - - # helper functions # ============================================================================== diff --git a/Nasal/globals.nas b/Nasal/globals.nas index 9a3d5a3b4..db0fa4c76 100644 --- a/Nasal/globals.nas +++ b/Nasal/globals.nas @@ -139,3 +139,11 @@ settimer(func { io.load_nasal(path ~ "/" ~ file, substr(file, 0, size(file) - 4)); }, 0); + +## +# Constants. +# +var D2R = math.pi / 180; # degree to radian +var R2D = 180 / math.pi; # radian to degree +var FT2M = 0.3048; # feet to meter +var M2FT = 3.28083989501312335958; # meter to feet diff --git a/Nasal/view.nas b/Nasal/view.nas index ab202b0a8..516e24cfc 100644 --- a/Nasal/view.nas +++ b/Nasal/view.nas @@ -285,7 +285,7 @@ var fly_by_view_handler = { # apply random deviation var radius = me.chase * (0.5 * rand() + 0.7); - var agl = getprop("/position/altitude-agl-ft") * geo.FT2M; + var agl = getprop("/position/altitude-agl-ft") * FT2M; if (agl > me.chase) var angle = rand() * 2 * math.pi; else @@ -313,7 +313,7 @@ var fly_by_view_handler = { # set new view point me.latN.setValue(lat); me.lonN.setValue(lon); - me.altN.setValue(alt * geo.M2FT); + me.altN.setValue(alt * M2FT); return 7.3; }, update : func {