1
0
Fork 0

Small cleanup of terrain radar

This commit is contained in:
timoore 2008-03-17 08:47:31 +00:00
parent c2040f30a2
commit 7800918499
3 changed files with 13 additions and 18 deletions

View file

@ -179,7 +179,7 @@ agRadar::setAntennaPos() {
} }
void void
agRadar::setUserVec(int az, double el) agRadar::setUserVec(double az, double el)
{ {
float yaw = _user_hdg_deg_node->getDoubleValue(); float yaw = _user_hdg_deg_node->getDoubleValue();
float pitch = _user_pitch_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 // and postrotate the orientation of the radar wrt the horizontal
// local frame // local frame
hlTrans *= SGQuatd::fromYawPitchRollDeg(yaw, pitch, roll); hlTrans *= SGQuatd::fromYawPitchRollDeg(yaw,
pitch_stab ? 0 :pitch,
roll_stab ? 0 : roll);
hlTrans *= offset; 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 // now rotate the rotation vector back into the
// earth centered frames coordinates // earth centered frames coordinates
SGVec3d angleaxis(1,0,0); SGVec3d angleaxis(1,0,0);
@ -283,12 +279,11 @@ agRadar::update_terrain()
_Instrument->setStringValue("status", status); _Instrument->setStringValue("status", status);
_Instrument->setDoubleValue("limit-deg", az_limit); _Instrument->setDoubleValue("limit-deg", az_limit);
_Instrument->setBoolValue("heading-marker", hdg_mkr); _Instrument->setBoolValue("heading-marker", hdg_mkr);
setUserPos();
setAntennaPos();
SGVec3d cartantennapos = getCartAntennaPos();
for(double brg = -az_limit; brg <= az_limit; brg += az_step){ 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){ for(double elev = el_limit; elev >= - el_limit; elev -= el_step){
setUserVec(brg, elev); setUserVec(brg, elev);
SGVec3d nearestHit; SGVec3d nearestHit;

View file

@ -41,7 +41,7 @@ public:
virtual void update (double dt); virtual void update (double dt);
void setUserPos(); void setUserPos();
void setUserVec(int az, double el); void setUserVec(double az, double el);
void update_terrain(); void update_terrain();
void setAntennaPos(); void setAntennaPos();

View file

@ -147,11 +147,11 @@ radAlt::update_altitude()
_min_radalt = max_range; _min_radalt = max_range;
for(double brg = -az_limit; brg <= az_limit; brg += az_step){ setUserPos();
setUserPos(); setAntennaPos();
setAntennaPos(); SGVec3d cartantennapos = getCartAntennaPos();
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){ for(double elev = el_limit; elev >= - el_limit; elev -= el_step){
setUserVec(brg, elev); setUserVec(brg, elev);