]> git.mxchange.org Git - flightgear.git/blobdiff - Tri2obj/tri2obj.c
tweaks.
[flightgear.git] / Tri2obj / tri2obj.c
index 4b12310de98b311cad46faecd695dd60050c53df..f5a1a09f15af57c037e768d6fd28daf48362f1cc 100644 (file)
 
 #include <Math/fg_geodesy.h>
 #include <Math/mat3.h>
-#include <Math/polar.h>
+#include <Math/polar3d.h>
 
 
 int nodecount, tricount;
 int normalcount = 0;
-static struct fgCartesianPoint nodes[MAX_NODES];
+static fgCartesianPoint3d nodes[MAX_NODES];
 static int tris[MAX_TRIS][3];
 
 static double normals[MAX_NODES][3];
 
-struct fgBUCKET my_index;
-struct fgBUCKET ne_index, nw_index, sw_index, se_index;
-struct fgBUCKET north_index, south_index, east_index, west_index;
+fgBUCKET my_index;
+fgBUCKET ne_index, nw_index, sw_index, se_index;
+fgBUCKET north_index, south_index, east_index, west_index;
 
 /* convert a geodetic point lon(arcsec), lat(arcsec), elev(meter) to
  * a cartesian point */
-struct fgCartesianPoint geod_to_cart(double geod[3]) {
-    struct fgCartesianPoint p;
+fgCartesianPoint3d geod_to_cart(double geod[3]) {
+    fgCartesianPoint3d cp;
+    fgPolarPoint3d pp;
     double gc_lon, gc_lat, sl_radius;
 
     /* printf("A geodetic point is (%.2f, %.2f, %.2f)\n", 
@@ -67,17 +68,20 @@ struct fgCartesianPoint geod_to_cart(double geod[3]) {
     /* printf("A geocentric point is (%.2f, %.2f, %.2f)\n", gc_lon, 
           gc_lat, sl_radius+geod[2]); */
 
-    p = fgPolarToCart(gc_lon, gc_lat, sl_radius+geod[2]);
+    pp.lon = gc_lon;
+    pp.lat = gc_lat;
+    pp.radius = sl_radius+geod[2];
+    cp = fgPolarToCart3d(pp);
     
-    /* printf("A cart point is (%.8f, %.8f, %.8f)\n", p.x, p.y, p.z); */
+    /* printf("A cart point is (%.8f, %.8f, %.8f)\n", cp.x, cp.y, cp.z); */
 
-    return(p);
+    return(cp);
 }
 
 
 /* given three points defining a triangle, calculate the normal */
-void calc_normal(struct fgCartesianPoint p1, struct fgCartesianPoint p2, 
-                struct fgCartesianPoint p3, double normal[3])
+void calc_normal(fgCartesianPoint3d p1, fgCartesianPoint3d p2, 
+                fgCartesianPoint3d p3, double normal[3])
 {
     double v1[3], v2[3];
     double temp;
@@ -513,7 +517,7 @@ void dump_obj(char *basename) {
     /* dump vertices */
     printf("  writing vertices\n");
     for ( i = 1; i <= nodecount; i++ ) {
-       fprintf(obj, "v %.2f %.2f %.2f\n", 
+       fprintf(obj, "v %.6f %.6f %.6f\n", 
                nodes[i].x, nodes[i].y, nodes[i].z);
     }
 
@@ -640,9 +644,18 @@ int main(int argc, char **argv) {
 
 
 /* $Log$
-/* Revision 1.14  1998/04/18 04:01:32  curt
-/* Now use libMath rather than having local copies of math routines.
+/* Revision 1.17  1998/07/04 00:56:40  curt
+/* typedef'd struct fgBUCKET.
 /*
+ * Revision 1.16  1998/05/23 15:20:41  curt
+ * Output more digits after the decimal place.
+ *
+ * Revision 1.15  1998/05/02 01:54:39  curt
+ * Converting to polar3d.h routines.
+ *
+ * Revision 1.14  1998/04/18 04:01:32  curt
+ * Now use libMath rather than having local copies of math routines.
+ *
  * Revision 1.13  1998/04/14 02:26:11  curt
  * Code reorganizations.  Added a Lib/ directory for more general libraries.
  *