Index: /trunk/psLib/src/astro/psCoord.c
===================================================================
--- /trunk/psLib/src/astro/psCoord.c	(revision 1310)
+++ /trunk/psLib/src/astro/psCoord.c	(revision 1311)
@@ -10,6 +10,6 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-27 05:30:55 $
+ *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-28 20:22:22 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -23,4 +23,5 @@
 #include "psMemory.h"
 #include "psAbort.h"
+#include "psTime.h"
 #include <math.h>
 #include <float.h>
@@ -133,8 +134,8 @@
 }
 
-// XXX: Add a date argument to determine the correct year.
-psSphereTransform *psSphereTransformICRStoEcliptic(void)
-{
-    double year = 2004.0;
+psSphereTransform *psSphereTransformICRStoEcliptic(psTime time)
+{
+    struct tm *tmTime = psTimeToTM(time);
+    double year = (double) (1900 + tmTime->tm_year);
     double T = year / 100.0;
     double phi = -23.452294 + 0.013013*T + 0.000001639*T*T - 0.000000503*T*T*T;
@@ -145,8 +146,8 @@
 }
 
-// XXX: Add a date argument to determine the correct year.
 psSphereTransform *psSphereTransformEcliptictoICRS(void)
 {
-    double year = 2004.0;
+    struct tm *tmTime = psTimeToTM(time);
+    double year = (double) (1900 + tmTime->tm_year);
     double T = year / 100.0;
     double phi = +23.452294 - 0.013013*T - 0.000001639*T*T + 0.000000503*T*T*T;
@@ -285,4 +286,6 @@
 }
 
+// XXX: Do I need to check for unacceptable transformation parameters?
+// Maybe, if the points are on the North/South Pole, etc?
 psSphere *psSphereGetOffset(const psSphere *restrict position1,
                             const psSphere *restrict position2,
@@ -290,13 +293,28 @@
                             psSphereOffsetUnit unit)
 {
-    //    psPlane lin;
+    psPlane *lin;
+    psProjection proj;
     psSphere *tmp;
-    //    psProjection proj;
     double tmpR = 0.0;
     double tmpD = 0.0;
 
     if (mode == PS_LINEAR) {
-        // XXX: I have no idea how to construct this.
-        return(NULL);
+        // XXX: I have no idea how to construct this.  Maybe project both
+        // sperical positions onto the plane, set the origin at one of the
+        // points on the plane, then deproject?
+
+        // XXX: Do I need to somehow scale this projection?
+        // project position1?  Will it project to (0.0, 0.0)?
+        proj.R = position1->r;
+        proj.D = position1->d;
+        proj.Xs = 1.0;
+        proj.Ys = 1.0;
+        proj.type = PS_PROJ_TAN;
+
+        lin = psProject(position2, proj);
+        tmp = psDeproject(lin, proj);
+
+        // XXX: Do we need to convert units in tmp?
+        return(tmp);
     } else if (mode == PS_SPHERICAL) {
         tmpR = position2->r - position1->r;
@@ -314,5 +332,5 @@
         } else if (unit == PS_RADIAN) {}
         else {
-            psAbort(__func__, "Unknow offset unit: 0x%x\n", unit);
+            psAbort(__func__, "Unknown offset unit: 0x%x\n", unit);
         }
 
@@ -330,4 +348,6 @@
 
 
+// XXX: Do I need to check for unacceptable transformation parameters?
+// Maybe, if the points are on the North/South Pole, etc?
 // XXX: I copied the algorithm from the ADD exactly.
 psSphere *psSphereSetOffset(const psSphere *restrict position,
@@ -369,5 +389,5 @@
             tmpD = offset->d;
         } else {
-            psAbort(__func__, "Unknow offset unit: 0x%x\n", unit);
+            psAbort(__func__, "Unknown offset unit: 0x%x\n", unit);
         }
 
Index: /trunk/psLib/src/astronomy/psCoord.c
===================================================================
--- /trunk/psLib/src/astronomy/psCoord.c	(revision 1310)
+++ /trunk/psLib/src/astronomy/psCoord.c	(revision 1311)
@@ -10,6 +10,6 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-27 05:30:55 $
+ *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-28 20:22:22 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -23,4 +23,5 @@
 #include "psMemory.h"
 #include "psAbort.h"
+#include "psTime.h"
 #include <math.h>
 #include <float.h>
@@ -133,8 +134,8 @@
 }
 
-// XXX: Add a date argument to determine the correct year.
-psSphereTransform *psSphereTransformICRStoEcliptic(void)
-{
-    double year = 2004.0;
+psSphereTransform *psSphereTransformICRStoEcliptic(psTime time)
+{
+    struct tm *tmTime = psTimeToTM(time);
+    double year = (double) (1900 + tmTime->tm_year);
     double T = year / 100.0;
     double phi = -23.452294 + 0.013013*T + 0.000001639*T*T - 0.000000503*T*T*T;
@@ -145,8 +146,8 @@
 }
 
-// XXX: Add a date argument to determine the correct year.
 psSphereTransform *psSphereTransformEcliptictoICRS(void)
 {
-    double year = 2004.0;
+    struct tm *tmTime = psTimeToTM(time);
+    double year = (double) (1900 + tmTime->tm_year);
     double T = year / 100.0;
     double phi = +23.452294 - 0.013013*T - 0.000001639*T*T + 0.000000503*T*T*T;
@@ -285,4 +286,6 @@
 }
 
+// XXX: Do I need to check for unacceptable transformation parameters?
+// Maybe, if the points are on the North/South Pole, etc?
 psSphere *psSphereGetOffset(const psSphere *restrict position1,
                             const psSphere *restrict position2,
@@ -290,13 +293,28 @@
                             psSphereOffsetUnit unit)
 {
-    //    psPlane lin;
+    psPlane *lin;
+    psProjection proj;
     psSphere *tmp;
-    //    psProjection proj;
     double tmpR = 0.0;
     double tmpD = 0.0;
 
     if (mode == PS_LINEAR) {
-        // XXX: I have no idea how to construct this.
-        return(NULL);
+        // XXX: I have no idea how to construct this.  Maybe project both
+        // sperical positions onto the plane, set the origin at one of the
+        // points on the plane, then deproject?
+
+        // XXX: Do I need to somehow scale this projection?
+        // project position1?  Will it project to (0.0, 0.0)?
+        proj.R = position1->r;
+        proj.D = position1->d;
+        proj.Xs = 1.0;
+        proj.Ys = 1.0;
+        proj.type = PS_PROJ_TAN;
+
+        lin = psProject(position2, proj);
+        tmp = psDeproject(lin, proj);
+
+        // XXX: Do we need to convert units in tmp?
+        return(tmp);
     } else if (mode == PS_SPHERICAL) {
         tmpR = position2->r - position1->r;
@@ -314,5 +332,5 @@
         } else if (unit == PS_RADIAN) {}
         else {
-            psAbort(__func__, "Unknow offset unit: 0x%x\n", unit);
+            psAbort(__func__, "Unknown offset unit: 0x%x\n", unit);
         }
 
@@ -330,4 +348,6 @@
 
 
+// XXX: Do I need to check for unacceptable transformation parameters?
+// Maybe, if the points are on the North/South Pole, etc?
 // XXX: I copied the algorithm from the ADD exactly.
 psSphere *psSphereSetOffset(const psSphere *restrict position,
@@ -369,5 +389,5 @@
             tmpD = offset->d;
         } else {
-            psAbort(__func__, "Unknow offset unit: 0x%x\n", unit);
+            psAbort(__func__, "Unknown offset unit: 0x%x\n", unit);
         }
 
