Index: /trunk/psLib/src/astro/psCoord.c
===================================================================
--- /trunk/psLib/src/astro/psCoord.c	(revision 1490)
+++ /trunk/psLib/src/astro/psCoord.c	(revision 1491)
@@ -1,3 +1,2 @@
-
 /** @file  psCoord.c
 *
@@ -11,6 +10,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-11 20:07:44 $
+*  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-11 23:53:54 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/astronomy/psAstrometry.c
===================================================================
--- /trunk/psLib/src/astronomy/psAstrometry.c	(revision 1490)
+++ /trunk/psLib/src/astronomy/psAstrometry.c	(revision 1491)
@@ -8,6 +8,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-11 23:25:18 $
+*  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-11 23:53:42 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -313,5 +313,6 @@
 
 /*****************************************************************************
-XXX: not done
+XXX: After I deproject the tangent plane to a sphere, do I have to do a
+spherical transformation to get it to the sky?
  *****************************************************************************/
 psSphere* psCoordCellToSkyQuick(psSphere* outSphere,
@@ -319,5 +320,8 @@
                                 const psCell* cell)
 {
-    psPlane* tmp1 = NULL;
+    psPlane *tpCoord = NULL;
+    psChip *chip = cell->parent;
+    psFPA *FPA = chip->parent;
+    psProjectionType oldProjectionType;
 
     if (outSphere == NULL) {
@@ -325,10 +329,17 @@
     }
 
-    tmp1 = psPlaneTransformApply(tmp1, cell->toSky, cellCoord);
-
-    // XXX: Do something to convert the linear coords in tmp1 to spherical
-    // coords in outSphere.
-
-    psFree(tmp1);
+    // Determine the tangent plane coordinates.
+    tpCoord = psPlaneTransformApply(tpCoord, cell->toTP, cellCoord);
+
+    // Save the old projection type and set the new projection type to TAN.
+    oldProjectionType = FPA->projection->type;
+    FPA->projection->type = PS_PROJ_TAN;
+
+    // Deproject the tangent plane coordinates a sphere.
+    outSphere = psDeproject(tpCoord, FPA->projection);
+
+    // Restore old projection type.  Free memory.
+    FPA->projection->type = oldProjectionType;
+    psFree(tpCoord);
 
     return (outSphere);
@@ -430,5 +441,5 @@
 
 /*****************************************************************************
-XXX: It is unclear how to perform this transformation.
+XXX: hmmm
  *****************************************************************************/
 psPlane* psCoordSkyToCellQuick(psPlane* cellCoord,
@@ -436,8 +447,28 @@
                                const psCell* cell)
 {
+    psPlane *tpCoord = NULL;
+    psChip *whichChip = cell->parent;
+    psFPA *whichFPA = whichChip->parent;
+    psProjectionType oldProjectionType;
+    psPlaneTransform *TPtoCell = NULL;
+
+    // Save the old projection type and set the new projection type to TAN.
+    oldProjectionType = whichFPA->projection->type;
+    whichFPA->projection->type = PS_PROJ_TAN;
+
     if (cellCoord == NULL) {
         cellCoord = (psPlane* ) psAlloc(sizeof(psPlane));
     }
 
+    tpCoord = psProject(skyCoord, whichFPA->projection);
+
+    // XXX: generate an error if cell->toTP is not linear.
+
+    // XXX: Invert cell->toTP, store in TPtoCell.
+    cellCoord = psPlaneTransformApply(cellCoord, TPtoCell, tpCoord);
+
+    // Restore old projection type.  Free memory.
+    whichFPA->projection->type = oldProjectionType;
+    psFree(tpCoord);
     return (cellCoord);
 }
