Index: trunk/psLib/src/astro/psEarthOrientation.c
===================================================================
--- trunk/psLib/src/astro/psEarthOrientation.c	(revision 5450)
+++ trunk/psLib/src/astro/psEarthOrientation.c	(revision 5455)
@@ -9,6 +9,6 @@
 *  @author Robert Daniel DeSonia, MHPCC
 *
-*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-10-28 02:25:22 $
+*  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-11-02 01:07:25 $
 *
 *  Copyright 2005 Maui High Performance Computing Center, University of Hawaii
@@ -54,5 +54,5 @@
 static bool eocInit()
 {
-    int nFail = 0;
+    unsigned int nFail = 0;
 
     // Read config file
@@ -158,10 +158,10 @@
 }
 
-psSphere *psAberration(psSphere *actual,
-                       const psSphere *apparent,
+psSphere *psAberration(psSphere *apparent,
+                       const psSphere *actual,
                        const psSphere *direction,
                        double speed)
 {
-    PS_ASSERT_PTR_NON_NULL(apparent, NULL);
+    PS_ASSERT_PTR_NON_NULL(actual, NULL);
     PS_ASSERT_PTR_NON_NULL(direction, NULL);
     if (fabs(speed) < DBL_EPSILON) {
@@ -171,11 +171,11 @@
     }
 
-    if (actual == NULL) {
-        actual = psSphereAlloc();
+    if (apparent == NULL) {
+        apparent = psSphereAlloc();
     } else {
-        actual->r = 0.0;
-        actual->d = 0.0;
-        actual->rErr = 0.0;
-        actual->dErr = 0.0;
+        apparent->r = 0.0;
+        apparent->d = 0.0;
+        apparent->rErr = 0.0;
+        apparent->dErr = 0.0;
     }
     psSphere *rp = psSphereAlloc();
@@ -188,12 +188,12 @@
     //    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);
+    psCube* actualVector = psSphereToCube(actual);
+    mu = acos(directionVector->x*actualVector->x +
+              directionVector->y*actualVector->y +
+              directionVector->z*actualVector->z);
 
     //rp = apparent - mu * direction;
-    rp->r = apparent->r - mu * direction->r;
-    rp->d = apparent->d - mu * direction->d;
+    rp->r = actual->r - mu * direction->r;
+    rp->d = actual->d - mu * direction->d;
 
     mu_p = mu + speed * ((mu * mu - 1.0) / (1.0 - speed * mu));
@@ -210,5 +210,5 @@
     r_p->d = mu_p * direction->d + a * rp->d;
 
-    *actual = *r_p;
+    *apparent = *r_p;
     /*
         psSphereRot *rot = NULL;
@@ -218,5 +218,5 @@
         double sinD = sin(direction->d);
         rot = psSphereRotQuat(cosR*cosD, sinR*cosD, sinD, speed);
-     
+
         actual = psSphereRotApply(actual, rot, apparent);
     */
@@ -224,29 +224,29 @@
     psFree(r_p);
     psFree(directionVector);
-    psFree(apparentVector);
+    psFree(actualVector);
     psFree(rpVector);
-    return actual;
-}
-
-psSphere *psGravityDeflection(psSphere *actual,
-                              psSphere *apparent,
+    return apparent;
+}
+
+psSphere *psGravityDeflection(psSphere *apparent,
+                              psSphere *actual,
                               psSphere *sun)
 {
-    PS_ASSERT_PTR_NON_NULL(apparent, NULL);
+    PS_ASSERT_PTR_NON_NULL(actual, NULL);
     PS_ASSERT_PTR_NON_NULL(sun, NULL);
 
-    // calculating the actual angle from the apparent angle and the sun position
-
-    // first, calculate the angle between the sun vector and the apparent vector
+    // calculating the apparent angle from the actual angle and the sun position
+
+    // first, calculate the angle between the sun vector and the actual vector
 
     // Moving to cartesian first:  XXX -- is this required?
     psCube* sunVector = psSphereToCube(sun);
-    psCube* apparentVector = psSphereToCube(apparent);
+    psCube* actualVector = psSphereToCube(actual);
 
     // use dot product to calculate the angle of separation
     // N.B., assuming the psSphereToCube function returns a unit vector.
-    double theta = acos(sunVector->x*apparentVector->x +
-                        sunVector->y*apparentVector->y +
-                        sunVector->z*apparentVector->z);
+    double theta = acos(sunVector->x*actualVector->x +
+                        sunVector->y*actualVector->y +
+                        sunVector->z*actualVector->z);
 
     double r0 = PS_AU * tan(theta);
@@ -259,19 +259,19 @@
         //if deflection is greater than limit, the light rays will hit the sun
         psWarning("Invalid positions.  Light ray will not be seen on earth.\n");
-        psFree(apparentVector);
+        psFree(actualVector);
         psFree(sunVector);
-        return actual;
-    }
-
-    if (actual == NULL) {
-        actual = psSphereAlloc();
+        return apparent;
+    }
+
+    if (apparent == NULL) {
+        apparent = psSphereAlloc();
     } else {
-        actual->r = 0.0;
-        actual->d = 0.0;
-        actual->rErr = 0.0;
-        actual->dErr = 0.0;
-    }
-
-    // bend the apparent vector away from the sun vector by deflection angle.
+        apparent->r = 0.0;
+        apparent->d = 0.0;
+        apparent->rErr = 0.0;
+        apparent->dErr = 0.0;
+    }
+
+    // bend the actual vector away from the sun vector by deflection angle.
     // XXX: Not sure how to do this.  Dave thinks the formula should be:
     //      theta = atan(r0/d)*tan(deflection), phi = thete/tan(deflection)
@@ -281,9 +281,9 @@
     theta = atan(r0/PS_AU) * tan(deflection);
     phi = sqrt( deflection*deflection - theta*theta );
-    actual->r = theta;
-    actual->d = phi;
-    psFree(apparentVector);
+    apparent->r = theta;
+    apparent->d = phi;
+    psFree(actualVector);
     psFree(sunVector);
-    return actual;
+    return apparent;
 }
 
