Index: /trunk/psLib/test/astro/tst_psCoord01.c
===================================================================
--- /trunk/psLib/test/astro/tst_psCoord01.c	(revision 5558)
+++ /trunk/psLib/test/astro/tst_psCoord01.c	(revision 5559)
@@ -6,6 +6,6 @@
 *    @author Eric Van Alst, MHPCC
 *
-*    @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
-*    @date  $Date: 2005-09-22 22:24:58 $
+*    @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
+*    @date  $Date: 2005-11-21 19:53:01 $
 *
 *    Copyright 2005 Maui High Performance Computing Center, Univ. of Hawaii
@@ -30,4 +30,5 @@
 static psS32 testGetOffsetSphere(void);
 static psS32 testGetOffsetLinear(void);
+static psS32 testProjectTanDeProjectTan(void);
 
 testDescription tests[] = {
@@ -47,4 +48,5 @@
                               {testGetOffsetSphere, 0000, "psSphereGetOffset",0,false},
                               {testGetOffsetLinear, 0000, "psSphereGetOffset",0,false},
+                              {testProjectTanDeProjectTan, 0000, "psProject(TAN) -> psDeproject(TAN)",0,false},
                               {NULL}
                           };
@@ -198,9 +200,10 @@
     return 0;
 }
-
+//HEY
 psS32 testProjectTan(void)
 {
     psPlane*       out = NULL;
     psSphere*      in = psSphereAlloc();
+    psSphere*      inTest = NULL;
     psProjection*  myProjection = psProjectionAlloc(0.0,0.0,1.0,1.0,PS_PROJ_TAN);
 
@@ -218,4 +221,5 @@
         // Perform projection
         out = psProject(in, myProjection);
+        inTest = psDeproject(out, myProjection);
 
         // Verify output not NULL
@@ -236,4 +240,16 @@
             return i*10+2;
         }
+
+        // Verify output is as expected
+        if(fabs(in->r - inTest->r) > ERROR_TOL) {
+            printf("TEST ER (in->r, inTest->r) (%.2f %.2f)\n", in->r, inTest->r);
+            return i*10+1;
+        }
+        if(fabs(in->d - inTest->d) > ERROR_TOL) {
+            printf("TEST ERROR: (in->d, inTest->d) (%.2f %.2f)\n", in->d, inTest->d);
+            return i*10+1;
+        }
+
+        psFree(inTest);
         psFree(out);
     }
@@ -916,3 +932,50 @@
 }
 
-
+#define DEG_INC2 15.0
+#define VERBOSE 0
+psS32 testProjectTanDeProjectTan()
+{
+    psS32 rc = 0;
+    //
+    // I'm not convinced that the p_psProject() and p_psDeproject() functions work
+    // correctly.  If we project a set of coordinates over a wide range of (R, D)
+    // values, then deproject them, the original (R, D) values are only produced
+    // when D is larger than 0.  This code demonstrates that.
+    //
+    psProjection *tmpProj = psProjectionAlloc(0.0,0.0,10.0,10.0,PS_PROJ_TAN);
+    if (1) { //HEY
+        psPlane planeCoord01;
+        psSphere skyCoord01;
+        psSphere skyCoord02;
+        for (psF32 R = -90.0 ; R <= 90.0 ; R+= DEG_INC2) {
+            for (psF32 D = -90.0 ; D <= 90.0 ; D+= DEG_INC2) {
+                if ((fabs(R) != 90.0) && (fabs(D) != 90.0)) {
+                    skyCoord01.r = DEG_TO_RAD(R);
+                    skyCoord01.d = DEG_TO_RAD(D);
+                    p_psProject(&planeCoord01, &skyCoord01, tmpProj);
+                    p_psDeproject(&skyCoord02, &planeCoord01, tmpProj);
+                    if ((fabs(skyCoord01.r - skyCoord02.r) < FLT_EPSILON) &&
+                            (fabs(skyCoord01.d - skyCoord02.d) < FLT_EPSILON)) {
+                        if (VERBOSE) {
+                            printf("CORRECT: (%.2fr %.2fd) (%.2fr %.2fd) -> (%.2f %.2f) -> (%.2fr %.2fd)\n", R, D,
+                                   skyCoord01.r, skyCoord01.d,
+                                   planeCoord01.x, planeCoord01.y,
+                                   skyCoord02.r, skyCoord02.d);
+                        }
+                        rc = 1;
+                    } else {
+                        printf("TEST ERROR: (%.2fr %.2fd) (%.2fr %.2fd) -> (%.2f %.2f) -> (%.2fr %.2fd)\n", R, D,
+                               skyCoord01.r, skyCoord01.d,
+                               planeCoord01.x, planeCoord01.y,
+                               skyCoord02.r, skyCoord02.d);
+                        rc = 1;
+                    }
+                }
+            }
+        }
+    }
+    return(rc);
+}
+
+
+
