Index: /trunk/psLib/src/astro/psCoord.c
===================================================================
--- /trunk/psLib/src/astro/psCoord.c	(revision 6229)
+++ /trunk/psLib/src/astro/psCoord.c	(revision 6230)
@@ -10,6 +10,6 @@
 *  @author GLG, MHPCC
 *
-*  @version $Revision: 1.101 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-01-26 21:10:22 $
+*  @version $Revision: 1.102 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2006-01-28 01:31:44 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -206,5 +206,6 @@
 
 // XXX: Verify the order/nterms poly changes
-psPlaneTransform* psPlaneTransformAlloc(int order1, int order2)
+psPlaneTransform* psPlaneTransformAlloc(int order1,
+                                        int order2)
 {
     PS_ASSERT_INT_NONNEGATIVE(order1, NULL);
@@ -240,8 +241,7 @@
 }
 
-psPlane* psPlaneTransformApply(
-    psPlane* out,
-    const psPlaneTransform* transform,
-    const psPlane* coords)
+psPlane* psPlaneTransformApply(psPlane* out,
+                               const psPlaneTransform* transform,
+                               const psPlane* coords)
 {
     PS_ASSERT_PTR_NON_NULL(transform, NULL);
@@ -267,5 +267,8 @@
 
 // XXX: Verify the order/nterms poly changes
-psPlaneDistort* psPlaneDistortAlloc(int order1, int order2, int order3, int order4)
+psPlaneDistort* psPlaneDistortAlloc(int order1,
+                                    int order2,
+                                    int order3,
+                                    int order4)
 {
     PS_ASSERT_INT_NONNEGATIVE(order1, NULL);
@@ -347,10 +350,9 @@
 }
 
-psProjection* psProjectionAlloc(
-    double R,
-    double D,
-    double Xs,
-    double Ys,
-    psProjectionType type)
+psProjection* psProjectionAlloc(double R,
+                                double D,
+                                double Xs,
+                                double Ys,
+                                psProjectionType type)
 {
     psProjection *p = psAlloc(sizeof(psProjection));
@@ -372,8 +374,7 @@
 
 
-psPlane* p_psProject(
-    psPlane *outPlane,
-    const psSphere* coord,
-    const psProjection* projection)
+psPlane* p_psProject(psPlane *outPlane,
+                     const psSphere* coord,
+                     const psProjection* projection)
 {
     PS_ASSERT_PTR_NON_NULL(coord, NULL);
@@ -457,8 +458,7 @@
 }
 
-psSphere* p_psDeproject(
-    psSphere *outSphere,
-    const psPlane* coord,
-    const psProjection* projection)
+psSphere* p_psDeproject(psSphere *outSphere,
+                        const psPlane* coord,
+                        const psProjection* projection)
 {
     PS_ASSERT_PTR_NON_NULL(coord, NULL);
@@ -604,10 +604,9 @@
 routine far too many times.
  *****************************************************************************/
-psPlaneTransform *psPlaneTransformCombine(
-    psPlaneTransform *out,
-    const psPlaneTransform *trans1,
-    const psPlaneTransform *trans2,
-    psRegion region,
-    int nSamples)
+psPlaneTransform *psPlaneTransformCombine(psPlaneTransform *out,
+        const psPlaneTransform *trans1,
+        const psPlaneTransform *trans2,
+        psRegion region,
+        int nSamples)
 {
     psTrace(__func__, 3, "---- %s() begin ----\n", __func__);
@@ -1016,9 +1015,7 @@
 }
 
-psPlane *psPlaneTransformDeriv(
-    psPlane *out,
-    const psPlaneTransform *transformation,
-    const psPlane *coord
-)
+psPlane *psPlaneTransformDeriv(psPlane *out,
+                               const psPlaneTransform *transformation,
+                               const psPlane *coord)
 {
     PS_ASSERT_PTR_NON_NULL(transformation, NULL);
@@ -1080,4 +1077,51 @@
     }
     return(out);
+}
+
+psPixels *psPixelsTransform(psPixels *out,
+                            const psPixels *input,
+                            const psPlaneTransform *inToOut)
+{
+    PS_ASSERT_PTR_NON_NULL(input, NULL);
+    PS_ASSERT_PTR_NON_NULL(inToOut, NULL);
+    PS_ASSERT_PTR_NON_NULL(inToOut->x, NULL);
+    PS_ASSERT_PTR_NON_NULL(inToOut->y, NULL);
+    if (out == NULL) {
+        //XXX: Should the length (nalloc) be 1 and append be used everytime a pixel is added?
+        //        out = psPixelsAlloc(input->nalloc);
+        out = psPixelsAlloc(1);
+    }
+    psPlane *coord = psPlaneAlloc();
+    psPlane *deriv = psPlaneAlloc();
+    psPlane *fxnVal = psPlaneAlloc();
+
+    int i = 0;
+    //    int m = 0;
+    //    while (input->data.x[i] != 0.0 && input->data.y[i] != 0.0) {
+    for ( i = 0; i < input->n; i++) {
+        coord->x = input->data[i].x;
+        coord->y = input->data[i].y;
+        deriv = psPlaneTransformDeriv(deriv, inToOut, coord);
+        fxnVal = psPlaneTransformApply(fxnVal, inToOut, coord);
+        if (fabs(fxnVal->x - coord->x) < fabs(deriv->x) &&
+                fabs(fxnVal->y - coord->y) < fabs(deriv->y)) {
+            int x = (int)(round(fabs(deriv->x)));
+            int y = (int)(round(fabs(deriv->y)));
+            for (int j = -x; j <= x; j++) {
+                for (int k = -y; k <= y; k++) {
+                    //                    out->data[m].x = fxnVal->x + x;
+                    //                    out->data[m].y = fxnVal->y + y;
+                    //                    m++;
+                    out = p_psPixelsAppend(out, 1, (float)(fxnVal->x+j),
+                                           (float)(fxnVal->y+k) );
+                }
+            }
+        }
+    }
+
+    psFree(coord);
+    psFree(deriv);
+    psFree(fxnVal);
+    return out;
 }
 
Index: /trunk/psLib/src/astro/psCoord.h
===================================================================
--- /trunk/psLib/src/astro/psCoord.h	(revision 6229)
+++ /trunk/psLib/src/astro/psCoord.h	(revision 6230)
@@ -11,6 +11,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-12-20 05:05:37 $
+ *  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-01-28 01:31:44 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -25,4 +25,5 @@
 #include "psList.h"
 #include "psPolynomial.h"
+#include "psPixels.h"
 //#include "psTime.h"
 
@@ -435,4 +436,23 @@
 );
 
+/** Generates a list of pixels in the output coordinate frame that overlap the input
+ *  pixels in the input coordinate frame through the specified transformation, inToOut.
+ *
+ *  psPixelsTransform is more complicated than simply transforming the input pixels,
+ *  but requires the evaluation of the derivatives of the transformation in order to
+ *  obtain the list of all pixels in the output coordinate frame that possibly overlap
+ *  the pixel in the input coordinate frame.  In the event that input or inToOut are
+ *  NULL, the function shall generate an error and return NULL.  If out is non-NULL it
+ *  shall be modified and returned;  otherwise a new psPixels shall be allocated and
+ *  returned.
+ *
+ *  @return psPixels*:      the list of overlapping pixels.
+ */
+psPixels *psPixelsTransform(
+    psPixels *out,                     ///< output list of overlapping pixels
+    const psPixels *input,             ///< input list of pixels
+    const psPlaneTransform *inToOut    ///< specified transformation
+);
+
 /// @}
 
Index: /trunk/psLib/src/astro/psEarthOrientation.c
===================================================================
--- /trunk/psLib/src/astro/psEarthOrientation.c	(revision 6229)
+++ /trunk/psLib/src/astro/psEarthOrientation.c	(revision 6230)
@@ -8,6 +8,6 @@
  *  @author Robert Daniel DeSonia, MHPCC
  *
- *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-01-26 21:10:22 $
+ *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-01-28 01:31:44 $
  *
  *  Copyright 2005 Maui High Performance Computing Center, University of Hawaii
@@ -1112,4 +1112,5 @@
     // Convert psTime to MJD
     double MJD = psTimeToMJD(time);
+    printf("\nMJD check = %.13g\n", MJD);
     if (MJD == NAN) {
         psError(PS_ERR_BAD_PARAMETER_VALUE, false,
Index: /trunk/psLib/src/types/psPixels.h
===================================================================
--- /trunk/psLib/src/types/psPixels.h	(revision 6229)
+++ /trunk/psLib/src/types/psPixels.h	(revision 6230)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-11-16 23:06:35 $
+ *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-01-28 01:31:44 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -41,5 +41,5 @@
 typedef struct
 {
-    long n;                            ///< Number in usa
+    long n;                            ///< Number in use
     const long nalloc;                 ///< Number allocated
     psPixelCoord* data;                ///< The pixel coordinates
