// $Id$
// (Log is kept at end of this file)
-
-#include <math.h>
-#include <errno.h>
+#include "Include/compiler.h"
+#ifdef FG_HAVE_STD_INCLUDES
+# include <cmath>
+# include <cerrno>
+#else
+# include <math.h>
+# include <errno.h>
+#endif
#include <Include/fg_constants.h>
#include <Math/fg_geodesy.hxx>
#include <Math/point3d.hxx>
+FG_USING_STD(cout);
// ONE_SECOND is pi/180/60/60, or about 100 feet at earths' equator
#define ONE_SECOND 4.848136811E-6
$Header$
$Log$
+Revision 1.5 1999/01/27 04:46:14 curt
+Portability tweaks by Bernie Bright.
+
Revision 1.4 1998/11/20 01:00:36 curt
Patch in fgGeoc2Geod() to avoid a floating explosion.
point3d.hxx include math.h for FreeBSD
// $Log$
+// Revision 1.5 1999/01/27 04:46:14 curt
+// Portability tweaks by Bernie Bright.
+//
// Revision 1.4 1998/11/20 01:00:36 curt
// Patch in fgGeoc2Geod() to avoid a floating explosion.
// point3d.hxx include math.h for FreeBSD
// a cartesian point
inline Point3D fgGeodToCart(const Point3D& geod) {
- Point3D cp;
- Point3D pp;
double gc_lon, gc_lat, sl_radius;
// printf("A geodetic point is (%.2f, %.2f, %.2f)\n",
// printf("A geocentric point is (%.2f, %.2f, %.2f)\n", gc_lon,
// gc_lat, sl_radius+geod[2]);
- pp = Point3D(gc_lon, gc_lat, sl_radius + geod.radius());
- cp = fgPolarToCart3d(pp);
-
- // printf("A cart point is (%.8f, %.8f, %.8f)\n", cp.x, cp.y, cp.z);
-
- return(cp);
+ Point3D pp = Point3D( gc_lon, gc_lat, sl_radius + geod.radius());
+ return fgPolarToCart3d(pp);
}
$Header$
$Log$
+Revision 1.4 1999/01/27 04:46:15 curt
+Portability tweaks by Bernie Bright.
+
Revision 1.3 1998/10/18 01:17:11 curt
Point3D tweaks.
// $Log$
+// Revision 1.4 1999/01/27 04:46:15 curt
+// Portability tweaks by Bernie Bright.
+//
// Revision 1.3 1998/10/18 01:17:11 curt
// Point3D tweaks.
//
// Constructor -- loads the interpolation table from the specified
// file
fgINTERPTABLE::fgINTERPTABLE( const string& file ) {
- string fgfile, line;
-
FG_LOG( FG_MATH, FG_INFO, "Initializing Interpolator for " << file );
fg_gzifstream in( file );
// $Log$
+// Revision 1.6 1999/01/27 04:46:16 curt
+// Portability tweaks by Bernie Bright.
+//
// Revision 1.5 1998/11/06 21:17:27 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
#include <string>
+#include "Include/compiler.h"
+FG_USING_STD(string);
#define MAX_TABLE_SIZE 32
// $Log$
+// Revision 1.4 1999/01/27 04:46:17 curt
+// Portability tweaks by Bernie Bright.
+//
// Revision 1.3 1998/11/06 21:17:28 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
# error This library requires C++
#endif
+#include "Include/compiler.h"
-#include <iostream>
-#include <assert.h>
-#if defined( __BORLANDC__ )
-# define exception c_exception
-#elif defined( __FreeBSD__ )
-# include <math.h>
+#ifdef FG_MATH_EXCEPTION_CLASH
+# define exception c_exception
#endif
+#ifdef FG_HAVE_STD_INCLUDES
+# include <iostream>
+# include <cassert>
+# include <cmath>
+#else
+# include <iostream.h>
+# include <assert.h>
+# include <math.h>
+#endif
+
+FG_USING_STD(ostream);
+FG_USING_STD(istream);
+
// -rp- assert.h is buggy under MWCWP3, as multiple #include undef assert !
#ifdef __MWERKS__
# define assert(x)
enum {PX, PY, PZ}; // axes
+// Kludge for msvc++ 6.0 - requires forward decls of friend functions.
+class Point3D;
+istream& operator>> ( istream&, Point3D& );
+ostream& operator<< ( ostream&, const Point3D& );
+Point3D operator- (const Point3D& p); // -p1
+bool operator== (const Point3D& a, const Point3D& b); // p1 == p2?
+
///////////////////////////
//
// $Log$
+// Revision 1.8 1999/01/27 04:46:18 curt
+// Portability tweaks by Bernie Bright.
+//
// Revision 1.7 1999/01/19 20:56:58 curt
// MacOS portability changes contributed by "Robert Puyol" <puyol@abvent.fr>
//
#include "polar3d.hxx"
-// Convert a polar coordinate to a cartesian coordinate. Lon and Lat
-// must be specified in radians. The FG convention is for distances
-// to be specified in meters
-Point3D fgPolarToCart3d(const Point3D& p) {
- Point3D pnew;
- double tmp;
-
- tmp = cos( p.lat() ) * p.radius();
-
- pnew = Point3D ( cos( p.lon() ) * tmp,
- sin( p.lon() ) * tmp,
- sin( p.lat() ) * p.radius() );
-
- return pnew;
-}
-
-
-// Convert a cartesian coordinate to polar coordinates (lon/lat
-// specified in radians. Distances are specified in meters.
-Point3D fgCartToPolar3d(const Point3D& cp) {
- Point3D pp;
-
- pp = Point3D( atan2( cp.y(), cp.x() ),
- FG_PI_2 -
- atan2( sqrt(cp.x()*cp.x() + cp.y()*cp.y()), cp.z() ),
- sqrt(cp.x()*cp.x() + cp.y()*cp.y() + cp.z()*cp.z()) );
-
- // printf("lon = %.2f lat = %.2f radius = %.2f\n",
- // pp.lon, pp.lat, pp.radius);
-
- return pp;
-}
-
-
// Find the Altitude above the Ellipsoid (WGS84) given the Earth
// Centered Cartesian coordinate vector Distances are specified in
// meters.
// $Log$
+// Revision 1.6 1999/01/27 04:46:19 curt
+// Portability tweaks by Bernie Bright.
+//
// Revision 1.5 1998/10/18 01:17:13 curt
// Point3D tweaks.
//
#include <Math/point3d.hxx>
+// Find the Altitude above the Ellipsoid (WGS84) given the Earth
+// Centered Cartesian coordinate vector Distances are specified in
+// meters.
+double fgGeodAltFromCart(const Point3D& cp);
+
+
// Convert a polar coordinate to a cartesian coordinate. Lon and Lat
// must be specified in radians. The FG convention is for distances
// to be specified in meters
-Point3D fgPolarToCart3d(const Point3D& p);
+inline Point3D fgPolarToCart3d(const Point3D& p) {
+ double tmp = cos( p.lat() ) * p.radius();
+
+ return Point3D( cos( p.lon() ) * tmp,
+ sin( p.lon() ) * tmp,
+ sin( p.lat() ) * p.radius() );
+}
// Convert a cartesian coordinate to polar coordinates (lon/lat
// specified in radians. Distances are specified in meters.
-Point3D fgCartToPolar3d(const Point3D& cp);
-
-
-// Find the Altitude above the Ellipsoid (WGS84) given the Earth
-// Centered Cartesian coordinate vector Distances are specified in
-// meters.
-double fgGeodAltFromCart(const Point3D& cp);
+inline Point3D fgCartToPolar3d(const Point3D& cp) {
+ return Point3D( atan2( cp.y(), cp.x() ),
+ FG_PI_2 -
+ atan2( sqrt(cp.x()*cp.x() + cp.y()*cp.y()), cp.z() ),
+ sqrt(cp.x()*cp.x() + cp.y()*cp.y() + cp.z()*cp.z()) );
+}
#endif // _POLAR_HXX
// $Log$
+// Revision 1.5 1999/01/27 04:46:20 curt
+// Portability tweaks by Bernie Bright.
+//
// Revision 1.4 1998/10/16 19:30:07 curt
// C++-ified the comments.
//