]> git.mxchange.org Git - flightgear.git/commitdiff
Point3D tweaks.
authorcurt <curt>
Sun, 18 Oct 1998 01:17:11 +0000 (01:17 +0000)
committercurt <curt>
Sun, 18 Oct 1998 01:17:11 +0000 (01:17 +0000)
Math/fg_geodesy.hxx
Math/point3d.hxx
Math/polar3d.cxx
Misc/strutils.cxx

index c4480d91df4f9befb9bf7d25775026a1fcc2314b..4f7fd26721493157cac6586c6f2544c94135dce7 100644 (file)
@@ -69,7 +69,7 @@ inline Point3D fgGeodToCart(const Point3D& geod) {
     // printf("A geocentric point is (%.2f, %.2f, %.2f)\n", gc_lon, 
     //        gc_lat, sl_radius+geod[2]);
 
-    pp.setvals(gc_lon, gc_lat, sl_radius + geod.radius());
+    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);
@@ -120,6 +120,9 @@ inline Point3D fgGeodToCart(const Point3D& geod) {
 
 $Header$
 $Log$
+Revision 1.3  1998/10/18 01:17:11  curt
+Point3D tweaks.
+
 Revision 1.2  1998/10/16 23:36:37  curt
 c++-ifying.
 
@@ -193,6 +196,9 @@ Initial Flight Gear revision.
 
 
 // $Log$
+// Revision 1.3  1998/10/18 01:17:11  curt
+// Point3D tweaks.
+//
 // Revision 1.2  1998/10/16 23:36:37  curt
 // c++-ifying.
 //
index ab30d94e74683a7cc723907f00143f92c13cda82..7e178350c329d4ce6de348f789bd12d9db193167 100644 (file)
 using namespace std;
 #endif
 
-/*
-#include <stdlib.h>
-#include <yvals.h>
-#include <math.h>
-*/
-
 #include <assert.h>
 
 #include <Include/fg_constants.h>
@@ -80,7 +74,7 @@ public:
     Point3D& operator -= ( const Point3D& p );  // decrementation by a Point3D
     Point3D& operator *= ( const double d );    // multiplication by a constant
     Point3D& operator /= ( const double d );    // division by a constant
-    void setvals(const double x, const double y, const double z);
+
     void setx(const double x);
     void sety(const double y);
     void setz(const double z);
@@ -115,6 +109,21 @@ public:
 };
 
 
+// output to stream
+inline ostream&
+operator << ( ostream& out, Point3D& p)
+{
+    double x, y, z;
+
+    x = p.x();
+    y = p.y();
+    z = p.z();
+
+    out << x << " " << y << " " << z;
+
+    return out;
+}
+
 // input from stream
 inline istream&
 operator >> ( istream& in, Point3D& p)
@@ -146,7 +155,7 @@ operator >> ( istream& in, Point3D& p)
        
     in >> z;
 
-    p.setvals(x, y, z);
+    p = Point3D(x, y, z);
 
     return in;
 }
@@ -204,10 +213,6 @@ inline Point3D& Point3D::operator /= ( const double d )
     return *this;
 }
 
-inline void Point3D::setvals(const double x, const double y, const double z) {
-    n[PX] = x; n[PY] = y; n[PZ] = z;
-}
-
 inline void Point3D::setx(const double x) {
     n[PX] = x;
 }
@@ -312,6 +317,9 @@ inline double distance3D(const Point3D& a, const Point3D& b)
 
 
 // $Log$
+// Revision 1.2  1998/10/18 01:17:12  curt
+// Point3D tweaks.
+//
 // Revision 1.1  1998/10/16 00:50:29  curt
 // Added point3d.hxx to replace cheezy fgPoint3d struct.
 //
index daaaffa8cff2f2cbecabe03bf5bfa6796afb6769..c0de1e0ffc5d0714c2040d71888b6e8beb9ada4b 100644 (file)
@@ -39,11 +39,11 @@ Point3D fgPolarToCart3d(const Point3D& p) {
 
     tmp = cos( p.lat() ) * p.radius();
 
-    pnew.setvals( cos( p.lon() ) * tmp,
-                 sin( p.lon() ) * tmp,
-                 sin( p.lat() ) * p.radius() );
+    pnew = Point3D ( cos( p.lon() ) * tmp,
+                    sin( p.lon() ) * tmp,
+                    sin( p.lat() ) * p.radius() );
 
-    return(pnew);
+    return pnew;
 }
 
 
@@ -52,14 +52,15 @@ Point3D fgPolarToCart3d(const Point3D& p) {
 Point3D fgCartToPolar3d(const Point3D& cp) {
     Point3D pp;
 
-    pp.setvals( 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()) );
+    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);
+    return pp;
 }
 
 
@@ -94,6 +95,9 @@ double fgGeodAltFromCart(const Point3D& cp)
 
 
 // $Log$
+// Revision 1.5  1998/10/18 01:17:13  curt
+// Point3D tweaks.
+//
 // Revision 1.4  1998/10/16 19:30:09  curt
 // C++-ified the comments.
 //
index 4c2f520e9fe7ceed75cb956109bb0e56b2c58664..2f23d83f4919601a30a8b13ed2686fabb3980734 100644 (file)
@@ -27,6 +27,8 @@
 
 #include "strutils.hxx"
 
+const string whitespace = " \n\r\t";
+
 //
 string
 trimleft( const string& s, const string& trimmings )
@@ -69,6 +71,9 @@ trim( const string& s, const string& trimmings )
 }
 
 // $Log$
+// Revision 1.2  1998/10/18 01:17:15  curt
+// Point3D tweaks.
+//
 // Revision 1.1  1998/09/01 19:06:30  curt
 // Initial revision.
 //