]> git.mxchange.org Git - simgear.git/blobdiff - Math/polar.c
Working on redoing internal coordinate systems & scenery transformations.
[simgear.git] / Math / polar.c
index cbbed7494c69f2f83c4b3603b3e95e939d46f2fe..bcd9928a6267dc8fc24f9e8d159659f6ba475cd6 100644 (file)
 static double st, ct, sp, cp;
 
 
-/* Convert a geodetic coordinate to a cartesian coordinat on the unit
- * circle, scaled by the radius of the earth in meters.  Ignores Altitude,
- * since this is just for translating points around on the surface. */
-struct fgCartesianPoint fgGeodetic2Cartesian(double lon, double lat) {
+/* 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 */
+struct fgCartesianPoint fgPolarToCart(double lon, double lat, double radius) {
     struct fgCartesianPoint pnew;
 
-    pnew.x = cos(lon) * cos(lat) * EARTH_RAD;
-    pnew.y = sin(lon) * cos(lat) * EARTH_RAD;
-    pnew.z = sin(lat) * EARTH_RAD;
+    pnew.x = cos(lon) * cos(lat) * radius;
+    pnew.y = sin(lon) * cos(lat) * radius;
+    pnew.z = sin(lat) * radius;
 
     return(pnew);
 }
@@ -101,6 +101,9 @@ struct fgCartesianPoint fgRotateCartesianPoint(struct fgCartesianPoint p) {
 
 
 /* $Log$
-/* Revision 1.1  1997/07/07 21:02:36  curt
-/* Initial revision.
-/* */
+/* Revision 1.2  1997/07/31 22:52:27  curt
+/* Working on redoing internal coordinate systems & scenery transformations.
+/*
+ * Revision 1.1  1997/07/07 21:02:36  curt
+ * Initial revision.
+ * */