From: curt Date: Wed, 11 Nov 1998 00:18:36 +0000 (+0000) Subject: Check for domain error in fgGeoctoGeod() X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2091bf21447bceb2a769f1da7f2368ed56486bbf;p=simgear.git Check for domain error in fgGeoctoGeod() --- diff --git a/Math/fg_geodesy.cxx b/Math/fg_geodesy.cxx index cbc24941..ac7fa9bb 100644 --- a/Math/fg_geodesy.cxx +++ b/Math/fg_geodesy.cxx @@ -10,6 +10,7 @@ #include +#include #include #include @@ -54,6 +55,13 @@ void fgGeocToGeod( double lat_geoc, double radius, double r_alpha = x_alpha/cos(lat_geoc); l_point = radius - r_alpha; *alt = l_point*cos(delt_lambda); + + // check for domain error + if ( errno == EDOM ) { + cout << "Domain ERROR in fgGeocToGeod!!!!\n"; + *alt = 0.0; + } + denom = sqrt(1-EPS*EPS*sin_mu_a*sin_mu_a); rho_alpha = EQUATORIAL_RADIUS_M*(1-EPS)/ (denom*denom*denom); @@ -63,7 +71,14 @@ void fgGeocToGeod( double lat_geoc, double radius, double sin_lambda_sl = sin( lambda_sl ); *sea_level_r = sqrt(RESQ_M / (1 + ((1/(E*E))-1)*sin_lambda_sl*sin_lambda_sl)); + + // check for domain error + if ( errno == EDOM ) { + cout << "Domain ERROR in fgGeocToGeod!!!!\n"; + *sea_level_r = 0.0; + } } + } @@ -139,6 +154,9 @@ void fgGeodToGeoc( double lat_geod, double alt, double *sl_radius, $Header$ $Log$ +Revision 1.3 1998/11/11 00:18:36 curt +Check for domain error in fgGeoctoGeod() + Revision 1.2 1998/10/16 23:36:36 curt c++-ifying. @@ -218,6 +236,9 @@ Initial Flight Gear revision. // $Log$ +// Revision 1.3 1998/11/11 00:18:36 curt +// Check for domain error in fgGeoctoGeod() +// // Revision 1.2 1998/10/16 23:36:36 curt // c++-ifying. // diff --git a/Math/point3d.hxx b/Math/point3d.hxx index a3c9eea3..ba43a8c0 100644 --- a/Math/point3d.hxx +++ b/Math/point3d.hxx @@ -133,7 +133,7 @@ operator >> ( istream& in, Point3D& p) inline ostream& operator<< ( ostream& out, const Point3D& p ) { - return out << p.n[PX] << ',' << p.n[PY] << ',' << p.n[PZ]; + return out << p.n[PX] << ", " << p.n[PY] << ", " << p.n[PZ]; } /////////////////////////// @@ -293,6 +293,9 @@ Point3D::distance3D(const Point3D& a ) const // $Log$ +// Revision 1.4 1998/11/11 00:18:38 curt +// Check for domain error in fgGeoctoGeod() +// // Revision 1.3 1998/10/20 18:21:49 curt // Tweaks from Bernie Bright. //