Index: trunk/psLib/test/astronomy/tst_psCoord.c
===================================================================
--- trunk/psLib/test/astronomy/tst_psCoord.c	(revision 4422)
+++ trunk/psLib/test/astronomy/tst_psCoord.c	(revision 4541)
@@ -6,6 +6,6 @@
 *  @author GLG, MHPCC
 *
-*  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-06-29 00:43:46 $
+*  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-07-12 19:27:28 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -14,35 +14,35 @@
 #include "psTest.h"
 #include "pslib_strict.h"
-static psS32 testSphereTransformAlloc(void);
+static psS32 testSphereRotAlloc(void);
 static psS32 testPlaneTransformAlloc(void);
 static psS32 testPlaneDistortAlloc(void);
 static psS32 testPlaneTransformApply(void);
 static psS32 testPlaneDistortApply(void);
-static psS32 testSphereTransformApply1(void);
-static psS32 testSphereTransformApply2(void);
-static psS32 testSphereTransformApply3(void);
-static psS32 testSphereTransformApply4(void);
-static psS32 testSphereTransformApply5(void);
-static psS32 testSphereTransformICRSToEcliptic(void);
-static psS32 testSphereTransformEclipticToICRS(void);
-static psS32 testSphereTransformICRSToGalactic(void);
-static psS32 testSphereTransformGalacticToICRS(void);
-static psS32 testSphereTransformPrecess(void);
+static psS32 testSphereRotApply1(void);
+static psS32 testSphereRotApply2(void);
+static psS32 testSphereRotApply3(void);
+static psS32 testSphereRotApply4(void);
+static psS32 testSphereRotApply5(void);
+static psS32 testSphereRotICRSToEcliptic(void);
+static psS32 testSphereRotEclipticToICRS(void);
+static psS32 testSphereRotICRSToGalactic(void);
+static psS32 testSphereRotGalacticToICRS(void);
+static psS32 testSphereRotPrecess(void);
 testDescription tests[] = {
-                              {testSphereTransformAlloc, 819, "psSphereTransformAlloc()", 0, false},
+                              {testSphereRotAlloc, 819, "psSphereRotAlloc()", 0, false},
                               {testPlaneTransformAlloc, 826, "psPlaneTransformAlloc()", 0, false},
                               {testPlaneDistortAlloc, 827, "psPlaneDistortAlloc()", 0, false},
                               {testPlaneTransformApply, 831, "psPlaneTransformApply()", 0, false},
                               {testPlaneDistortApply, 832, "psPlaneDistortApply()", 0, false},
-                              {testSphereTransformApply1, 820, "psSphereTransformApply()", 0, false},
-                              {testSphereTransformApply2, 820, "psSphereTransformApply()", 0, false},
-                              {testSphereTransformApply3, 820, "psSphereTransformApply()", 0, false},
-                              {testSphereTransformApply4, 820, "psSphereTransformApply()", 0, false},
-                              {testSphereTransformApply5, 820, "psSphereTransformApply()", 0, false},
-                              {testSphereTransformICRSToEcliptic, 821, "psSphereTransformICRSToEcliptic()", 0, false},
-                              {testSphereTransformEclipticToICRS, 822, "psSphereTransformEclipticToICRS()", 0, false},
-                              {testSphereTransformICRSToGalactic, 824, "psSphereTransformICRSToGalactic()", 0, false},
-                              {testSphereTransformGalacticToICRS, 823, "psSphereTransformGalacticToICRS()", 0, false},
-                              {testSphereTransformPrecess, 825, "psSphereTransformPrecess()", 0, false},
+                              {testSphereRotApply1, 820, "psSphereRotApply()", 0, false},
+                              {testSphereRotApply2, 820, "psSphereRotApply()", 0, false},
+                              {testSphereRotApply3, 820, "psSphereRotApply()", 0, false},
+                              {testSphereRotApply4, 820, "psSphereRotApply()", 0, false},
+                              {testSphereRotApply5, 820, "psSphereRotApply()", 0, false},
+                              {testSphereRotICRSToEcliptic, 821, "psSphereRotICRSToEcliptic()", 0, false},
+                              {testSphereRotEclipticToICRS, 822, "psSphereRotEclipticToICRS()", 0, false},
+                              {testSphereRotICRSToGalactic, 824, "psSphereRotICRSToGalactic()", 0, false},
+                              {testSphereRotGalacticToICRS, 823, "psSphereRotGalacticToICRS()", 0, false},
+                              {testSphereRotPrecess, 825, "psSphereRotPrecess()", 0, false},
                               {NULL}
                           };
@@ -67,8 +67,9 @@
 #define PHI_P 3.0
 
-psS32 testSphereTransformAlloc( void )
+psS32 testSphereRotAlloc( void )
 {
     // Allocate data structure
-    psSphereTransform *myST = psSphereTransformAlloc(ALPHA_P, DELTA_P, PHI_P);
+    psSphereRot* myST = psSphereRotAlloc(ALPHA_P, DELTA_P, PHI_P);
+
     // Verify null not returned
     if(myST == NULL) {
@@ -77,25 +78,29 @@
     }
     // Verify sin member is updated
-    psF32 sinDeltaP = sin(DELTA_P);
-    if (FLT_EPSILON < fabs(sinDeltaP - myST->sinDeltaP)) {
-        psError(PS_ERR_UNKNOWN,true,"myST->sinDeltaP is %f, should be %f\n", myST->sinDeltaP, sinDeltaP);
+    double vx = cos(DELTA_P)*cos(ALPHA_P);
+    double vy = cos(DELTA_P)*sin(ALPHA_P);
+    double vz = sin(DELTA_P);
+    double q0 = vx * sin(PHI_P/2.0);
+    double q1 = vy * sin(PHI_P/2.0);
+    double q2 = vz * sin(PHI_P/2.0);
+    double q3 = cos(PHI_P/2.0);
+
+    if (FLT_EPSILON < fabs(q0 - myST->q0)) {
+        psError(PS_ERR_UNKNOWN,true,"myST->q0 is %f, should be %f\n", myST->q0, q0);
         return 2;
     }
-    // Verify cos member is update
-    psF32 cosDeltaP = cos(DELTA_P);
-    if (FLT_EPSILON < fabs(cosDeltaP - myST->cosDeltaP)) {
-        psError(PS_ERR_UNKNOWN,true,"myST->cosDeltaP is %f, should be %f\n", myST->cosDeltaP, cosDeltaP);
+    if (FLT_EPSILON < fabs(q1 - myST->q1)) {
+        psError(PS_ERR_UNKNOWN,true,"myST->q1 is %f, should be %f\n", myST->q1, q1);
         return 3;
     }
-    // Verify alpha is updated
-    if (FLT_EPSILON < fabs(ALPHA_P - myST->alphaP)) {
-        psError(PS_ERR_UNKNOWN,true,"myST->alphaP is %f, should be %f\n", myST->alphaP, ALPHA_P);
+    if (FLT_EPSILON < fabs(q2 - myST->q2)) {
+        psError(PS_ERR_UNKNOWN,true,"myST->q2 is %f, should be %f\n", myST->q2, q2);
         return 4;
     }
-    // Verify phi is updated
-    if (FLT_EPSILON < fabs(PHI_P - myST->phiP)) {
-        psError(PS_ERR_UNKNOWN,true,"myST->phiP is %f, should be %f\n", myST->phiP, PHI_P);
+    if (FLT_EPSILON < fabs(q3 - myST->q3)) {
+        psError(PS_ERR_UNKNOWN,true,"myST->q0 is %f, should be %f\n", myST->q3, q3);
         return 5;
     }
+
     // Free data structure
     psFree(myST);
@@ -441,5 +446,5 @@
 
 // We do a simple identity transformation on a few RA, DEC pairs.
-psS32 testSphereTransformApply1( void )
+psS32 testSphereRotApply1( void )
 {
     psSphere *in = psSphereAlloc();
@@ -447,5 +452,5 @@
     psSphere *temp = NULL;
     psSphere *rc = NULL;
-    psSphereTransform *myST = psSphereTransformAlloc(0.0, 0.0, 0.0);
+    psSphereRot *myST = psSphereRotAlloc(0.0, 0.0, 0.0);
 
     for (float r=0.0;r<180.0;r+=DEG_INC) {
@@ -456,5 +461,5 @@
             in->dErr = 0.0;
 
-            if(psSphereTransformApply(out, myST, in) != out) {
+            if(psSphereRotApply(out, myST, in) != out) {
                 psError(PS_ERR_UNKNOWN,true,"Did not return output pointer.");
                 return 1;
@@ -472,5 +477,5 @@
 
     // Verify new sphere object is created if out parameter NULL
-    temp = psSphereTransformApply(NULL, myST, in);
+    temp = psSphereRotApply(NULL, myST, in);
     if ( temp == NULL) {
         psError(PS_ERR_UNKNOWN,true,"Returned NULL when out parameter was null");
@@ -481,7 +486,7 @@
     // Verify NULL returned if transform structure null
     psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error");
-    rc = psSphereTransformApply(NULL, NULL, in);
+    rc = psSphereRotApply(NULL, NULL, in);
     if (rc != NULL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply() did not return NULL.");
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply() did not return NULL.");
         return 5;
     }
@@ -489,7 +494,7 @@
     // Verify NULL returned when input sphere is NULL
     psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error");
-    rc = psSphereTransformApply(NULL, myST, NULL);
+    rc = psSphereRotApply(NULL, myST, NULL);
     if (rc != NULL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply() did not return NULL");
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply() did not return NULL");
         return 6;
     }
@@ -503,6 +508,6 @@
 
 /******************************************************************************
-testSphereTransformApply2(): This test verifies that psSphereTransformApply()
-works properly.  We create two psSphereTransforms: a forward transform and a
+testSphereRotApply2(): This test verifies that psSphereRotApply()
+works properly.  We create two psSphereRots: a forward transform and a
 reverse transform (which is the mathematical inverse of the forward transform).
 We apply both transforms to several spherical coordinates and ensure that the
@@ -512,9 +517,9 @@
 test them both concurrently failed.  Determine why this is.  Are the following
 spherical transforms not mathematical inverses?
-    psSphereTransformAlloc(X, Y, 0.0)
-    psSphereTransformAlloc(-X, -Y, 0.0)
+    psSphereRotAlloc(X, Y, 0.0)
+    psSphereRotAlloc(-X, -Y, 0.0)
  *****************************************************************************/
 #define ERROR_PERCENT 0.01
-psS32 testSphereTransformApply2( void )
+psS32 testSphereRotApply2( void )
 {
     psS32 testStatus = 0;
@@ -522,14 +527,14 @@
     psSphere out;
     psSphere out2;
-    psSphereTransform *mySphereTransformForward = NULL;
-    psSphereTransform *mySphereTransformReverse = NULL;
-
-
-    mySphereTransformForward = psSphereTransformAlloc(DEG_TO_RAD(22.0),
-                               0.0,
-                               0.0);
-    mySphereTransformReverse = psSphereTransformAlloc(DEG_TO_RAD(-22.0),
-                               0.0,
-                               0.0);
+    psSphereRot *mySphereRotForward = NULL;
+    psSphereRot *mySphereRotReverse = NULL;
+
+
+    mySphereRotForward = psSphereRotAlloc(DEG_TO_RAD(22.0),
+                                          0.0,
+                                          0.0);
+    mySphereRotReverse = psSphereRotAlloc(DEG_TO_RAD(-22.0),
+                                          0.0,
+                                          0.0);
 
     for (float r=0.1;r<180.0;r+=(DEG_INC/5.0)) {
@@ -540,6 +545,6 @@
             in.dErr = 0.0;
 
-            psSphereTransformApply(&out, mySphereTransformForward, &in);
-            psSphereTransformApply(&out2, mySphereTransformReverse, &out);
+            psSphereRotApply(&out, mySphereRotForward, &in);
+            psSphereRotApply(&out2, mySphereRotReverse, &out);
 
             if ((fabs((in.r - out2.r) / in.r) > ERROR_PERCENT) ||
@@ -552,13 +557,13 @@
         }
     }
-    psFree(mySphereTransformForward);
-    psFree(mySphereTransformReverse);
-
-    mySphereTransformForward = psSphereTransformAlloc(0.0,
-                               DEG_TO_RAD(33.0),
-                               0.0);
-    mySphereTransformReverse = psSphereTransformAlloc(0.0,
-                               DEG_TO_RAD(-33.0),
-                               0.0);
+    psFree(mySphereRotForward);
+    psFree(mySphereRotReverse);
+
+    mySphereRotForward = psSphereRotAlloc(0.0,
+                                          DEG_TO_RAD(33.0),
+                                          0.0);
+    mySphereRotReverse = psSphereRotAlloc(0.0,
+                                          DEG_TO_RAD(-33.0),
+                                          0.0);
     for (float r=0.1;r<180.0;r+=(DEG_INC/5.0)) {
         for (float d=0.1;d<90.0;d+=(DEG_INC/5.0)) {
@@ -568,6 +573,6 @@
             in.dErr = 0.0;
 
-            psSphereTransformApply(&out, mySphereTransformForward, &in);
-            psSphereTransformApply(&out2, mySphereTransformReverse, &out);
+            psSphereRotApply(&out, mySphereRotForward, &in);
+            psSphereRotApply(&out2, mySphereRotReverse, &out);
 
             if ((fabs((in.r - out2.r) / in.r) > ERROR_PERCENT) ||
@@ -580,6 +585,6 @@
         }
     }
-    psFree(mySphereTransformForward);
-    psFree(mySphereTransformReverse);
+    psFree(mySphereRotForward);
+    psFree(mySphereRotReverse);
 
     return(testStatus);
@@ -613,8 +618,8 @@
 #define SPHERE_COORD_TP3_INVERSE_D       0.523599       // 30.0       degrees
 
-psS32 testSphereTransformApply3( void)
-{
-
-    psSphereTransform*  testTransform;
+psS32 testSphereRotApply3( void)
+{
+
+    psSphereRot*  testTransform;
     psSphere*           inputCoord = psSphereAlloc();
     psSphere*           outputCoord = NULL;
@@ -630,20 +635,20 @@
 
     // Create transform ICRS to Galactic
-    testTransform = psSphereTransformICRSToGalactic();
+    testTransform = psSphereRotICRSToGalactic();
 
     // Perform transform from ICRS to Galactic
-    outputCoord = psSphereTransformApply(outputCoord,testTransform,inputCoord);
+    outputCoord = psSphereRotApply(outputCoord,testTransform,inputCoord);
     // Verify output not NULL and member values set correctly
     if(outputCoord == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply returned NULL");
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
         return 1;
     }
     if(fabs(outputCoord->r - SPHERE_COORD_TP1_GAL_R) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord r %lg not as expected %lg",
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
                 outputCoord->r, SPHERE_COORD_TP1_GAL_R);
         return 2;
     }
     if(fabs(outputCoord->d - SPHERE_COORD_TP1_GAL_D) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord d %ld not as expected %lg",
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
                 outputCoord->d, SPHERE_COORD_TP1_GAL_D);
         return 3;
@@ -652,21 +657,21 @@
 
     // Create inverse transform Galactic to ICRS
-    testTransform = psSphereTransformGalacticToICRS();
+    testTransform = psSphereRotGalacticToICRS();
 
     // Perform transform from Galactic to ICRS
-    inverseOutputCoord = psSphereTransformApply(inverseOutputCoord,testTransform,outputCoord);
+    inverseOutputCoord = psSphereRotApply(inverseOutputCoord,testTransform,outputCoord);
     // Verify output not NULL and member values set correctly
     if(inverseOutputCoord == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply returned NULL");
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
         return 4;
     }
 
     if(fabs(inverseOutputCoord->r - SPHERE_COORD_TP1_INVERSE_R) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord r %lg not as expected %lg",
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
                 inverseOutputCoord->r, SPHERE_COORD_TP1_INVERSE_R);
         return 5;
     }
     if(fabs(inverseOutputCoord->d - SPHERE_COORD_TP1_INVERSE_D) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord d %ld not as expected %lg",
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
                 inverseOutputCoord->d, SPHERE_COORD_TP1_INVERSE_D);
         return 6;
@@ -675,20 +680,20 @@
 
     // Create transform ICRS to Ecliptic
-    testTransform = psSphereTransformICRSToEcliptic(testDateTime);
+    testTransform = psSphereRotICRSToEcliptic(testDateTime);
 
     // Perform transform from ICRS to Ecliptic
-    outputCoord = psSphereTransformApply(outputCoord,testTransform,inputCoord);
+    outputCoord = psSphereRotApply(outputCoord,testTransform,inputCoord);
     // Verify output not NULL and member values set correctly
     if(outputCoord == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply returned NULL");
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
         return 7;
     }
     if(fabs(outputCoord->r - SPHERE_COORD_TP1_ECL_R) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord r %lg not as expected %lg",
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
                 outputCoord->r, SPHERE_COORD_TP1_ECL_R);
         return 8;
     }
     if(fabs(outputCoord->d - SPHERE_COORD_TP1_ECL_D) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord d %ld not as expected %lg",
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
                 outputCoord->d, SPHERE_COORD_TP1_ECL_D);
         return 9;
@@ -697,20 +702,20 @@
 
     // Create inverse transform Ecliptic to ICRS
-    testTransform = psSphereTransformEclipticToICRS(testDateTime);
+    testTransform = psSphereRotEclipticToICRS(testDateTime);
 
     // Perform transform from Ecliptic to ICRS
-    inverseOutputCoord = psSphereTransformApply(inverseOutputCoord,testTransform,outputCoord);
+    inverseOutputCoord = psSphereRotApply(inverseOutputCoord,testTransform,outputCoord);
     // Verify output not NULL and member values set correctly
     if(inverseOutputCoord == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply returned NULL");
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
         return 10;
     }
     if(fabs(inverseOutputCoord->r - SPHERE_COORD_TP1_INVERSE_R) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord r %lg not as expected %lg",
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
                 inverseOutputCoord->r, SPHERE_COORD_TP1_INVERSE_R);
         return 11;
     }
     if(fabs(inverseOutputCoord->d - SPHERE_COORD_TP1_INVERSE_D) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord d %ld not as expected %lg",
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
                 inverseOutputCoord->d, SPHERE_COORD_TP1_INVERSE_D);
         return 12;
@@ -726,8 +731,8 @@
 }
 
-psS32 testSphereTransformApply4( void)
-{
-
-    psSphereTransform*  testTransform;
+psS32 testSphereRotApply4( void)
+{
+
+    psSphereRot*  testTransform;
     psSphere*           inputCoord = psSphereAlloc();
     psSphere*           outputCoord = NULL;
@@ -743,20 +748,20 @@
 
     // Create transform ICRS to Galactic
-    testTransform = psSphereTransformICRSToGalactic();
+    testTransform = psSphereRotICRSToGalactic();
 
     // Perform transform from ICRS to Galactic
-    outputCoord = psSphereTransformApply(outputCoord,testTransform,inputCoord);
+    outputCoord = psSphereRotApply(outputCoord,testTransform,inputCoord);
     // Verify output not NULL and member values set correctly
     if(outputCoord == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply returned NULL");
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
         return 1;
     }
     if(fabs(outputCoord->r - SPHERE_COORD_TP2_GAL_R) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord r %lg not as expected %lg",
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
                 outputCoord->r, SPHERE_COORD_TP2_GAL_R);
         return 2;
     }
     if(fabs(outputCoord->d - SPHERE_COORD_TP2_GAL_D) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord d %ld not as expected %lg",
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
                 outputCoord->d, SPHERE_COORD_TP2_GAL_D);
         return 3;
@@ -765,21 +770,21 @@
 
     // Create inverse transform Galactic to ICRS
-    testTransform = psSphereTransformGalacticToICRS();
+    testTransform = psSphereRotGalacticToICRS();
 
     // Perform transform from Galactic to ICRS
-    inverseOutputCoord = psSphereTransformApply(inverseOutputCoord,testTransform,outputCoord);
+    inverseOutputCoord = psSphereRotApply(inverseOutputCoord,testTransform,outputCoord);
     // Verify output not NULL and member values set correctly
     if(inverseOutputCoord == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply returned NULL");
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
         return 4;
     }
     // atan2 function introduces some error with y close to zero, increased error tolerance
     if(fabs(inverseOutputCoord->r - SPHERE_COORD_TP2_INVERSE_R) > ERROR_TOL+0.1) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord r %lg not as expected %lg",
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
                 inverseOutputCoord->r, SPHERE_COORD_TP2_INVERSE_R);
         return 5;
     }
     if(fabs(inverseOutputCoord->d - SPHERE_COORD_TP2_INVERSE_D) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord d %ld not as expected %lg",
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
                 inverseOutputCoord->d, SPHERE_COORD_TP2_INVERSE_D);
         return 6;
@@ -788,20 +793,20 @@
 
     // Create transform ICRS to Ecliptic
-    testTransform = psSphereTransformICRSToEcliptic(testDateTime);
+    testTransform = psSphereRotICRSToEcliptic(testDateTime);
 
     // Perform transform from ICRS to Ecliptic
-    outputCoord = psSphereTransformApply(outputCoord,testTransform,inputCoord);
+    outputCoord = psSphereRotApply(outputCoord,testTransform,inputCoord);
     // Verify output not NULL and member values set correctly
     if(outputCoord == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply returned NULL");
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
         return 7;
     }
     if(fabs(outputCoord->r - SPHERE_COORD_TP2_ECL_R) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord r %lg not as expected %lg",
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
                 outputCoord->r, SPHERE_COORD_TP2_ECL_R);
         return 8;
     }
     if(fabs(outputCoord->d - SPHERE_COORD_TP2_ECL_D) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord d %ld not as expected %lg",
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
                 outputCoord->d, SPHERE_COORD_TP2_ECL_D);
         return 9;
@@ -810,20 +815,20 @@
 
     // Create inverse transform Ecliptic to ICRS
-    testTransform = psSphereTransformEclipticToICRS(testDateTime);
+    testTransform = psSphereRotEclipticToICRS(testDateTime);
 
     // Perform transform from Ecliptic to ICRS
-    inverseOutputCoord = psSphereTransformApply(inverseOutputCoord,testTransform,outputCoord);
+    inverseOutputCoord = psSphereRotApply(inverseOutputCoord,testTransform,outputCoord);
     // Verify output not NULL and member values set correctly
     if(inverseOutputCoord == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply returned NULL");
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
         return 10;
     }
     if(fabs(inverseOutputCoord->r - SPHERE_COORD_TP2_INVERSE_R) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord r %lg not as expected %lg",
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
                 inverseOutputCoord->r, SPHERE_COORD_TP2_INVERSE_R);
         return 11;
     }
     if(fabs(inverseOutputCoord->d - SPHERE_COORD_TP2_INVERSE_D) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord d %ld not as expected %lg",
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
                 inverseOutputCoord->d, SPHERE_COORD_TP2_INVERSE_D);
         return 12;
@@ -839,7 +844,7 @@
 }
 
-psS32 testSphereTransformApply5( void)
-{
-    psSphereTransform*  testTransform;
+psS32 testSphereRotApply5( void)
+{
+    psSphereRot*  testTransform;
     psSphere*           inputCoord = psSphereAlloc();
     psSphere*           outputCoord = NULL;
@@ -855,20 +860,20 @@
 
     // Create transform ICRS to Galactic
-    testTransform = psSphereTransformICRSToGalactic();
+    testTransform = psSphereRotICRSToGalactic();
 
     // Perform transform from ICRS to Galactic
-    outputCoord = psSphereTransformApply(outputCoord,testTransform,inputCoord);
+    outputCoord = psSphereRotApply(outputCoord,testTransform,inputCoord);
     // Verify output not NULL and member values set correctly
     if(outputCoord == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply returned NULL");
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
         return 1;
     }
     if(fabs(outputCoord->r - SPHERE_COORD_TP3_GAL_R) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord r %lg not as expected %lg",
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
                 outputCoord->r, SPHERE_COORD_TP3_GAL_R);
         return 2;
     }
     if(fabs(outputCoord->d - SPHERE_COORD_TP3_GAL_D) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord d %ld not as expected %lg",
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
                 outputCoord->d, SPHERE_COORD_TP3_GAL_D);
         return 3;
@@ -877,20 +882,20 @@
 
     // Create inverse transform Galactic to ICRS
-    testTransform = psSphereTransformGalacticToICRS();
+    testTransform = psSphereRotGalacticToICRS();
 
     // Perform transform from Galactic to ICRS
-    inverseOutputCoord = psSphereTransformApply(inverseOutputCoord,testTransform,outputCoord);
+    inverseOutputCoord = psSphereRotApply(inverseOutputCoord,testTransform,outputCoord);
     // Verify output not NULL and member values set correctly
     if(inverseOutputCoord == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply returned NULL");
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
         return 4;
     }
     if(fabs(inverseOutputCoord->r - SPHERE_COORD_TP3_INVERSE_R) > ERROR_TOL+0.1) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord r %lg not as expected %lg",
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
                 inverseOutputCoord->r, SPHERE_COORD_TP3_INVERSE_R);
         return 5;
     }
     if(fabs(inverseOutputCoord->d - SPHERE_COORD_TP3_INVERSE_D) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord d %ld not as expected %lg",
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
                 inverseOutputCoord->d, SPHERE_COORD_TP3_INVERSE_D);
         return 6;
@@ -899,20 +904,20 @@
 
     // Create transform ICRS to Ecliptic
-    testTransform = psSphereTransformICRSToEcliptic(testDateTime);
+    testTransform = psSphereRotICRSToEcliptic(testDateTime);
 
     // Perform transform from ICRS to Ecliptic
-    outputCoord = psSphereTransformApply(outputCoord,testTransform,inputCoord);
+    outputCoord = psSphereRotApply(outputCoord,testTransform,inputCoord);
     // Verify output not NULL and member values set correctly
     if(outputCoord == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply returned NULL");
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
         return 7;
     }
     if(fabs(outputCoord->r - SPHERE_COORD_TP3_ECL_R) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord r %lg not as expected %lg",
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
                 outputCoord->r, SPHERE_COORD_TP3_ECL_R);
         return 8;
     }
     if(fabs(outputCoord->d - SPHERE_COORD_TP3_ECL_D) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord d %ld not as expected %lg",
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
                 outputCoord->d, SPHERE_COORD_TP3_ECL_D);
         return 9;
@@ -921,20 +926,20 @@
 
     // Create inverse transform Ecliptic to ICRS
-    testTransform = psSphereTransformEclipticToICRS(testDateTime);
+    testTransform = psSphereRotEclipticToICRS(testDateTime);
 
     // Perform transform from Ecliptic to ICRS
-    inverseOutputCoord = psSphereTransformApply(inverseOutputCoord,testTransform,outputCoord);
+    inverseOutputCoord = psSphereRotApply(inverseOutputCoord,testTransform,outputCoord);
     // Verify output not NULL and member values set correctly
     if(inverseOutputCoord == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply returned NULL");
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply returned NULL");
         return 10;
     }
     if(fabs(inverseOutputCoord->r - SPHERE_COORD_TP3_INVERSE_R) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord r %lg not as expected %lg",
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord r %lg not as expected %lg",
                 inverseOutputCoord->r, SPHERE_COORD_TP3_INVERSE_R);
         return 11;
     }
     if(fabs(inverseOutputCoord->d - SPHERE_COORD_TP3_INVERSE_D) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply return coord d %ld not as expected %lg",
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotApply return coord d %ld not as expected %lg",
                 inverseOutputCoord->d, SPHERE_COORD_TP3_INVERSE_D);
         return 12;
@@ -963,5 +968,5 @@
 #define SPHERE_PRECESS_TP3_EXPECT_D     0.543024          //   31.113     degrees
 
-psS32 testSphereTransformPrecess( void )
+psS32 testSphereRotPrecess( void )
 {
     psSphere*     inputCoord  = psSphereAlloc();
@@ -1080,22 +1085,106 @@
 }
 
-// Thes values calculated from ADD-09 equations
-#define EXPECT_COS_DELTAP_2000    0.917482
-#define EXPECT_SIN_DELTAP_2000    0.397777
-#define EXPECT_COS_DELTAP_2100    0.917572
-#define EXPECT_SIN_DELTAP_2100    0.397567
-
-psS32 testSphereTransformICRSToEcliptic( void )
+psS32 testSphereRotICRSToEcliptic( void )
+{
+    psF64  expectedQ0 = 0.0;
+    psF64  expectedQ1 = 0.0;
+    psF64  expectedQ2 = 0.0;
+    psF64  expectedQ3 = 0.0;
+
+    // Set test date time to 1/1/2000 00:00:00
+    psTime* testDateTime = psTimeFromMJD(MJD_2000);
+
+    // Invoke function to set psSphereRota objec
+    psSphereRot *myST = psSphereRotICRSToEcliptic(testDateTime);
+
+    // Verify expected values for the specified time
+    if (ERROR_TOL < fabs(expectedQ0 - myST->q0)) {
+        psError(PS_ERR_UNKNOWN,true,"myST->q0 is %f, should be %f",
+                myST->q0, expectedQ0);
+        return 1;
+    }
+    if (ERROR_TOL < fabs(expectedQ1 - myST->q1)) {
+        psError(PS_ERR_UNKNOWN,true,"myST->q1 is %f, should be %f",
+                myST->q1, expectedQ1);
+        return 2;
+    }
+    if (ERROR_TOL < fabs(expectedQ2 - myST->q2)) {
+        psError(PS_ERR_UNKNOWN,true,"myST->q2 is %f, should be %f",
+                myST->q2, expectedQ2);
+        return 3;
+    }
+    if (ERROR_TOL < fabs(expectedQ3 - myST->q3)) {
+        psError(PS_ERR_UNKNOWN,true,"myST->q3 is %f, should be %f",
+                myST->q3, expectedQ3);
+        return 4;
+    }
+    psFree(myST);
+    psFree(testDateTime);
+
+    // Set test date time to 1/1/2100 00:00:00
+    testDateTime = psTimeFromMJD(MJD_2100);
+
+    // Invoke function to set psSphereRota objec
+    myST = psSphereRotICRSToEcliptic(testDateTime);
+
+    // Verify expected values for the specified time
+    // Verify expected values for the specified time
+    if (ERROR_TOL < fabs(expectedQ0 - myST->q0)) {
+        psError(PS_ERR_UNKNOWN,true,"myST->q0 is %f, should be %f",
+                myST->q0, expectedQ0);
+        return 5;
+    }
+    if (ERROR_TOL < fabs(expectedQ1 - myST->q1)) {
+        psError(PS_ERR_UNKNOWN,true,"myST->q1 is %f, should be %f",
+                myST->q1, expectedQ1);
+        return 6;
+    }
+    if (ERROR_TOL < fabs(expectedQ2 - myST->q2)) {
+        psError(PS_ERR_UNKNOWN,true,"myST->q2 is %f, should be %f",
+                myST->q2, expectedQ2);
+        return 7;
+    }
+    if (ERROR_TOL < fabs(expectedQ3 - myST->q3)) {
+        psError(PS_ERR_UNKNOWN,true,"myST->q3 is %f, should be %f",
+                myST->q3, expectedQ3);
+        return 8;
+    }
+    psFree(myST);
+    psFree(testDateTime);
+
+    // Verify if argument psTime is NULL, function returns NULL and error message generated
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
+    myST = psSphereRotICRSToEcliptic(NULL);
+    if (myST != NULL) {
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotICRSToEcliptic() did not return NULL.");
+        return 9;
+    }
+
+    // Verify if argument psTime is less than 1900, function return NULL and error msg generated
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
+    testDateTime = psTimeFromMJD(MJD_1900 - 1.0);
+    myST = psSphereRotICRSToEcliptic(testDateTime);
+    if (myST != NULL) {
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotICRSToEcliptic() did not return NULL.");
+        return 10;
+    }
+    psFree(testDateTime);
+
+    return 0;
+}
+
+
+psS32 testSphereRotEclipticToICRS( void )
 {
     psF64  expectedPhiP = 0.0;
     psF64  expectedAlphaP = 0.0;
-    psF64  expectedCosDeltaP = EXPECT_COS_DELTAP_2000;
-    psF64  expectedSinDeltaP = EXPECT_SIN_DELTAP_2000;
+    psF64  expectedCosDeltaP = 0.0;
+    psF64  expectedSinDeltaP = 0.0;
 
     // Set test date time to 1/1/2000 00:00:00
     psTime* testDateTime = psTimeFromMJD(MJD_2000);
 
-    // Invoke function to set psSphereTransforma objec
-    psSphereTransform *myST = psSphereTransformICRSToEcliptic(testDateTime);
+    // Invoke function to set psSphereRota object
+    psSphereRot *myST = psSphereRotEclipticToICRS(testDateTime);
 
     // Verify expected values for the specified time
@@ -1124,11 +1213,11 @@
 
     expectedCosDeltaP = EXPECT_COS_DELTAP_2100;
-    expectedSinDeltaP = EXPECT_SIN_DELTAP_2100;
+    expectedSinDeltaP = -EXPECT_SIN_DELTAP_2100;
 
     // Set test date time to 1/1/2100 00:00:00
     testDateTime = psTimeFromMJD(MJD_2100);
 
-    // Invoke function to set psSphereTransforma objec
-    myST = psSphereTransformICRSToEcliptic(testDateTime);
+    // Invoke function to set psSphereRota objec
+    myST = psSphereRotEclipticToICRS(testDateTime);
 
     // Verify expected values for the specified time
@@ -1158,7 +1247,7 @@
     // Verify if argument psTime is NULL, function returns NULL and error message generated
     psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
-    myST = psSphereTransformICRSToEcliptic(NULL);
+    myST = psSphereRotEclipticToICRS(NULL);
     if (myST != NULL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformICRSToEcliptic() did not return NULL.");
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotEclipticICRS() did not return NULL.");
         return 9;
     }
@@ -1167,99 +1256,7 @@
     psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
     testDateTime = psTimeFromMJD(MJD_1900 - 1.0);
-    myST = psSphereTransformICRSToEcliptic(testDateTime);
+    myST = psSphereRotEclipticToICRS(testDateTime);
     if (myST != NULL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformICRSToEcliptic() did not return NULL.");
-        return 10;
-    }
-    psFree(testDateTime);
-
-    return 0;
-}
-
-
-psS32 testSphereTransformEclipticToICRS( void )
-{
-    psF64  expectedPhiP = 0.0;
-    psF64  expectedAlphaP = 0.0;
-    psF64  expectedCosDeltaP = EXPECT_COS_DELTAP_2000;
-    psF64  expectedSinDeltaP = -EXPECT_SIN_DELTAP_2000;
-
-    // Set test date time to 1/1/2000 00:00:00
-    psTime* testDateTime = psTimeFromMJD(MJD_2000);
-
-    // Invoke function to set psSphereTransforma object
-    psSphereTransform *myST = psSphereTransformEclipticToICRS(testDateTime);
-
-    // Verify expected values for the specified time
-    if (ERROR_TOL < fabs(expectedSinDeltaP - myST->sinDeltaP)) {
-        psError(PS_ERR_UNKNOWN,true,"myST->sinDeltaP is %f, should be %f",
-                myST->sinDeltaP, expectedSinDeltaP);
-        return 1;
-    }
-    if (ERROR_TOL < fabs(expectedCosDeltaP - myST->cosDeltaP)) {
-        psError(PS_ERR_UNKNOWN,true,"myST->cosDeltaP is %f, should be %f",
-                myST->cosDeltaP, expectedCosDeltaP);
-        return 2;
-    }
-    if (ERROR_TOL < fabs(expectedAlphaP - myST->alphaP)) {
-        psError(PS_ERR_UNKNOWN,true,"myST->alphaP is %f, should be %f",
-                myST->alphaP, expectedAlphaP);
-        return 3;
-    }
-    if (ERROR_TOL < fabs(expectedPhiP - myST->phiP)) {
-        psError(PS_ERR_UNKNOWN,true,"myST->phiP is %f, should be %f",
-                myST->phiP, expectedPhiP);
-        return 4;
-    }
-    psFree(myST);
-    psFree(testDateTime);
-
-    expectedCosDeltaP = EXPECT_COS_DELTAP_2100;
-    expectedSinDeltaP = -EXPECT_SIN_DELTAP_2100;
-
-    // Set test date time to 1/1/2100 00:00:00
-    testDateTime = psTimeFromMJD(MJD_2100);
-
-    // Invoke function to set psSphereTransforma objec
-    myST = psSphereTransformEclipticToICRS(testDateTime);
-
-    // Verify expected values for the specified time
-    if (ERROR_TOL < fabs(expectedSinDeltaP - myST->sinDeltaP)) {
-        psError(PS_ERR_UNKNOWN,true,"myST->sinDeltaP is %f, should be %f",
-                myST->sinDeltaP, expectedSinDeltaP);
-        return 5;
-    }
-    if (ERROR_TOL < fabs(expectedCosDeltaP - myST->cosDeltaP)) {
-        psError(PS_ERR_UNKNOWN,true,"myST->cosDeltaP is %f, should be %f",
-                myST->cosDeltaP, expectedCosDeltaP);
-        return 6;
-    }
-    if (ERROR_TOL < fabs(expectedAlphaP - myST->alphaP)) {
-        psError(PS_ERR_UNKNOWN,true,"myST->alphaP is %f, should be %f",
-                myST->alphaP, expectedAlphaP);
-        return 7;
-    }
-    if (ERROR_TOL < fabs(expectedPhiP - myST->phiP)) {
-        psError(PS_ERR_UNKNOWN,true,"myST->phiP is %f, should be %f",
-                myST->phiP, expectedPhiP);
-        return 8;
-    }
-    psFree(myST);
-    psFree(testDateTime);
-
-    // Verify if argument psTime is NULL, function returns NULL and error message generated
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
-    myST = psSphereTransformEclipticToICRS(NULL);
-    if (myST != NULL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformEclipticICRS() did not return NULL.");
-        return 9;
-    }
-
-    // Verify if argument psTime is less than 1900, function return NULL and error msg generated
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
-    testDateTime = psTimeFromMJD(MJD_1900 - 1.0);
-    myST = psSphereTransformEclipticToICRS(testDateTime);
-    if (myST != NULL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformEclipticToICRS() did not return NULL.");
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotEclipticToICRS() did not return NULL.");
         return 10;
     }
@@ -1274,12 +1271,12 @@
 #define ITG_EXPECT_PHIP        0.57477
 
-psS32 testSphereTransformICRSToGalactic( void )
+psS32 testSphereRotICRSToGalactic( void )
 {
     // Invoke function
-    psSphereTransform *myST = psSphereTransformICRSToGalactic();
+    psSphereRot *myST = psSphereRotICRSToGalactic();
 
     // Verify did not return NULL
     if(myST == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformICRSToGalactic returned NULL");
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotICRSToGalactic returned NULL");
         return 1;
     }
@@ -1316,12 +1313,12 @@
 #define GTI_EXPECT_ALPHAP      0.57477
 
-psS32 testSphereTransformGalacticToICRS( void )
+psS32 testSphereRotGalacticToICRS( void )
 {
     // Invoke function
-    psSphereTransform *myST = psSphereTransformGalacticToICRS();
+    psSphereRot *myST = psSphereRotGalacticToICRS();
 
     // Verify did not return NULL
     if(myST == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"psSphereTransformGalacticToICRS returned NULL");
+        psError(PS_ERR_UNKNOWN,true,"psSphereRotGalacticToICRS returned NULL");
         return 1;
     }
