Index: trunk/psLib/src/astronomy/psAstrometry.c
===================================================================
--- trunk/psLib/src/astronomy/psAstrometry.c	(revision 1440)
+++ trunk/psLib/src/astronomy/psAstrometry.c	(revision 1463)
@@ -1,3 +1,2 @@
-
 /** @file  psAstrometry.c
 *
@@ -9,6 +8,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-09 23:34:57 $
+*  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-10 23:59:41 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -21,5 +20,4 @@
 #include "psMemory.h"
 
-static void grommitFree(psGrommit* grommit);
 static int checkValidChipCoords(double x, double y, psChip* tmpChip);
 static int checkValidImageCoords(double x, double y, psImage* tmpImage);
@@ -49,4 +47,8 @@
 }
 
+/*
+    Several members of the psGrommit data structure have no direct counterpart
+    in the psExposure structure.  How are we to determine them?
+*/
 psGrommit* psGrommitAlloc(const psExposure* exp)
 {
@@ -79,5 +81,5 @@
 }
 
-void p_psGrommitFree(psGrommit* grommit)
+void psGrommitFree(psGrommit* grommit)
 {
     psFree(grommit);
@@ -94,4 +96,7 @@
 }
 
+/*
+    XXX: do this
+*/
 int checkValidChipCoords(double x, double y, psChip* tmpChip)
 {
@@ -120,4 +125,7 @@
 }
 
+/*
+    XXX: do this
+*/
 int checkValidImageCoords(double x, double y, psImage* tmpImage)
 {
@@ -142,4 +150,5 @@
 psCell* psCellinChip(psCell* out, const psPlane* coord, const psChip* chip)
 {
+    int i = 0;
     psPlane* tmpCoord = NULL;
     psArray* cells;
@@ -155,5 +164,5 @@
     }
 
-    for (int i = 0; i < cells->n; i++) {
+    for (i = 0; i < cells->n; i++) {
         psCell* tmpCell = (psCell* ) cells->data[i];
         psArray* readouts = tmpCell->readouts;
@@ -210,5 +219,7 @@
 // transformation, as well as a few psPlane structs.  Can this be implemented
 // better?
-psSphere* psCoordCelltoSky(psSphere* out, const psPlane* in, const psCell* cell)
+psSphere* psCoordCelltoSky(psSphere* out,
+                           const psPlane* in,
+                           const psCell* cell)
 {
     psPlane* tmp1 = NULL;
@@ -216,16 +227,18 @@
     psFPA* parFPA = (cell->parent)->parent;
     psGrommit* tmpGrommit = NULL;
+    float XXX1 = 0.0;
+    float XXX2 = 0.0;
+
 
     tmp1 = psPlaneTransformApply(tmp1, cell->toFPA, in);
-    tmp2 = psPlaneTransformApply(tmp2, parFPA->toTangentPlane, tmp1);
+    // XXX:
+    //
+    tmp2 = psPlaneDistortApply(tmp2, parFPA->toTangentPlane, tmp1, XXX1, XXX2);
     tmpGrommit = psGrommitAlloc(parFPA->exposure);
-    tmp3 = psCoordTPtoSky(out, tmp2, psGrommit);
-
     psFree(tmp1);
     psFree(tmp2);
     psFree(tmpGrommit);
 
-    return (psCoordTPtoSky(out, tmp2, psGrommit));
-
+    return(psCoordTPtoSky(out, tmp2, tmpGrommit));
 }
 
@@ -247,24 +260,34 @@
 psPlane* psCoordSkytoTP(psPlane* out, const psSphere* in, const psGrommit* grommit)
 {
-    extern void sla_AOPQK(RAP, DAP, AOPRMS, AOB, ZOB, HOB, DOB, ROB);
-    double AOB;
-    double ZOB;
-    double HOB;
-    double DOB;
-    double ROB;
-
-    if (out == NULL) {
-        out = (psPlane* ) psAlloc(sizeof(psPlane));
-    }
-
-    sla_AOPQK(psSphere->r, psSphere->d, *grommit, &AOB, &ZOB, &HOB, &DOB, &ROB);
-    out->x = XXX;
-    out->y = XXX;
-    return (out);
-}
-
+    /*
+        extern void sla_AOPQK(RAP, DAP, AOPRMS, AOB, ZOB, HOB, DOB, ROB);
+        double AOB;
+        double ZOB;
+        double HOB;
+        double DOB;
+        double ROB;
+     
+        if (out == NULL) {
+            out = (psPlane* ) psAlloc(sizeof(psPlane));
+        }
+     
+        sla_AOPQK(psSphere->r, psSphere->d, *grommit, &AOB, &ZOB, &HOB, &DOB, &ROB);
+        out->x = XXX;
+        out->y = XXX;
+        return (out);
+    */
+    return(NULL);
+}
+
+
+/*
+    XXX: What are the XXX1 and XXX2 args supposed to be?
+*/
 psPlane* psCoordTPtoFPA(psPlane* out, const psPlane* in, const psFPA* fpa)
 {
-    return (psPlaneTransformApply(out, fpa->fromTangentPlane, in));
+    float XXX1 = 0.0;
+    float XXX2 = 0.0;
+
+    return (psPlaneDistortApply(out, fpa->fromTangentPlane, in, XXX1, XXX2));
 }
 
@@ -281,5 +304,10 @@
 psPlane* psCoordSkytoCell(psPlane* out, const psSphere* in, const psCell* cell)
 {
-    out = psCoordSkytoTP(out, in, tmpGrommit);
+    psGrommit* XXXGrommit = NULL;
+    psFPA *whichFPA = NULL;
+    psChip *whichChip = NULL;
+    psCell *whichCell = NULL;
+
+    out = psCoordSkytoTP(out, in, XXXGrommit);
     out = psCoordTPtoFPA(out, out, whichFPA);
     out = psCoordFPAtoChip(out, out, whichChip);
