From 7800918499e77a6c7f2bb444c53e229a643baf09 Mon Sep 17 00:00:00 2001 From: timoore Date: Mon, 17 Mar 2008 08:47:31 +0000 Subject: [PATCH] Small cleanup of terrain radar --- src/Instrumentation/agradar.cxx | 21 ++++++++------------- src/Instrumentation/agradar.hxx | 2 +- src/Instrumentation/rad_alt.cxx | 8 ++++---- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/Instrumentation/agradar.cxx b/src/Instrumentation/agradar.cxx index a1d293390..4666f0b19 100644 --- a/src/Instrumentation/agradar.cxx +++ b/src/Instrumentation/agradar.cxx @@ -179,7 +179,7 @@ agRadar::setAntennaPos() { } void -agRadar::setUserVec(int az, double el) +agRadar::setUserVec(double az, double el) { float yaw = _user_hdg_deg_node->getDoubleValue(); float pitch = _user_pitch_deg_node->getDoubleValue(); @@ -197,15 +197,11 @@ agRadar::setUserVec(int az, double el) // and postrotate the orientation of the radar wrt the horizontal // local frame - hlTrans *= SGQuatd::fromYawPitchRollDeg(yaw, pitch, roll); + hlTrans *= SGQuatd::fromYawPitchRollDeg(yaw, + pitch_stab ? 0 :pitch, + roll_stab ? 0 : roll); hlTrans *= offset; - if (roll_stab) - hlTrans *= SGQuatd::fromYawPitchRollDeg(0, 0, -roll); - - if (pitch_stab) - hlTrans *= SGQuatd::fromYawPitchRollDeg(0, -pitch, 0); - // now rotate the rotation vector back into the // earth centered frames coordinates SGVec3d angleaxis(1,0,0); @@ -283,12 +279,11 @@ agRadar::update_terrain() _Instrument->setStringValue("status", status); _Instrument->setDoubleValue("limit-deg", az_limit); _Instrument->setBoolValue("heading-marker", hdg_mkr); - + setUserPos(); + setAntennaPos(); + SGVec3d cartantennapos = getCartAntennaPos(); + for(double brg = -az_limit; brg <= az_limit; brg += az_step){ - setUserPos(); - setAntennaPos(); - SGVec3d cartantennapos = getCartAntennaPos(); - for(double elev = el_limit; elev >= - el_limit; elev -= el_step){ setUserVec(brg, elev); SGVec3d nearestHit; diff --git a/src/Instrumentation/agradar.hxx b/src/Instrumentation/agradar.hxx index abdf18e9e..26907a7fd 100644 --- a/src/Instrumentation/agradar.hxx +++ b/src/Instrumentation/agradar.hxx @@ -41,7 +41,7 @@ public: virtual void update (double dt); void setUserPos(); - void setUserVec(int az, double el); + void setUserVec(double az, double el); void update_terrain(); void setAntennaPos(); diff --git a/src/Instrumentation/rad_alt.cxx b/src/Instrumentation/rad_alt.cxx index 4d06bb95f..14186459c 100644 --- a/src/Instrumentation/rad_alt.cxx +++ b/src/Instrumentation/rad_alt.cxx @@ -147,11 +147,11 @@ radAlt::update_altitude() _min_radalt = max_range; - for(double brg = -az_limit; brg <= az_limit; brg += az_step){ - setUserPos(); - setAntennaPos(); - SGVec3d cartantennapos = getCartAntennaPos(); + setUserPos(); + setAntennaPos(); + SGVec3d cartantennapos = getCartAntennaPos(); + for(double brg = -az_limit; brg <= az_limit; brg += az_step){ for(double elev = el_limit; elev >= - el_limit; elev -= el_step){ setUserVec(brg, elev);