FG_LOG( FG_FLIGHT, FG_DEBUG,
"Pos = ("
- << (f->get_Longitude() * 3600.0 * RAD_TO_DEG) << ","
- << (f->get_Latitude() * 3600.0 * RAD_TO_DEG) << ","
+ << (f->get_Longitude() * 3600.0 * SGD_RADIANS_TO_DEGREES) << ","
+ << (f->get_Latitude() * 3600.0 * SGD_RADIANS_TO_DEGREES) << ","
<< f->get_Altitude()
<< ") (Phi,Theta,Psi)=("
<< f->get_Phi() << ","
double x = current_radiostack->get_nav1_gs_dist();
double y = (FGBFI::getAltitude()
- current_radiostack->get_nav1_elev()) * FEET_TO_METER;
- double current_angle = atan2( y, x ) * RAD_TO_DEG;
+ double current_angle = atan2( y, x ) * SGD_RADIANS_TO_DEGREES;
// cout << "current angle = " << current_angle << endl;
double target_angle = current_radiostack->get_nav1_target_gs();
double horiz_vel = cur_fdm_state->get_V_ground_speed()
* FEET_TO_METER * 60.0;
// cout << "Horizontal vel = " << horiz_vel << endl;
- climb_rate = -sin( des_angle * DEG_TO_RAD ) * horiz_vel;
+ climb_rate = -sin( des_angle * SGD_DEGREES_TO_RADIANS ) * horiz_vel;
// cout << "climb_rate = " << climb_rate << endl;
/* climb_error_accum += gs_diff * 2.0; */
/* climb_rate = gs_diff * 200.0 + climb_error_accum; */
#if 0
static inline double get_aoa( void ) {
- return( cur_fdm_state->get_Gamma_vert_rad() * RAD_TO_DEG );
+ return( cur_fdm_state->get_Gamma_vert_rad() * SGD_RADIANS_TO_DEGREES );
}
static inline double fgAPget_latitude( void ) {
- return( cur_fdm_state->get_Latitude() * RAD_TO_DEG );
+ return( cur_fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES );
}
static inline double fgAPget_longitude( void ) {
- return( cur_fdm_state->get_Longitude() * RAD_TO_DEG );
+ return( cur_fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES );
}
static inline double fgAPget_roll( void ) {
- return( cur_fdm_state->get_Phi() * RAD_TO_DEG );
+ return( cur_fdm_state->get_Phi() * SGD_RADIANS_TO_DEGREES );
}
static inline double get_pitch( void ) {
}
double fgAPget_heading( void ) {
- return( cur_fdm_state->get_Psi() * RAD_TO_DEG );
+ return( cur_fdm_state->get_Psi() * SGD_RADIANS_TO_DEGREES );
}
static inline double fgAPget_altitude( void ) {
{
double lat;
- lat = current_aircraft.fdm_state->get_Latitude() * RAD_TO_DEG;
+ lat = current_aircraft.fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES;
float flat = lat;
return(flat);
{
double a, d;
- a = current_aircraft.fdm_state->get_Latitude() * RAD_TO_DEG;
+ a = current_aircraft.fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES;
if (a < 0.0) {
a = -a;
}
{
double lon;
- lon = current_aircraft.fdm_state->get_Longitude() * RAD_TO_DEG;
+ lon = current_aircraft.fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES;
float flon = lon;
return(flon);
float get_long_min( void )
{
double a, d;
- a = current_aircraft.fdm_state->get_Longitude() * RAD_TO_DEG;
+ a = current_aircraft.fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES;
if (a < 0.0) {
a = -a;
}
float get_aoa( void )
{
- float aoa = current_aircraft.fdm_state->get_Alpha() * RAD_TO_DEG;
+ float aoa = current_aircraft.fdm_state->get_Alpha() * SGD_RADIANS_TO_DEGREES;
return( aoa );
}
float get_heading( void )
{
- float heading = (current_aircraft.fdm_state->get_Psi() * RAD_TO_DEG);
+ float heading = (current_aircraft.fdm_state->get_Psi() * SGD_RADIANS_TO_DEGREES);
return( heading );
}
{
double view_off = SGD_2PI - globals->get_current_view()->get_view_offset();
double view = ( current_aircraft.fdm_state->get_Psi() + view_off)
- * RAD_TO_DEG;
+ * SGD_RADIANS_TO_DEGREES;
if(view > 360.)
view -= 360.;
if(*msg)
{
glPushMatrix();
- glRotatef(theta * RAD_TO_DEG, 0.0, 0.0, 1.0);
+ glRotatef(theta * SGD_RADIANS_TO_DEGREES, 0.0, 0.0, 1.0);
sintheta = sin(theta);
costheta = cos(theta);
xx = (int)(x * costheta + y * sintheta);
wowm = get_iaux4();
ihook = get_iaux5();
- float pitch_value = current_ch1() * RAD_TO_DEG;
+ float pitch_value = current_ch1() * SGD_RADIANS_TO_DEGREES;
if(hudladder_type=="Climb/Dive Ladder") {
pitch_ladder = false;
actslope = (up_vel/fabs(up_vel))*90.0;
}
} else {
- actslope = atan(up_vel/ground_vel)*RAD_TO_DEG;
+ actslope = atan(up_vel/ground_vel)*SGD_RADIANS_TO_DEGREES;
}
- xvvr = (((atan2(Vyy,Vxx)*RAD_TO_DEG)-psi)*(640.0/45.0));
- drift = ((atan2(Vyy,Vxx)*RAD_TO_DEG)-psi);
+ xvvr = (((atan2(Vyy,Vxx)*SGD_RADIANS_TO_DEGREES)-psi)*(640.0/45.0));
+ drift = ((atan2(Vyy,Vxx)*SGD_RADIANS_TO_DEGREES)-psi);
yvvr = ((actslope - pitch_value)*factor);
vel_y = ((actslope -pitch_value) * cos(roll_value) + drift*sin(roll_value))*factor;
vel_x = (-(actslope -pitch_value)*sin(roll_value) + drift*cos(roll_value))*(640/45.0);
t1 = up_vel/total_vel;
t2 = asin((Vxx*Axx + Vyy*Ayy + Vzz*Azz)/(9.81*total_vel));
}
- pot_slope = ((t2/3)*RAD_TO_DEG)*factor + vel_y;
+ pot_slope = ((t2/3)*SGD_RADIANS_TO_DEGREES)*factor + vel_y;
// if (pot_slope < (vel_y - 45)) pot_slope = vel_y-45;
// if (pot_slope > (vel_y + 45)) pot_slope = vel_y+45;
// ATTRIB - ON CONDITION
glBegin(GL_LINE_STRIP);
glVertex2f(-6, -134);
- glVertex2f(-6, t2*RAD_TO_DEG*4.0 - 134);
- glVertex2f(+6, t2*RAD_TO_DEG*4.0 - 134);
+ glVertex2f(-6, t2*SGD_RADIANS_TO_DEGREES*4.0 - 134);
+ glVertex2f(+6, t2*SGD_RADIANS_TO_DEGREES*4.0 - 134);
glVertex2f(6, -134);
glEnd();
// OBJECT MOVING RETICLE
}
- glRotatef(roll_value * RAD_TO_DEG, 0.0, 0.0, 1.0);
+ glRotatef(roll_value * SGD_RADIANS_TO_DEGREES, 0.0, 0.0, 1.0);
// FRL marker not rotated - this line shifted below
if( div_units ) {
//waypoint marker computation
float fromwp_lat,towp_lat,fromwp_lon,towp_lon,dist,delx,dely,hyp,theta,brg;
- fromwp_lon = get_longitude()*DEG_TO_RAD;
- fromwp_lat = get_latitude()*DEG_TO_RAD;
- towp_lon = get_aux5()*DEG_TO_RAD;
- towp_lat = get_aux6()*DEG_TO_RAD;
+ fromwp_lon = get_longitude()*SGD_DEGREES_TO_RADIANS;
+ fromwp_lat = get_latitude()*SGD_DEGREES_TO_RADIANS;
+ towp_lon = get_aux5()*SGD_DEGREES_TO_RADIANS;
+ towp_lat = get_aux6()*SGD_DEGREES_TO_RADIANS;
dist = acos(sin(fromwp_lat)*sin(towp_lat)+cos(fromwp_lat)*cos(towp_lat)*cos(fabs(fromwp_lon-towp_lon)));
delx= towp_lat - fromwp_lat;
} else {
theta = 0.0;
}
- brg = theta*RAD_TO_DEG;
+ brg = theta*SGD_RADIANS_TO_DEGREES;
if (brg > 360.0) brg = 0.0;
if (delx < 0) brg = 180 - brg;
// {Brg = asin(cos(towp_lat)*sin(fabs(fromwp_lon-towp_lon))/ sin(dist));
- // Brg = Brg * RAD_TO_DEG; }
- dist = dist*RAD_TO_DEG * 60.0*1852.0; //rad->deg->nm->m
+ // Brg = Brg * SGD_RADIANS_TO_DEGREES; }
+ dist = dist*SGD_RADIANS_TO_DEGREES * 60.0*1852.0; //rad->deg->nm->m
// end waypoint marker computation
//*********************************************************
// OBJECT MOVING RETICLE
cen_x = centroid.x;
cen_y = centroid.y;
- bank = bank_angle * RAD_TO_DEG;
+ bank = bank_angle * SGD_RADIANS_TO_DEGREES;
tee = -tee_height;
fspan = span;
hole = scr_hole;
glEnable(GL_ALPHA_TEST);
glEnable(GL_COLOR_MATERIAL);
// glColor4f(1.0, 1.0, 1.0, 1.0);
- if ( cur_light_params.sun_angle * RAD_TO_DEG < 95.0 ) {
+ if ( cur_light_params.sun_angle * SGD_RADIANS_TO_DEGREES < 95.0 ) {
glColor4fv( cur_light_params.scene_diffuse );
} else {
glColor4f(0.7, 0.2, 0.2, 1.0);
// From Curt: turn on the panel
// lights after sundown.
- if ( cur_light_params.sun_angle * RAD_TO_DEG < 95.0 ) {
+ if ( cur_light_params.sun_angle * SGD_RADIANS_TO_DEGREES < 95.0 ) {
glColor4fv( cur_light_params.scene_diffuse );
} else {
glColor4f(0.7, 0.2, 0.2, 1.0);
void
FGRadioStack::update()
{
- double lon = longitudeVal->getDoubleValue() * DEG_TO_RAD;
- double lat = latitudeVal->getDoubleValue() * DEG_TO_RAD;
+ double lon = longitudeVal->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
+ double lat = latitudeVal->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
double elev = altitudeVal->getDoubleValue() * FEET_TO_METER;
need_update = false;
}
// wgs84 heading
- geo_inverse_wgs_84( elev, lat * RAD_TO_DEG, lon * RAD_TO_DEG,
+ geo_inverse_wgs_84( elev, lat * SGD_RADIANS_TO_DEGREES, lon * SGD_RADIANS_TO_DEGREES,
nav1_loclat, nav1_loclon,
&az1, &az2, &s );
// cout << "az1 = " << az1 << " magvar = " << nav1_magvar << endl;
}
// wgs84 heading
- geo_inverse_wgs_84( elev, lat * RAD_TO_DEG, lon * RAD_TO_DEG,
+ geo_inverse_wgs_84( elev, lat * SGD_RADIANS_TO_DEGREES, lon * SGD_RADIANS_TO_DEGREES,
nav2_loclat, nav2_loclon,
&az1, &az2, &s );
nav2_heading = az1 - nav2_magvar;
adf_dist = aircraft.distance3D( station );
// wgs84 heading
- geo_inverse_wgs_84( elev, lat * RAD_TO_DEG, lon * RAD_TO_DEG,
+ geo_inverse_wgs_84( elev, lat * SGD_RADIANS_TO_DEGREES, lon * SGD_RADIANS_TO_DEGREES,
adf_lat, adf_lon,
&az1, &az2, &s );
adf_heading = az1;
// Update current nav/adf radio stations based on current postition
void FGRadioStack::search()
{
- double lon = longitudeVal->getDoubleValue() * DEG_TO_RAD;
- double lat = latitudeVal->getDoubleValue() * DEG_TO_RAD;
+ double lon = longitudeVal->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
+ double lat = latitudeVal->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
double elev = altitudeVal->getDoubleValue() * FEET_TO_METER;
// nav1
}
FGBeacon::fgMkrBeacType beacon_type
- = current_beacons->query( lon * RAD_TO_DEG, lat * RAD_TO_DEG, elev );
+ = current_beacons->query( lon * SGD_RADIANS_TO_DEGREES, lat * SGD_RADIANS_TO_DEGREES, elev );
outer_marker = middle_marker = inner_marker = false;
if ( nav1_inrange && nav1_has_gs ) {
double x = nav1_gs_dist;
double y = (FGBFI::getAltitude() - nav1_elev) * FEET_TO_METER;
- double angle = atan2( y, x ) * RAD_TO_DEG;
+ double angle = atan2( y, x ) * SGD_RADIANS_TO_DEGREES;
return (nav1_target_gs - angle) * 5.0;
} else {
return 0.0;
if ( nav2_inrange && nav2_has_gs ) {
double x = nav2_gs_dist;
double y = (FGBFI::getAltitude() - nav2_elev) * FEET_TO_METER;
- double angle = atan2( y, x ) * RAD_TO_DEG;
+ double angle = atan2( y, x ) * SGD_RADIANS_TO_DEGREES;
return (nav2_target_gs - angle) * 5.0;
} else {
return 0.0;
*/
set_lowpass ( & the_TC_std,
current_aircraft.fdm_state->get_Phi_dot ()
- * RAD_TO_DEG / 20.0 +
+ * SGD_RADIANS_TO_DEGREES / 20.0 +
current_aircraft.fdm_state->get_Psi_dot ()
- * RAD_TO_DEG / 3.0 , dt );
+ * SGD_RADIANS_TO_DEGREES / 3.0 , dt );
/**************************
We want to know the pilot accelerations,
double EdgN, EdgE, EdgU;
double TrqN, TrqE, TrqU, Torque;
/* Find a force vector towards exact magnetic north */
- MagVar = FGBFI::getMagVar() / RAD_TO_DEG;
- MagDip = FGBFI::getMagDip() / RAD_TO_DEG;
+ MagVar = FGBFI::getMagVar() / SGD_RADIANS_TO_DEGREES;
+ MagDip = FGBFI::getMagDip() / SGD_RADIANS_TO_DEGREES;
CosDip = cos ( MagDip );
FrcN = CosDip * cos ( MagVar );
FrcE = CosDip * sin ( MagVar );
if ( AccTot > 1.0 ) AccTot = sqrt ( AccTot );
else AccTot = 1.0;
/* Force applies to north marking on compass card */
- EdgN = cos ( the_MH_err / RAD_TO_DEG );
- EdgE = sin ( the_MH_err / RAD_TO_DEG );
+ EdgN = cos ( the_MH_err / SGD_RADIANS_TO_DEGREES );
+ EdgE = sin ( the_MH_err / SGD_RADIANS_TO_DEGREES );
EdgU = 0.0;
/* Apply the force to the edge to get torques */
TrqN = EdgE * FrcU - EdgU * FrcE;
double x = current_radiostack->get_nav1_gs_dist();
double y = (FGBFI::getAltitude() - current_radiostack->get_nav1_elev())
* FEET_TO_METER;
- double angle = atan2( y, x ) * RAD_TO_DEG;
+ double angle = atan2( y, x ) * SGD_RADIANS_TO_DEGREES;
return (current_radiostack->get_nav1_target_gs() - angle) * 5.0;
} else {
return 0.0;
_set_Mach_number( Machno);
// printf("sr=%f\n",Sea_level_radius);
- // printf("psi = %f %f\n",Psi,Psi*RAD_TO_DEG);
+ // printf("psi = %f %f\n",Psi,Psi*SGD_RADIANS_TO_DEGREES);
// controls
controls.set_throttle(0,throttle/131.0);
getTheta();
vdown=-1*hdot;
cout << "hdot: " << hdot << endl;
- cout << "gamma: " << gamma*RAD_TO_DEG << endl;
+ cout << "gamma: " << gamma*SGD_RADIANS_TO_DEGREES << endl;
cout << "vdown: " << vdown << endl;
}
}
INCLUDES
*******************************************************************************/
+#include <plib/sg.h>
+
#include <FDM/LaRCsim/ls_constants.h>
#include <FDM/LaRCsim/ls_types.h>
void SetAltitudeAGLFtIC(SCALAR tt);
//"vertical" flight path, recalculate theta
- inline void SetFlightPathAngleDegIC(SCALAR tt) { SetFlightPathAngleRadIC(tt*DEG_TO_RAD); }
+ inline void SetFlightPathAngleDegIC(SCALAR tt) { SetFlightPathAngleRadIC(tt*SGD_DEGREES_TO_RADIANS); }
void SetFlightPathAngleRadIC(SCALAR tt);
//set speed first
void SetClimbRateFpsIC(SCALAR tt);
//use currently stored gamma, recalcualte theta
- inline void SetAlphaDegIC(SCALAR tt) { alpha=tt*DEG_TO_RAD; getTheta(); }
+ inline void SetAlphaDegIC(SCALAR tt) { alpha=tt*SGD_DEGREES_TO_RADIANS; getTheta(); }
inline void SetAlphaRadIC(SCALAR tt) { alpha=tt; getTheta(); }
//use currently stored gamma, recalcualte alpha
- inline void SetPitchAngleDegIC(SCALAR tt) { SetPitchAngleRadIC(tt*DEG_TO_RAD); }
+ inline void SetPitchAngleDegIC(SCALAR tt) { SetPitchAngleRadIC(tt*SGD_DEGREES_TO_RADIANS); }
void SetPitchAngleRadIC(SCALAR tt);
- inline void SetBetaDegIC(SCALAR tt) { beta=tt*DEG_TO_RAD; getTheta();}
+ inline void SetBetaDegIC(SCALAR tt) { beta=tt*SGD_DEGREES_TO_RADIANS; getTheta();}
inline void SetBetaRadIC(SCALAR tt) { beta=tt; getTheta(); }
- inline void SetRollAngleDegIC(SCALAR tt) { phi=tt*DEG_TO_RAD; getTheta(); }
+ inline void SetRollAngleDegIC(SCALAR tt) { phi=tt*SGD_DEGREES_TO_RADIANS; getTheta(); }
inline void SetRollAngleRadIC(SCALAR tt) { phi=tt; getTheta(); }
- inline void SetHeadingDegIC(SCALAR tt) { psi=tt*DEG_TO_RAD; }
+ inline void SetHeadingDegIC(SCALAR tt) { psi=tt*SGD_DEGREES_TO_RADIANS; }
inline void SetHeadingRadIC(SCALAR tt) { psi=tt; }
- inline void SetLatitudeGDDegIC(SCALAR tt) { SetLatitudeGDRadIC(tt*DEG_TO_RAD); }
+ inline void SetLatitudeGDDegIC(SCALAR tt) { SetLatitudeGDRadIC(tt*SGD_DEGREES_TO_RADIANS); }
void SetLatitudeGDRadIC(SCALAR tt);
- inline void SetLongitudeDegIC(SCALAR tt) { longitude=tt*DEG_TO_RAD; }
+ inline void SetLongitudeDegIC(SCALAR tt) { longitude=tt*SGD_DEGREES_TO_RADIANS; }
inline void SetLongitudeRadIC(SCALAR tt) { longitude=tt; }
void SetRunwayAltitudeFtIC(SCALAR tt);
inline SCALAR GetRunwayAltitudeFtIC(void) { return runway_altitude; }
- inline SCALAR GetFlightPathAngleDegIC(void) { return gamma*RAD_TO_DEG; }
+ inline SCALAR GetFlightPathAngleDegIC(void) { return gamma*SGD_RADIANS_TO_DEGREES; }
inline SCALAR GetFlightPathAngleRadIC(void) { return gamma; }
inline SCALAR GetClimbRateFpmIC(void) { return hdot*60; }
inline SCALAR GetClimbRateFpsIC(void) { return hdot; }
- inline SCALAR GetAlphaDegIC(void) { return alpha*RAD_TO_DEG; }
+ inline SCALAR GetAlphaDegIC(void) { return alpha*SGD_RADIANS_TO_DEGREES; }
inline SCALAR GetAlphaRadIC(void) { return alpha; }
- inline SCALAR GetPitchAngleDegIC(void) { return theta*RAD_TO_DEG; }
+ inline SCALAR GetPitchAngleDegIC(void) { return theta*SGD_RADIANS_TO_DEGREES; }
inline SCALAR GetPitchAngleRadIC(void) { return theta; }
- inline SCALAR GetBetaDegIC(void) { return beta*RAD_TO_DEG; }
- inline SCALAR GetBetaRadIC(void) { return beta*RAD_TO_DEG; }
+ inline SCALAR GetBetaDegIC(void) { return beta*SGD_RADIANS_TO_DEGREES; }
+ inline SCALAR GetBetaRadIC(void) { return beta*SGD_RADIANS_TO_DEGREES; }
- inline SCALAR GetRollAngleDegIC(void) { return phi*RAD_TO_DEG; }
+ inline SCALAR GetRollAngleDegIC(void) { return phi*SGD_RADIANS_TO_DEGREES; }
inline SCALAR GetRollAngleRadIC(void) { return phi; }
- inline SCALAR GetHeadingDegIC(void) { return psi*RAD_TO_DEG; }
+ inline SCALAR GetHeadingDegIC(void) { return psi*SGD_RADIANS_TO_DEGREES; }
inline SCALAR GetHeadingRadIC(void) { return psi; }
- inline SCALAR GetLatitudeGDDegIC(void) { return latitude_gd*RAD_TO_DEG; }
+ inline SCALAR GetLatitudeGDDegIC(void) { return latitude_gd*SGD_RADIANS_TO_DEGREES; }
inline SCALAR GetLatitudeGDRadIC(void) { return latitude_gd; }
- inline SCALAR GetLongitudeDegIC(void) { return longitude*RAD_TO_DEG; }
+ inline SCALAR GetLongitudeDegIC(void) { return longitude*SGD_RADIANS_TO_DEGREES; }
inline SCALAR GetLongitudeRadIC(void) { return longitude; }
inline SCALAR GetUBodyFpsIC(void) { return vt*cos(alpha)*cos(beta); }
double lat2, lon2, az2;
if ( speed > SG_EPSILON ) {
geo_direct_wgs_84 ( get_Altitude(),
- get_Latitude() * RAD_TO_DEG,
- get_Longitude() * RAD_TO_DEG,
- get_Psi() * RAD_TO_DEG,
+ get_Latitude() * SGD_RADIANS_TO_DEGREES,
+ get_Longitude() * SGD_RADIANS_TO_DEGREES,
+ get_Psi() * SGD_RADIANS_TO_DEGREES,
dist, &lat2, &lon2, &az2 );
- _set_Longitude( lon2 * DEG_TO_RAD );
- _set_Latitude( lat2 * DEG_TO_RAD );
+ _set_Longitude( lon2 * SGD_DEGREES_TO_RADIANS );
+ _set_Latitude( lat2 * SGD_DEGREES_TO_RADIANS );
}
- // cout << "lon error = " << fabs(end.x()*RAD_TO_DEG - lon2)
- // << " lat error = " << fabs(end.y()*RAD_TO_DEG - lat2)
+ // cout << "lon error = " << fabs(end.x()*SGD_RADIANS_TO_DEGREES - lon2)
+ // << " lat error = " << fabs(end.y()*SGD_RADIANS_TO_DEGREES - lat2)
// << endl;
double sl_radius, lat_geoc;
<< " tmp_alt = " << tmp_alt * METER_TO_FEET
<< " sl_radius1 = " << sl_radius1 * METER_TO_FEET
<< " sl_radius2 = " << sl_radius2 * METER_TO_FEET
- << " Equator = " << EQUATORIAL_RADIUS_FT );
+ << " Equator = " << SG_EQUATORIAL_RADIUS_FT );
_set_Geocentric_Position( lat_geoc, lon,
sl_radius2 * METER_TO_FEET + alt );
virtual void set_Altitude(double alt); // triggers re-calc of AGL altitude
virtual void set_AltitudeAGL(double altagl); // and vice-versa
virtual void set_Latitude_deg (double lat) {
- set_Latitude(lat * DEG_TO_RAD);
+ set_Latitude(lat * SGD_DEGREES_TO_RADIANS);
}
virtual void set_Longitude_deg (double lon) {
- set_Longitude(lon * DEG_TO_RAD);
+ set_Longitude(lon * SGD_DEGREES_TO_RADIANS);
}
// Speeds -- setting any of these will trigger a re-calc of the rest
virtual void set_Psi (double psi) {
set_Euler_Angles(get_Phi(), get_Theta(), psi);
}
- virtual void set_Phi_deg (double phi) { set_Phi(phi * DEG_TO_RAD); }
+ virtual void set_Phi_deg (double phi) { set_Phi(phi * SGD_DEGREES_TO_RADIANS); }
virtual void set_Theta_deg (double theta) {
- set_Theta(theta * DEG_TO_RAD);
+ set_Theta(theta * SGD_DEGREES_TO_RADIANS);
}
- virtual void set_Psi_deg (double psi) { set_Psi(psi * DEG_TO_RAD); }
+ virtual void set_Psi_deg (double psi) { set_Psi(psi * SGD_DEGREES_TO_RADIANS); }
// Flight Path
virtual void set_Climb_Rate( double roc);
inline double get_Altitude_AGL(void) const { return altitude_agl; }
inline double get_Latitude_deg () const {
- return get_Latitude() * RAD_TO_DEG;
+ return get_Latitude() * SGD_RADIANS_TO_DEGREES;
}
inline double get_Longitude_deg () const {
- return get_Longitude() * RAD_TO_DEG;
+ return get_Longitude() * SGD_RADIANS_TO_DEGREES;
}
// inline double * get_Euler_angles_v() { return euler_angles_v; }
inline double get_Phi() const { return euler_angles_v[0]; }
inline double get_Theta() const { return euler_angles_v[1]; }
inline double get_Psi() const { return euler_angles_v[2]; }
- inline double get_Phi_deg () const { return get_Phi() * RAD_TO_DEG; }
- inline double get_Theta_deg () const { return get_Theta() * RAD_TO_DEG; }
- inline double get_Psi_deg () const { return get_Psi() * RAD_TO_DEG; }
+ inline double get_Phi_deg () const { return get_Phi() * SGD_RADIANS_TO_DEGREES; }
+ inline double get_Theta_deg () const { return get_Theta() * SGD_RADIANS_TO_DEGREES; }
+ inline double get_Psi_deg () const { return get_Psi() * SGD_RADIANS_TO_DEGREES; }
// ========== Miscellaneous quantities ==========
// fgSetPosFromAirportID( AptId );
fgSetPosFromAirportIDandHdg( AptId,
cur_fdm_state->get_Psi() *
- RAD_TO_DEG);
+ SGD_RADIANS_TO_DEGREES);
BusyCursor(0);
fgReInitSubsystems();
BusyCursor(1);
viewDir = 270;
}
- globals->get_current_view()->set_goal_view_offset(viewDir*DEG_TO_RAD);
-// globals->get_current_view()->set_view_offset(viewDir*DEG_TO_RAD);
+ globals->get_current_view()->set_goal_view_offset(viewDir*SGD_DEGREES_TO_RADIANS);
+// globals->get_current_view()->set_view_offset(viewDir*SGD_DEGREES_TO_RADIANS);
}
// END: kludge
double
FGBFI::getLatitude ()
{
- return current_aircraft.fdm_state->get_Latitude() * RAD_TO_DEG;
+ return current_aircraft.fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES;
}
void
FGBFI::setLatitude (double latitude)
{
- current_aircraft.fdm_state->set_Latitude(latitude * DEG_TO_RAD);
+ current_aircraft.fdm_state->set_Latitude(latitude * SGD_DEGREES_TO_RADIANS);
}
double
FGBFI::getLongitude ()
{
- return current_aircraft.fdm_state->get_Longitude() * RAD_TO_DEG;
+ return current_aircraft.fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES;
}
void
FGBFI::setLongitude (double longitude)
{
- current_aircraft.fdm_state->set_Longitude(longitude * DEG_TO_RAD);
+ current_aircraft.fdm_state->set_Longitude(longitude * SGD_DEGREES_TO_RADIANS);
}
double
FGBFI::getHeading ()
{
- return current_aircraft.fdm_state->get_Psi() * RAD_TO_DEG;
+ return current_aircraft.fdm_state->get_Psi() * SGD_RADIANS_TO_DEGREES;
}
double
FGBFI::getHeadingMag ()
{
- return current_aircraft.fdm_state->get_Psi() * RAD_TO_DEG - getMagVar();
+ return current_aircraft.fdm_state->get_Psi() * SGD_RADIANS_TO_DEGREES - getMagVar();
}
{
FGInterface * fdm = current_aircraft.fdm_state;
fdm->set_Euler_Angles(fdm->get_Phi(), fdm->get_Theta(),
- heading * DEG_TO_RAD);
+ heading * SGD_DEGREES_TO_RADIANS);
}
double
FGBFI::getPitch ()
{
- return current_aircraft.fdm_state->get_Theta() * RAD_TO_DEG;
+ return current_aircraft.fdm_state->get_Theta() * SGD_RADIANS_TO_DEGREES;
}
FGBFI::setPitch (double pitch)
{
FGInterface * fdm = current_aircraft.fdm_state;
- fdm->set_Euler_Angles(fdm->get_Phi(), pitch * DEG_TO_RAD, fdm->get_Psi());
+ fdm->set_Euler_Angles(fdm->get_Phi(), pitch * SGD_DEGREES_TO_RADIANS, fdm->get_Psi());
}
double
FGBFI::getRoll ()
{
- return current_aircraft.fdm_state->get_Phi() * RAD_TO_DEG;
+ return current_aircraft.fdm_state->get_Phi() * SGD_RADIANS_TO_DEGREES;
}
FGBFI::setRoll (double roll)
{
FGInterface * fdm = current_aircraft.fdm_state;
- fdm->set_Euler_Angles(roll * DEG_TO_RAD, fdm->get_Theta(), fdm->get_Psi());
+ fdm->set_Euler_Angles(roll * SGD_DEGREES_TO_RADIANS, fdm->get_Theta(), fdm->get_Psi());
}
double
FGBFI::getMagVar ()
{
- return globals->get_mag()->get_magvar() * RAD_TO_DEG;
+ return globals->get_mag()->get_magvar() * SGD_RADIANS_TO_DEGREES;
}
double
FGBFI::getMagDip ()
{
- return globals->get_mag()->get_magdip() * RAD_TO_DEG;
+ return globals->get_mag()->get_magdip() * SGD_RADIANS_TO_DEGREES;
}
string id = fgGetString("/sim/startup/airport-id");
// set initial position from default or command line coordinates
- f->set_Longitude( fgGetDouble("/position/longitude") * DEG_TO_RAD );
- f->set_Latitude( fgGetDouble("/position/latitude") * DEG_TO_RAD );
+ f->set_Longitude( fgGetDouble("/position/longitude") * SGD_DEGREES_TO_RADIANS );
+ f->set_Latitude( fgGetDouble("/position/latitude") * SGD_DEGREES_TO_RADIANS );
FG_LOG( FG_GENERAL, FG_INFO,
"scenery.cur_elev = " << scenery.cur_elev );
f->set_Altitude( fgGetDouble("/position/altitude") );
FG_LOG( FG_GENERAL, FG_INFO,
"Initial position is: ("
- << (f->get_Longitude() * RAD_TO_DEG) << ", "
- << (f->get_Latitude() * RAD_TO_DEG) << ", "
+ << (f->get_Longitude() * SGD_RADIANS_TO_DEGREES) << ", "
+ << (f->get_Latitude() * SGD_RADIANS_TO_DEGREES) << ", "
<< (f->get_Altitude() * FEET_TO_METER) << ")" );
return true;
FG_LOG( FG_GENERAL, FG_INFO,
"Updated position (after elevation adj): ("
- << (cur_fdm_state->get_Latitude() * RAD_TO_DEG) << ", "
- << (cur_fdm_state->get_Longitude() * RAD_TO_DEG) << ", "
+ << (cur_fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES) << ", "
+ << (cur_fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES) << ", "
<< (cur_fdm_state->get_Altitude() * FEET_TO_METER) << ")" );
// We need to calculate a few sea_level_radius here so we can pass
// Initial Orientation
// cur_fdm_state->
-// set_Euler_Angles( fgGetDouble("/orientation/roll") * DEG_TO_RAD,
-// fgGetDouble("/orientation/pitch") * DEG_TO_RAD,
-// fgGetDouble("/orientation/heading") * DEG_TO_RAD );
+// set_Euler_Angles( fgGetDouble("/orientation/roll") * SGD_DEGREES_TO_RADIANS,
+// fgGetDouble("/orientation/pitch") * SGD_DEGREES_TO_RADIANS,
+// fgGetDouble("/orientation/heading") * SGD_DEGREES_TO_RADIANS );
// Initialize the event manager
global_events.Init();
FG_LOG( FG_GENERAL, FG_INFO,
"Updated position (after elevation adj): ("
- << (cur_fdm_state->get_Latitude() * RAD_TO_DEG) << ", "
- << (cur_fdm_state->get_Longitude() * RAD_TO_DEG) << ", "
+ << (cur_fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES) << ", "
+ << (cur_fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES) << ", "
<< (cur_fdm_state->get_Altitude() * FEET_TO_METER) << ")" );
// *ABCD* end of thing that I just stuck in that I should probably
// move
// Initial Orientation
// cur_fdm_state->
-// set_Euler_Angles( fgGetDouble("/orientation/roll") * DEG_TO_RAD,
-// fgGetDouble("/orientation/pitch") * DEG_TO_RAD,
-// fgGetDouble("/orientation/heading") * DEG_TO_RAD );
+// set_Euler_Angles( fgGetDouble("/orientation/roll") * SGD_DEGREES_TO_RADIANS,
+// fgGetDouble("/orientation/pitch") * SGD_DEGREES_TO_RADIANS,
+// fgGetDouble("/orientation/heading") * SGD_DEGREES_TO_RADIANS );
// Initialize view parameters
FGViewerRPH *pilot_view =
globals->set_freeze( ! globals->get_freeze() );
{
- SGBucket p( f->get_Longitude() * RAD_TO_DEG,
- f->get_Latitude() * RAD_TO_DEG );
+ SGBucket p( f->get_Longitude() * SGD_RADIANS_TO_DEGREES,
+ f->get_Latitude() * SGD_RADIANS_TO_DEGREES );
FGPath tile_path( globals->get_fg_root() );
tile_path.append( "Scenery" );
tile_path.append( p.gen_base_path() );
// printf position and attitude information
FG_LOG( FG_INPUT, FG_INFO,
- "Lon = " << f->get_Longitude() * RAD_TO_DEG
- << " Lat = " << f->get_Latitude() * RAD_TO_DEG
+ "Lon = " << f->get_Longitude() * SGD_RADIANS_TO_DEGREES
+ << " Lat = " << f->get_Latitude() * SGD_RADIANS_TO_DEGREES
<< " Altitude = " << f->get_Altitude() * FEET_TO_METER
);
FG_LOG( FG_INPUT, FG_INFO,
- "Heading = " << f->get_Psi() * RAD_TO_DEG
- << " Roll = " << f->get_Phi() * RAD_TO_DEG
- << " Pitch = " << f->get_Theta() * RAD_TO_DEG );
+ "Heading = " << f->get_Psi() * SGD_RADIANS_TO_DEGREES
+ << " Roll = " << f->get_Phi() * SGD_RADIANS_TO_DEGREES
+ << " Pitch = " << f->get_Theta() * SGD_RADIANS_TO_DEGREES );
FG_LOG( FG_INPUT, FG_INFO, tile_path.c_str());
}
return;
if ( global_tile_mgr.init() ) {
// Load the local scenery data
global_tile_mgr.update(
- cur_fdm_state->get_Longitude() * RAD_TO_DEG,
- cur_fdm_state->get_Latitude() * RAD_TO_DEG );
+ cur_fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES,
+ cur_fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES );
} else {
FG_LOG( FG_GENERAL, FG_ALERT,
"Error in Tile Manager initialization!" );
sgCopyVec3( wup, pilot_view->get_world_up() );
sgMat4 CXFM; // chase view + pilot offset xform
sgMakeRotMat4( CXFM,
- chase_view->get_view_offset() * RAD_TO_DEG -
- cur_fdm_state->get_Psi() * RAD_TO_DEG,
+ chase_view->get_view_offset() * SGD_RADIANS_TO_DEGREES -
+ cur_fdm_state->get_Psi() * SGD_RADIANS_TO_DEGREES,
wup );
sgVec3 npo; // new pilot offset after rotation
sgVec3 *pPO = PilotOffsetGet();
tmp -= SGD_2PI;
}
/* printf("Psi = %.2f, viewoffset = %.2f sunrot = %.2f rottosun = %.2f\n",
- FG_Psi * RAD_TO_DEG, current_view.view_offset * RAD_TO_DEG,
- -(l->sun_rotation+SGD_PI) * RAD_TO_DEG, tmp * RAD_TO_DEG); */
+ FG_Psi * SGD_RADIANS_TO_DEGREES, current_view.view_offset * SGD_RADIANS_TO_DEGREES,
+ -(l->sun_rotation+SGD_PI) * SGD_RADIANS_TO_DEGREES, tmp * SGD_RADIANS_TO_DEGREES); */
l->UpdateAdjFog();
// Update solar system
#endif
// see if we need to load any new scenery tiles
- global_tile_mgr.update( cur_fdm_state->get_Longitude() * RAD_TO_DEG,
- cur_fdm_state->get_Latitude() * RAD_TO_DEG );
+ global_tile_mgr.update( cur_fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES,
+ cur_fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES );
// Process/manage pending events
global_events.Process();
// Initialize time
FGPath zone( globals->get_fg_root() );
zone.append( "Timezone" );
- SGTime *t = new SGTime( fgGetDouble("/position/longitude") * DEG_TO_RAD,
- fgGetDouble("/position/latitude") * DEG_TO_RAD,
+ SGTime *t = new SGTime( fgGetDouble("/position/longitude") * SGD_DEGREES_TO_RADIANS,
+ fgGetDouble("/position/latitude") * SGD_DEGREES_TO_RADIANS,
zone.str() );
// Handle potential user specified time offsets
/* cout << endl << obj_filename << " " << obj_lat[objc] << " " << obj_lon[objc] << " " << obj_alt[objc] << endl;
int chj=getchar();*/
- obj_lon[objc] *=DEG_TO_RAD;
- obj_lat[objc] *=DEG_TO_RAD;
+ obj_lon[objc] *=SGD_DEGREES_TO_RADIANS;
+ obj_lat[objc] *=SGD_DEGREES_TO_RADIANS;
ship_pos[objc] = new ssgTransform;
if (fgGetString("/sim/flight-model") == "ada")
{
- obj_lon[0] = fdm->get_aux5()*DEG_TO_RAD;
- obj_lat[0] = fdm->get_aux6()*DEG_TO_RAD;
+ obj_lon[0] = fdm->get_aux5()*SGD_DEGREES_TO_RADIANS;
+ obj_lat[0] = fdm->get_aux6()*SGD_DEGREES_TO_RADIANS;
obj_alt[0] = fdm->get_aux7();
}
for (int m=0; m<=objc; m++)
{
- //cout << endl << obj_lat[m]*RAD_TO_DEG << " " << obj_lon[m]*RAD_TO_DEG << " " << obj_alt[m] << " " << objc << endl;
+ //cout << endl << obj_lat[m]*SGD_RADIANS_TO_DEGREES << " " << obj_lon[m]*SGD_RADIANS_TO_DEGREES << " " << obj_alt[m] << " " << objc << endl;
//int v=getchar();
//Geodetic to Geocentric angles for rotation
sgSetVec3( ship_up, 0.0, 0.0, 1.0); //north,yaw
sgMat4 sgROT_lon, sgROT_lat, sgROT_hdg;
- sgMakeRotMat4( sgROT_lon, obj_lon[m]*RAD_TO_DEG, ship_up );
- sgMakeRotMat4( sgROT_lat, 90-obj_latgc*RAD_TO_DEG, ship_rt );
+ sgMakeRotMat4( sgROT_lon, obj_lon[m]*SGD_RADIANS_TO_DEGREES, ship_up );
+ sgMakeRotMat4( sgROT_lat, 90-obj_latgc*SGD_RADIANS_TO_DEGREES, ship_rt );
sgMakeRotMat4( sgROT_hdg, 180.0, ship_up );
sgMat4 sgTUX;
} else if ( woffset == "CENTER" ) {
default_view_offset = 0.00;
} else {
- default_view_offset = atof( woffset.c_str() ) * DEG_TO_RAD;
+ default_view_offset = atof( woffset.c_str() ) * SGD_DEGREES_TO_RADIANS;
}
FGViewerRPH *pilot_view =
(FGViewerRPH *)globals->get_viewmgr()->get_view( 0 );
dir += 180;
if (dir >= 360)
dir -= 360;
- dir *= DEG_TO_RAD;
+ dir *= SGD_DEGREES_TO_RADIANS;
fgSetDouble("/environment/wind-north",
speed * cos(dir));
fgSetDouble("/environment/wind-east",
double FG_Phi = 0.00;
double FG_Theta = 0.00;
double FG_Psi = 0.00;
- // double FG_Latitude = 33.3528917 * DEG_TO_RAD;
+ // double FG_Latitude = 33.3528917 * SGD_DEGREES_TO_RADIANS;
double FG_Latitude = 0.0;
- // double FG_Longitude = -110.6642444 * DEG_TO_RAD;
- double FG_Longitude = 90.0 * DEG_TO_RAD;
+ // double FG_Longitude = -110.6642444 * SGD_DEGREES_TO_RADIANS;
+ double FG_Longitude = 90.0 * SGD_DEGREES_TO_RADIANS;
// double view_pos[] = {2936.3222, 1736.9243, 3689.5359, 1.0};
double view_pos[] = {0.0, 0.0, 0.0, 1.0};
// Make the world up rotation matrix
sgMakeRotMat4( UP,
- geod_view_pos[0] * RAD_TO_DEG,
+ geod_view_pos[0] * SGD_RADIANS_TO_DEGREES,
0.0,
- -geod_view_pos[1] * RAD_TO_DEG );
+ -geod_view_pos[1] * SGD_RADIANS_TO_DEGREES );
// use a clever observation into the nature of our tranformation
// matrix to grab the world_up vector
sgNegateVec3(world_down, world_up);
sgVectorProductVec3(surface_east, surface_south, world_down);
#else
- sgMakeRotMat4( TMP, SGD_PI_2 * RAD_TO_DEG, world_up );
+ sgMakeRotMat4( TMP, SGD_PI_2 * SGD_RADIANS_TO_DEGREES, world_up );
// cout << "sgMat4 TMP" << endl;
// print_sgMat4( TMP );
sgXformVec3(surface_east, surface_south, TMP);
sgVec3 rollvec;
sgSetVec3( rollvec, 0.0, 0.0, 1.0 );
sgMat4 PHI; // roll
- sgMakeRotMat4( PHI, rph[0] * RAD_TO_DEG, rollvec );
+ sgMakeRotMat4( PHI, rph[0] * SGD_RADIANS_TO_DEGREES, rollvec );
sgVec3 pitchvec;
sgSetVec3( pitchvec, 0.0, 1.0, 0.0 );
sgMat4 THETA; // pitch
- sgMakeRotMat4( THETA, rph[1] * RAD_TO_DEG, pitchvec );
+ sgMakeRotMat4( THETA, rph[1] * SGD_RADIANS_TO_DEGREES, pitchvec );
// ROT = PHI * THETA
sgMat4 ROT;
sgVec3 yawvec;
sgSetVec3( yawvec, 1.0, 0.0, 0.0 );
sgMat4 PSI; // heading
- sgMakeRotMat4( PSI, -rph[2] * RAD_TO_DEG, yawvec );
+ sgMakeRotMat4( PSI, -rph[2] * SGD_RADIANS_TO_DEGREES, yawvec );
// LOCAL = ROT * PSI
// sgMultMat4( LOCAL, ROT, PSI );
// print_sgMat4( LOCAL );
sgMakeRotMat4( UP,
- geod_view_pos[0] * RAD_TO_DEG,
+ geod_view_pos[0] * SGD_RADIANS_TO_DEGREES,
0.0,
- -geod_view_pos[1] * RAD_TO_DEG );
+ -geod_view_pos[1] * SGD_RADIANS_TO_DEGREES );
sgSetVec3( world_up, UP[0][0], UP[0][1], UP[0][2] );
// sgXformVec3( world_up, UP );
sgXformVec3( pilot_offset_world, pilot_offset_world, VIEWo );
// generate the view offset matrix
- sgMakeRotMat4( VIEW_OFFSET, view_offset * RAD_TO_DEG, view_up );
+ sgMakeRotMat4( VIEW_OFFSET, view_offset * SGD_RADIANS_TO_DEGREES, view_up );
// cout << "VIEW_OFFSET matrix" << endl;
// print_sgMat4( VIEW_OFFSET );
sgXformVec3( view_forward, forward, VIEW_OFFSET );
sgNegateVec3(world_down, world_up);
sgVectorProductVec3(surface_east, surface_south, world_down);
#else
- sgMakeRotMat4( TMP, SGD_PI_2 * RAD_TO_DEG, world_up );
+ sgMakeRotMat4( TMP, SGD_PI_2 * SGD_RADIANS_TO_DEGREES, world_up );
// cout << "sgMat4 TMP" << endl;
// print_sgMat4( TMP );
sgXformVec3(surface_east, surface_south, TMP);
// generate cartesian coordinates
Point3D geod, cart;
- geod = Point3D( i.loclon * DEG_TO_RAD, i.loclat * DEG_TO_RAD, i.gselev );
+ geod = Point3D( i.loclon * SGD_DEGREES_TO_RADIANS, i.loclat * SGD_DEGREES_TO_RADIANS, i.gselev );
cart = sgGeodToCart( geod );
i.x = cart.x();
i.y = cart.y();
} else {
i.has_gs = true;
- geod = Point3D( i.gslon * DEG_TO_RAD, i.gslat * DEG_TO_RAD, i.gselev );
+ geod = Point3D( i.gslon * SGD_DEGREES_TO_RADIANS, i.gslat * SGD_DEGREES_TO_RADIANS, i.gselev );
cart = sgGeodToCart( geod );
i.gs_x = cart.x();
i.gs_y = cart.y();
} else {
i.has_dme = true;
- geod = Point3D( i.dmelon * DEG_TO_RAD, i.dmelat * DEG_TO_RAD, i.gselev);
+ geod = Point3D( i.dmelon * SGD_DEGREES_TO_RADIANS, i.dmelat * SGD_DEGREES_TO_RADIANS, i.gselev);
cart = sgGeodToCart( geod );
i.dme_x = cart.x();
i.dme_y = cart.y();
elev = _elev;
type = _type;
- Point3D pos = sgGeodToCart(Point3D(lon * DEG_TO_RAD, lat * DEG_TO_RAD, 0));
+ Point3D pos = sgGeodToCart(Point3D(lon * SGD_DEGREES_TO_RADIANS, lat * SGD_DEGREES_TO_RADIANS, 0));
// cout << "pos = " << pos << endl;
x = pos.x();
y = pos.y();
beacon_list_iterator current = beacons.begin();
beacon_list_iterator last = beacons.end();
- Point3D aircraft = sgGeodToCart(Point3D(lon*DEG_TO_RAD, lat*DEG_TO_RAD, 0));
+ Point3D aircraft = sgGeodToCart(Point3D(lon*SGD_DEGREES_TO_RADIANS, lat*SGD_DEGREES_TO_RADIANS, 0));
double min_dist = 999999999.0;
// cout << "lat = " << n.lat << " lon = " << n.lon << " elev = "
// << n.elev << " JD = "
// << julian_date << endl;
- n.magvar = sgGetMagVar(n.lon * DEG_TO_RAD, n.lat * DEG_TO_RAD,
+ n.magvar = sgGetMagVar(n.lon * SGD_DEGREES_TO_RADIANS, n.lat * SGD_DEGREES_TO_RADIANS,
n.elev * FEET_TO_METER,
- julian_date) * RAD_TO_DEG;
+ julian_date) * SGD_RADIANS_TO_DEGREES;
// cout << "Default variation at " << n.lon << ',' << n.lat
// << " is " << var << endl;
#if 0
// cout << n.ident << " " << n.magvar << endl;
// generate cartesian coordinates
- Point3D geod( n.lon * DEG_TO_RAD, n.lat * DEG_TO_RAD, n.elev );
+ Point3D geod( n.lon * SGD_DEGREES_TO_RADIANS, n.lat * SGD_DEGREES_TO_RADIANS, n.elev );
Point3D cart = sgGeodToCart( geod );
n.x = cart.x();
n.y = cart.y();
t->getGmt()->tm_hour, t->getGmt()->tm_min, t->getGmt()->tm_sec );
char lat[20];
- double latd = cur_fdm_state->get_Latitude() * RAD_TO_DEG;
+ double latd = cur_fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES;
if ( latd < 0.0 ) {
latd *= -1.0;
dir = 'S';
sprintf( lat, "%02d%06.3f,%c", abs(deg), min, dir);
char lon[20];
- double lond = cur_fdm_state->get_Longitude() * RAD_TO_DEG;
+ double lond = cur_fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES;
if ( lond < 0.0 ) {
lond *= -1.0;
dir = 'W';
sprintf( speed, "%05.1f", cur_fdm_state->get_V_equiv_kts() );
char heading[10];
- sprintf( heading, "%05.1f", cur_fdm_state->get_Psi() * RAD_TO_DEG );
+ sprintf( heading, "%05.1f", cur_fdm_state->get_Psi() * SGD_RADIANS_TO_DEGREES );
char altitude_m[10];
sprintf( altitude_m, "%02d",
lat *= -1;
}
- cur_fdm_state->set_Latitude( lat * DEG_TO_RAD );
+ cur_fdm_state->set_Latitude( lat * SGD_DEGREES_TO_RADIANS );
FG_LOG( FG_IO, FG_INFO, " lat = " << lat );
// lon val
lon *= -1;
}
- cur_fdm_state->set_Longitude( lon * DEG_TO_RAD );
+ cur_fdm_state->set_Longitude( lon * SGD_DEGREES_TO_RADIANS );
FG_LOG( FG_IO, FG_INFO, " lon = " << lon );
#if 0
heading = atof( hdg_str.c_str() );
cur_fdm_state->set_Euler_Angles( cur_fdm_state->get_Phi(),
cur_fdm_state->get_Theta(),
- heading * DEG_TO_RAD );
+ heading * SGD_DEGREES_TO_RADIANS );
FG_LOG( FG_IO, FG_INFO, " heading = " << heading );
} else if ( sentence == "GPGGA" ) {
// time
lat *= -1;
}
- // cur_fdm_state->set_Latitude( lat * DEG_TO_RAD );
+ // cur_fdm_state->set_Latitude( lat * SGD_DEGREES_TO_RADIANS );
FG_LOG( FG_IO, FG_INFO, " lat = " << lat );
// lon val
lon *= -1;
}
- // cur_fdm_state->set_Longitude( lon * DEG_TO_RAD );
+ // cur_fdm_state->set_Longitude( lon * SGD_DEGREES_TO_RADIANS );
FG_LOG( FG_IO, FG_INFO, " lon = " << lon );
// junk
t->getGmt()->tm_hour, t->getGmt()->tm_min, t->getGmt()->tm_sec );
char lat[20];
- double latd = cur_fdm_state->get_Latitude() * RAD_TO_DEG;
+ double latd = cur_fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES;
if ( latd < 0.0 ) {
latd *= -1.0;
dir = 'S';
sprintf( lat, "%02d%06.3f,%c", abs(deg), min, dir);
char lon[20];
- double lond = cur_fdm_state->get_Longitude() * RAD_TO_DEG;
+ double lond = cur_fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES;
if ( lond < 0.0 ) {
lond *= -1.0;
dir = 'W';
sprintf( speed, "%05.1f", cur_fdm_state->get_V_equiv_kts() );
char heading[10];
- sprintf( heading, "%05.1f", cur_fdm_state->get_Psi() * RAD_TO_DEG );
+ sprintf( heading, "%05.1f", cur_fdm_state->get_Psi() * SGD_RADIANS_TO_DEGREES );
char altitude_m[10];
sprintf( altitude_m, "%02d",
lat *= -1;
}
- cur_fdm_state->set_Latitude( lat * DEG_TO_RAD );
+ cur_fdm_state->set_Latitude( lat * SGD_DEGREES_TO_RADIANS );
FG_LOG( FG_IO, FG_INFO, " lat = " << lat );
// lon val
lon *= -1;
}
- cur_fdm_state->set_Longitude( lon * DEG_TO_RAD );
+ cur_fdm_state->set_Longitude( lon * SGD_DEGREES_TO_RADIANS );
FG_LOG( FG_IO, FG_INFO, " lon = " << lon );
#if 0
heading = atof( hdg_str.c_str() );
cur_fdm_state->set_Euler_Angles( cur_fdm_state->get_Phi(),
cur_fdm_state->get_Theta(),
- heading * DEG_TO_RAD );
+ heading * SGD_DEGREES_TO_RADIANS );
FG_LOG( FG_IO, FG_INFO, " heading = " << heading );
} else if ( sentence == "PGRMZ" ) {
// altitude
t->getGmt()->tm_hour, t->getGmt()->tm_min, t->getGmt()->tm_sec );
char lat[20];
- double latd = cur_fdm_state->get_Latitude() * RAD_TO_DEG;
+ double latd = cur_fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES;
if ( latd < 0.0 ) {
latd *= -1.0;
dir = 'S';
sprintf( lat, "%02d%06.3f,%c", abs(deg), min, dir);
char lon[20];
- double lond = cur_fdm_state->get_Longitude() * RAD_TO_DEG;
+ double lond = cur_fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES;
if ( lond < 0.0 ) {
lond *= -1.0;
dir = 'W';
sprintf( speed, "%05.1f", cur_fdm_state->get_V_equiv_kts() );
char heading[10];
- sprintf( heading, "%05.1f", cur_fdm_state->get_Psi() * RAD_TO_DEG );
+ sprintf( heading, "%05.1f", cur_fdm_state->get_Psi() * SGD_RADIANS_TO_DEGREES );
char altitude_m[10];
sprintf( altitude_m, "%02d",
lat *= -1;
}
- cur_fdm_state->set_Latitude( lat * DEG_TO_RAD );
+ cur_fdm_state->set_Latitude( lat * SGD_DEGREES_TO_RADIANS );
FG_LOG( FG_IO, FG_INFO, " lat = " << lat );
// lon val
lon *= -1;
}
- cur_fdm_state->set_Longitude( lon * DEG_TO_RAD );
+ cur_fdm_state->set_Longitude( lon * SGD_DEGREES_TO_RADIANS );
FG_LOG( FG_IO, FG_INFO, " lon = " << lon );
#if 0
heading = atof( hdg_str.c_str() );
cur_fdm_state->set_Euler_Angles( cur_fdm_state->get_Phi(),
cur_fdm_state->get_Theta(),
- heading * DEG_TO_RAD );
+ heading * SGD_DEGREES_TO_RADIANS );
FG_LOG( FG_IO, FG_INFO, " heading = " << heading );
} else if ( sentence == "GPGGA" ) {
// time
lat *= -1;
}
- // cur_fdm_state->set_Latitude( lat * DEG_TO_RAD );
+ // cur_fdm_state->set_Latitude( lat * SGD_DEGREES_TO_RADIANS );
FG_LOG( FG_IO, FG_INFO, " lat = " << lat );
// lon val
lon *= -1;
}
- // cur_fdm_state->set_Longitude( lon * DEG_TO_RAD );
+ // cur_fdm_state->set_Longitude( lon * SGD_DEGREES_TO_RADIANS );
FG_LOG( FG_IO, FG_INFO, " lon = " << lon );
// junk
FGInterface *f = cur_fdm_state;
// get roll and pitch, convert to degrees
- double roll_deg = f->get_Phi() * RAD_TO_DEG;
+ double roll_deg = f->get_Phi() * SGD_RADIANS_TO_DEGREES;
while ( roll_deg <= -180.0 ) {
roll_deg += 360.0;
}
roll_deg -= 360.0;
}
- double pitch_deg = f->get_Theta() * RAD_TO_DEG;
+ double pitch_deg = f->get_Theta() * SGD_RADIANS_TO_DEGREES;
while ( pitch_deg <= -180.0 ) {
pitch_deg += 360.0;
}
FGInterface *f = cur_fdm_state;
// get roll and pitch, convert to degrees
- double roll_deg = f->get_Phi() * RAD_TO_DEG;
+ double roll_deg = f->get_Phi() * SGD_RADIANS_TO_DEGREES;
while ( roll_deg < -180.0 ) {
roll_deg += 360.0;
}
roll_deg -= 360.0;
}
- double pitch_deg = f->get_Theta() * RAD_TO_DEG;
+ double pitch_deg = f->get_Theta() * SGD_RADIANS_TO_DEGREES;
while ( pitch_deg < -180.0 ) {
pitch_deg += 360.0;
}
speed loss/gain in network-area...
*/
get_latitude(), get_longitude(), get_altitude(),
- get_speed(), get_roll()*RAD_TO_DEG,
- get_pitch()*RAD_TO_DEG, get_heading());
+ get_speed(), get_roll()*SGD_RADIANS_TO_DEGREES,
+ get_pitch()*SGD_RADIANS_TO_DEGREES, get_heading());
write( sock, fgd_txt, 56);
break;
pp = sgCartToPolar3d(cp);
- // tmplon = pp.lon() * RAD_TO_DEG;
- // tmplat = pp.lat() * RAD_TO_DEG;
+ // tmplon = pp.lon() * SGD_RADIANS_TO_DEGREES;
+ // tmplat = pp.lat() * SGD_RADIANS_TO_DEGREES;
// cout << tmplon << " " << tmplat << endl;
- pp.setx( fmod(RAD_TO_DEG * FG_TEX_CONSTANT * pp.x(), 11.0) );
- pp.sety( fmod(RAD_TO_DEG * FG_TEX_CONSTANT * pp.y(), 11.0) );
+ pp.setx( fmod(SGD_RADIANS_TO_DEGREES * FG_TEX_CONSTANT * pp.x(), 11.0) );
+ pp.sety( fmod(SGD_RADIANS_TO_DEGREES * FG_TEX_CONSTANT * pp.y(), 11.0) );
if ( pp.x() < 0.0 ) {
pp.setx( pp.x() + 11.0 );
double height = b.get_height();
double width = b.get_width();
- Point3D center = sgGeodToCart(Point3D(clon*DEG_TO_RAD,clat*DEG_TO_RAD,0.0));
+ Point3D center = sgGeodToCart(Point3D(clon*SGD_DEGREES_TO_RADIANS,clat*SGD_DEGREES_TO_RADIANS,0.0));
t->center = center;
// cout << "center = " << center << endl;;
Point3D rad[4];
int i;
for ( i = 0; i < 4; ++i ) {
- rad[i] = Point3D( geod[i].x() * DEG_TO_RAD, geod[i].y() * DEG_TO_RAD,
+ rad[i] = Point3D( geod[i].x() * SGD_DEGREES_TO_RADIANS, geod[i].y() * SGD_DEGREES_TO_RADIANS,
geod[i].z() );
}
lights_transform->setTransform( sgTrans );
// select which set of lights based on sun angle
- float sun_angle = cur_light_params.sun_angle * RAD_TO_DEG;
+ float sun_angle = cur_light_params.sun_angle * SGD_RADIANS_TO_DEGREES;
if ( sun_angle > 95 ) {
lights_brightness->select(0x04);
} else if ( sun_angle > 92 ) {
// FGInterface *f = current_aircraft.fdm_state;
// lonlat for this update
- // longitude = f->get_Longitude() * RAD_TO_DEG;
- // latitude = f->get_Latitude() * RAD_TO_DEG;
+ // longitude = f->get_Longitude() * SGD_RADIANS_TO_DEGREES;
+ // latitude = f->get_Latitude() * SGD_RADIANS_TO_DEGREES;
longitude = lon;
latitude = lat;
// FG_LOG( FG_TERRAIN, FG_DEBUG, "lon "<< lonlat[LON] <<
sgdVec3 tmp_abs_view_pos;
sgVec3 tmp_view_pos;
- Point3D geod_pos = Point3D( longitude * DEG_TO_RAD,
- latitude * DEG_TO_RAD,
+ Point3D geod_pos = Point3D( longitude * SGD_DEGREES_TO_RADIANS,
+ latitude * SGD_DEGREES_TO_RADIANS,
0.0);
Point3D tmp = sgGeodToCart( geod_pos );
scenery.center = tmp;
// calculate lighting parameters based on sun's relative angle to
// local up
- deg = sun_angle * RAD_TO_DEG;
+ deg = sun_angle * SGD_RADIANS_TO_DEGREES;
FG_LOG( FG_EVENT, FG_INFO, " Sun angle = " << deg );
ambient = ambient_tbl->interpolate( deg );
while ( rotation > SGD_2PI ) {
rotation -= SGD_2PI;
}
- rotation *= RAD_TO_DEG;
+ rotation *= SGD_RADIANS_TO_DEGREES;
// fgPrintf( FG_EVENT, FG_INFO,
// " View to sun difference in degrees = %.2f\n", rotation);
// next check if we are in a sunset/sunrise situation
- sun_angle_deg = sun_angle * RAD_TO_DEG;
+ sun_angle_deg = sun_angle * SGD_RADIANS_TO_DEGREES;
if ( (sun_angle_deg > 80.0) && (sun_angle_deg < 100.0) ) {
/* 0.0 - 0.6 */
param1[0] = (10.0 - fabs(90.0 - sun_angle_deg)) / 20.0;
l->moon_rotation = -acos(dot);
}
// cout << " Sky needs to rotate = " << angle << " rads = "
- // << angle * RAD_TO_DEG << " degrees." << endl;
+ // << angle * SGD_RADIANS_TO_DEGREES << " degrees." << endl;
}
l->sun_rotation = -acos(dot);
}
// cout << " Sky needs to rotate = " << angle << " rads = "
- // << angle * RAD_TO_DEG << " degrees." << endl;
+ // << angle * SGD_RADIANS_TO_DEGREES << " degrees." << endl;
}
void FGWeatherParse::getPosition(const unsigned int nr, sgVec2 pos) const
{
//set the position of the station
- sgSetVec2( pos, weather_station[nr].lat * DEG_TO_RAD, weather_station[nr].lon * DEG_TO_RAD );
+ sgSetVec2( pos, weather_station[nr].lat * SGD_DEGREES_TO_RADIANS, weather_station[nr].lon * SGD_DEGREES_TO_RADIANS );
}
cout << "lon = " << lon << " geod lat = " << lat;
double sl_radius, lat_geoc;
- sgGeodToGeoc( lat * DEG_TO_RAD, alt, &sl_radius, &lat_geoc );
- cout << " geoc lat = " << lat_geoc * RAD_TO_DEG << endl;
+ sgGeodToGeoc( lat * SGD_DEGREES_TO_RADIANS, alt, &sl_radius, &lat_geoc );
+ cout << " geoc lat = " << lat_geoc * SGD_RADIANS_TO_DEGREES << endl;
- Point3D pgd( lon * DEG_TO_RAD, lat * DEG_TO_RAD, 0.0 );
+ Point3D pgd( lon * SGD_DEGREES_TO_RADIANS, lat * SGD_DEGREES_TO_RADIANS, 0.0 );
Point3D pc = sgGeodToCart( pgd );
cout << " cartesian = " << pc << endl;
sgdMat4 GEOC_UP;
sgdVec3 geoc_up;
- sgdMakeRotMat4( GEOC_UP, lon, 0.0, -lat_geoc * RAD_TO_DEG );
+ sgdMakeRotMat4( GEOC_UP, lon, 0.0, -lat_geoc * SGD_RADIANS_TO_DEGREES );
sgdSetVec3( geoc_up, GEOC_UP[0][0], GEOC_UP[0][1], GEOC_UP[0][2] );
cout << " geoc up = " << geoc_up[0] << ", " << geoc_up[1] << ", "
<< geoc_up[2] << endl;