Index: /trunk/psLib/src/astro/psEarthOrientation.c
===================================================================
--- /trunk/psLib/src/astro/psEarthOrientation.c	(revision 5449)
+++ /trunk/psLib/src/astro/psEarthOrientation.c	(revision 5450)
@@ -9,6 +9,6 @@
 *  @author Robert Daniel DeSonia, MHPCC
 *
-*  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-10-27 20:38:18 $
+*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-10-28 02:25:22 $
 *
 *  Copyright 2005 Maui High Performance Computing Center, University of Hawaii
@@ -19,5 +19,5 @@
 
 #include "psEarthOrientation.h"
-#include "psTime.h"
+//#include "psTime.h"
 #include "psArray.h"
 #include "psPolynomial.h"
@@ -163,7 +163,68 @@
                        double speed)
 {
-
-
-    return NULL;
+    PS_ASSERT_PTR_NON_NULL(apparent, NULL);
+    PS_ASSERT_PTR_NON_NULL(direction, NULL);
+    if (fabs(speed) < DBL_EPSILON) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                "Aberration speed should not be equal to 0.\n");
+        return NULL;
+    }
+
+    if (actual == NULL) {
+        actual = psSphereAlloc();
+    } else {
+        actual->r = 0.0;
+        actual->d = 0.0;
+        actual->rErr = 0.0;
+        actual->dErr = 0.0;
+    }
+    psSphere *rp = psSphereAlloc();
+    psSphere *r_p = psSphereAlloc();
+    double mu = 0.0;
+    double mu_p = 0.0;
+    double a = 0.0;
+
+    //mu = apparent * direction;  I believe this should be:
+    //    mu = apparent->r * direction->r + apparent->d * direction->d;
+    psCube* directionVector = psSphereToCube(direction);
+    psCube* apparentVector = psSphereToCube(apparent);
+    mu = acos(directionVector->x*apparentVector->x +
+              directionVector->y*apparentVector->y +
+              directionVector->z*apparentVector->z);
+
+    //rp = apparent - mu * direction;
+    rp->r = apparent->r - mu * direction->r;
+    rp->d = apparent->d - mu * direction->d;
+
+    mu_p = mu + speed * ((mu * mu - 1.0) / (1.0 - speed * mu));
+
+    //Not sure if this is right.  ADD gets a scalar from division of rp (a vector)
+    psCube* rpVector = psSphereToCube(rp);
+    a = sqrt( (1.0 - mu_p * mu_p) /
+              (sqrt(rpVector->x*rpVector->x
+                    + rpVector->y*rpVector->y
+                    + rpVector->z*rpVector->z)) );
+
+    //r_p = mu_p * direction + a * rp;
+    r_p->r = mu_p * direction->r + a * rp->r;
+    r_p->d = mu_p * direction->d + a * rp->d;
+
+    *actual = *r_p;
+    /*
+        psSphereRot *rot = NULL;
+        double cosR = cos(direction->r);
+        double cosD = cos(direction->d);
+        double sinR = sin(direction->r);
+        double sinD = sin(direction->d);
+        rot = psSphereRotQuat(cosR*cosD, sinR*cosD, sinD, speed);
+     
+        actual = psSphereRotApply(actual, rot, apparent);
+    */
+    psFree(rp);
+    psFree(r_p);
+    psFree(directionVector);
+    psFree(apparentVector);
+    psFree(rpVector);
+    return actual;
 }
 
Index: /trunk/psLib/src/astro/psEarthOrientation.h
===================================================================
--- /trunk/psLib/src/astro/psEarthOrientation.h	(revision 5449)
+++ /trunk/psLib/src/astro/psEarthOrientation.h	(revision 5450)
@@ -9,6 +9,6 @@
 *  @author Robert Daniel DeSonia, MHPCC
 *
-*  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-10-27 20:38:18 $
+*  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-10-28 02:25:22 $
 *
 *  Copyright 2005 Maui High Performance Computing Center, University of Hawaii
@@ -42,5 +42,6 @@
     PS_PRECESS_COMPLETE,               ///< complete level of detail
     PS_PRECESS_IAU2000A,               ///< highest level of detail
-} psPrecessMethod;
+}
+psPrecessMethod;
 
 /** Calculates the actual position of a star, given its apparent position and the
Index: /trunk/psLib/test/astro/tst_psEarthOrientation.c
===================================================================
--- /trunk/psLib/test/astro/tst_psEarthOrientation.c	(revision 5449)
+++ /trunk/psLib/test/astro/tst_psEarthOrientation.c	(revision 5450)
@@ -6,6 +6,6 @@
 *  @author d-Rob, MHPCC
 *
-*  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-10-27 20:38:19 $
+*  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-10-28 02:25:22 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -24,7 +24,7 @@
 
 testDescription tests[] = {
-                              {testEOCParallax, 666, "psEOCParallax()", 0, false},
-                              {testAberration, 667, "psAberration()", 0, false},
-                              {testGravityDeflect, 668, "psGravityDeflect()", 0, false},
+                              {testAberration, 666, "psAberration()", 0, false},
+                              {testGravityDeflect, 667, "psGravityDeflect()", 0, false},
+                              {testEOCParallax, 668, "psEOCParallax()", 0, false},
                               {testEOCPrecession, 669, "psEOCPrecession()", 0, false},
                               {testEOCPolar, 670, "psEOCPolar()", 0, false},
@@ -41,12 +41,35 @@
 }
 
-psS32 testEOCParallax(void)
-{
-
-    return 0;
-}
-
 psS32 testAberration(void)
 {
+    psSphere *actual = NULL;
+    psSphere *apparent = psSphereAlloc();
+    psSphere *direction = psSphereAlloc();
+    psSphere *empty = NULL;
+
+    apparent->r = 0.2;
+    apparent->d = 0.2;
+    direction->r = 0.2035;
+    direction->d = 0.2035;
+
+    empty = psAberration(empty, actual, direction, 0.1);
+    if (empty != NULL) {
+        psError(PS_ERR_BAD_PARAMETER_NULL, false,
+                "psAberration failed to return NULL for NULL apparent input.\n");
+        return 1;
+    }
+    empty = psAberration(empty, apparent, actual, 0.1);
+    if (empty != NULL) {
+        psError(PS_ERR_BAD_PARAMETER_NULL, false,
+                "psAberration failed to return NULL for NULL direction input.\n");
+        return 2;
+    }
+
+    actual = psAberration(actual, apparent, direction, 0.4);
+    printf("\nactual = r,d  = %.8g, %.8g\n", actual->r, actual->d);
+
+    psFree(actual);
+    psFree(apparent);
+    psFree(direction);
 
     return 0;
@@ -79,5 +102,4 @@
     }
 
-
     actual = psGravityDeflection(actual, apparent, sun);
     psSphere *result = psSphereSetOffset(apparent, actual, PS_SPHERICAL, PS_RADIAN);
@@ -88,4 +110,10 @@
     psFree(apparent);
     psFree(sun);
+
+    return 0;
+}
+
+psS32 testEOCParallax(void)
+{
 
     return 0;
Index: /trunk/psLib/test/astro/tst_psSphereOps.c
===================================================================
--- /trunk/psLib/test/astro/tst_psSphereOps.c	(revision 5449)
+++ /trunk/psLib/test/astro/tst_psSphereOps.c	(revision 5450)
@@ -6,6 +6,6 @@
 *  @author d-Rob, MHPCC
 *
-*  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-10-26 01:20:15 $
+*  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-10-28 02:25:22 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -71,17 +71,17 @@
     double q3 = cos(a3)*cos(DELTA_P/2);
 
-    if (FLT_EPSILON < fabs(q0 - myST->q0)) {
+    if (DBL_EPSILON < fabs(q0 - myST->q0)) {
         psError(PS_ERR_UNKNOWN,true,"myST->q0 is %lf, should be %lf\n", myST->q0, q0);
         return 2;
     }
-    if (FLT_EPSILON < fabs(q1 - myST->q1)) {
+    if (DBL_EPSILON < fabs(q1 - myST->q1)) {
         psError(PS_ERR_UNKNOWN,true,"myST->q1 is %f, should be %f\n", myST->q1, q1);
         return 3;
     }
-    if (FLT_EPSILON < fabs(q2 - myST->q2)) {
+    if (DBL_EPSILON < fabs(q2 - myST->q2)) {
         psError(PS_ERR_UNKNOWN,true,"myST->q2 is %f, should be %f\n", myST->q2, q2);
         return 4;
     }
-    if (FLT_EPSILON < fabs(q3 - myST->q3)) {
+    if (DBL_EPSILON < fabs(q3 - myST->q3)) {
         psError(PS_ERR_UNKNOWN,true,"myST->q0 is %f, should be %f\n", myST->q3, q3);
         return 5;
@@ -239,6 +239,6 @@
 
         // check ecliptic transforms for correctness
-        if (abs(RAD_TO_DEG(ecliptic->r) - lambda[x]) > TOLERANCE ||
-                abs(RAD_TO_DEG(ecliptic->d) - beta[x]) > TOLERANCE) {
+        if (fabs(RAD_TO_DEG(ecliptic->r) - lambda[x]) > TOLERANCE ||
+                fabs(RAD_TO_DEG(ecliptic->d) - beta[x]) > TOLERANCE) {
             psError(PS_ERR_UNKNOWN, false,
                     "Ecliptic tranformation incorrect.  Result is (%g,%g), expected (%g,%g)",
@@ -247,6 +247,6 @@
             return 1;
         }
-        if (abs(RAD_TO_DEG(icrsFromEcliptic->r) - alpha[x]) > TOLERANCE ||
-                abs(RAD_TO_DEG(icrsFromEcliptic->d) - delta[x]) > TOLERANCE) {
+        if (fabs(RAD_TO_DEG(icrsFromEcliptic->r) - alpha[x]) > TOLERANCE ||
+                fabs(RAD_TO_DEG(icrsFromEcliptic->d) - delta[x]) > TOLERANCE) {
             psError(PS_ERR_UNKNOWN, false,
                     "ICRS for Ecliptic tranformation incorrect.  Result is (%g,%g), expected (%g,%g)",
@@ -269,6 +269,6 @@
 
         // check ecliptic transforms for correctness
-        if (abs(RAD_TO_DEG(galactic->r) - l[x]) > TOLERANCE ||
-                abs(RAD_TO_DEG(galactic->d) - b[x]) > TOLERANCE) {
+        if (fabs(RAD_TO_DEG(galactic->r) - l[x]) > TOLERANCE ||
+                fabs(RAD_TO_DEG(galactic->d) - b[x]) > TOLERANCE) {
             psError(PS_ERR_UNKNOWN, false,
                     "Galactic tranformation incorrect.  Result is (%g,%g), expected (%g,%g)",
@@ -280,6 +280,6 @@
             return 3;
         }
-        if (abs(RAD_TO_DEG(icrsFromGalactic->r) - alpha[x]) > TOLERANCE ||
-                abs(RAD_TO_DEG(icrsFromGalactic->d) - delta[x]) > TOLERANCE) {
+        if (fabs(RAD_TO_DEG(icrsFromGalactic->r) - alpha[x]) > TOLERANCE ||
+                fabs(RAD_TO_DEG(icrsFromGalactic->d) - delta[x]) > TOLERANCE) {
             psError(PS_ERR_UNKNOWN, false,
                     "ICRS for Galactic tranformation incorrect.  Result is (%g,%g), expected (%g,%g)",
@@ -498,5 +498,5 @@
     output->d *= -1.0;
     empty = psSphereGetOffset(origin, output, PS_LINEAR, PS_RADIAN);
-    if ( fabs(offset->r - empty->r) > 0.0001 || fabs(offset->d - empty->r) > 0.0001 ) {
+    if ( fabs(offset->r - empty->r) > 0.0001 || abs(offset->d - empty->r) > 0.0001 ) {
         psError(PS_ERR_BAD_PARAMETER_VALUE, false,
                 "psSphereGetOffset failed to return correct linear offset values.\n");
Index: /trunk/psLib/test/astro/verified/tst_psEarthOrientation.stderr
===================================================================
--- /trunk/psLib/test/astro/verified/tst_psEarthOrientation.stderr	(revision 5449)
+++ /trunk/psLib/test/astro/verified/tst_psEarthOrientation.stderr	(revision 5450)
@@ -1,11 +1,2 @@
-/***************************** TESTPOINT ******************************************\
-*             TestFile: tst_psEarthOrientation.c                                   *
-*            TestPoint: psEarthOrientation{psEOCParallax()}                        *
-*             TestType: Positive                                                   *
-\**********************************************************************************/
-
-
----> TESTPOINT PASSED (psEarthOrientation{psEOCParallax()} | tst_psEarthOrientation.c)
-
 /***************************** TESTPOINT ******************************************\
 *             TestFile: tst_psEarthOrientation.c                                   *
@@ -14,4 +5,8 @@
 \**********************************************************************************/
 
+<DATE><TIME>|<HOST>|E|psAberration (FILE:LINENO)
+    Unallowable operation: apparent is NULL.
+<DATE><TIME>|<HOST>|E|psAberration (FILE:LINENO)
+    Unallowable operation: direction is NULL.
 
 ---> TESTPOINT PASSED (psEarthOrientation{psAberration()} | tst_psEarthOrientation.c)
@@ -29,4 +24,13 @@
 
 ---> TESTPOINT PASSED (psEarthOrientation{psGravityDeflect()} | tst_psEarthOrientation.c)
+
+/***************************** TESTPOINT ******************************************\
+*             TestFile: tst_psEarthOrientation.c                                   *
+*            TestPoint: psEarthOrientation{psEOCParallax()}                        *
+*             TestType: Positive                                                   *
+\**********************************************************************************/
+
+
+---> TESTPOINT PASSED (psEarthOrientation{psEOCParallax()} | tst_psEarthOrientation.c)
 
 /***************************** TESTPOINT ******************************************\
Index: /trunk/psLib/test/astro/verified/tst_psEarthOrientation.stdout
===================================================================
--- /trunk/psLib/test/astro/verified/tst_psEarthOrientation.stdout	(revision 5449)
+++ /trunk/psLib/test/astro/verified/tst_psEarthOrientation.stdout	(revision 5450)
@@ -1,2 +1,4 @@
+
+actual = r,d  = 0.10218436, 0.10218436
 
 Apparent r,d = 0.2035,0.2035    Actual r,d = 0.2035000000002, 0.2035000000391 
