Index: trunk/psLib/src/astronomy/psCoord2.c
===================================================================
--- trunk/psLib/src/astronomy/psCoord2.c	(revision 1325)
+++ trunk/psLib/src/astronomy/psCoord2.c	(revision 1374)
@@ -1,3 +1,18 @@
-// This file contains
+/** @file  psCoord2.c
+*
+*  @brief Contains basic coordinate transformation definitions and operations
+*
+*  This file defines the basic types for astronomical coordinate 
+*  transformation
+*
+*  @ingroup CoordinateTransform
+*
+*  @author George Gusciora, MHPCC
+*
+*  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-04 00:55:17 $
+*
+*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+*/
 
 #include "psType.h"
@@ -7,11 +22,11 @@
 #include "psFunctions.h"
 
-psGrommit *psGrommitAlloc(const psExposure *exp)
-{
-    psGrommit *grommit = (psGrommit *) psAlloc(sizeof(psGrommit));
-
+psGrommit *psGrommitAlloc( const psExposure *exp )
+{
+    psGrommit * grommit = ( psGrommit * ) psAlloc( sizeof( psGrommit ) );
+    
     grommit->latitude = exp->dec;              // XXX Is this correct?
-    grommit->sinLat = sin(grommit->latitude);
-    grommit->cosLat = cos(grommit->latitude);
+    grommit->sinLat = sin( grommit->latitude );
+    grommit->cosLat = cos( grommit->latitude );
     grommit->abberationMag = 0.0;
     grommit->height = 0.0;
@@ -25,39 +40,39 @@
     grommit->longitudeOffset = ra;             // XXX Is this correct?
     grommit->siderealTime = 0.0;
-
-    return(grommit);
-}
-
-void p_psGrommitFree(psGrommit *grommit)
-{
-    psFree(grommit);
-}
-
-psCell *psCellinFPA(psCell *out,
-                    const psPlane *coord,
-                    const psFPA *FPA)
-{
-    psChip *tmpChip = NULL;
+    
+    return ( grommit );
+}
+
+void p_psGrommitFree( psGrommit *grommit )
+{
+    psFree( grommit );
+}
+
+psCell *psCellinFPA( psCell *out,
+                     const psPlane *coord,
+                     const psFPA *FPA )
+{
+    psChip * tmpChip = NULL;
     psCell *tmpCell = NULL;
-
-    tmpChip = psChipinFPA(tmpChip, coord, FPA);
-    tmpCell = psCellinChip(tmpCell, coord, tmpChip);
-    return(tmpCell);
-}
-
-
-psChip *psChipinFPA(psChip *out,
-                    const psPlane *coord,
-                    const psFPA *FPA)
-{
-    psFPA *tmpChip = NULL;
-
-    for (tmpChip = FPA->chips; tmpChip != NULL; tmpChip++) {
-        tmpCoord = psPlaneTransformApply(out, tmpChip->fromFPA, coord);
-
-
-        //XXX     if (this is the correct chip)
-        return(tmpChip);
-    }
+    
+    tmpChip = psChipinFPA( tmpChip, coord, FPA );
+    tmpCell = psCellinChip( tmpCell, coord, tmpChip );
+    return ( tmpCell );
+}
+
+
+psChip *psChipinFPA( psChip *out,
+                     const psPlane *coord,
+                     const psFPA *FPA )
+{
+    psFPA * tmpChip = NULL;
+    
+    for ( tmpChip = FPA->chips; tmpChip != NULL; tmpChip++ ) {
+            tmpCoord = psPlaneTransformApply( out, tmpChip->fromFPA, coord );
+            
+            
+            //XXX     if (this is the correct chip)
+            return ( tmpChip );
+        }
 }
 
@@ -66,11 +81,11 @@
 p_psCheckValidImageCoords(double x, double y, tmpImage)
 {
-    if ((x < 0.0) ||
-            (x > (double) tmpImage->numCols) ||
-            (y < 0.0) ||
-            (y > (double) tmpImage->numRows)) {
-        return(0);
-    }
-    return(1);
+    if ( ( x < 0.0 ) ||
+            ( x > ( double ) tmpImage->numCols ) ||
+            ( y < 0.0 ) ||
+            ( y > ( double ) tmpImage->numRows ) ) {
+            return ( 0 );
+        }
+    return ( 1 );
 }
 
@@ -88,57 +103,57 @@
 XXX: must deallocate memory.
  *****************************************************************************/
-psCell *psCellinChip(psCell *out,
-                     const psPlane *coord,
-                     const psChip *chip)
-{
-    psCell *tmpCell = NULL;
+psCell *psCellinChip( psCell *out,
+                      const psPlane *coord,
+                      const psChip *chip )
+{
+    psCell * tmpCell = NULL;
     psReadout *tmpReadout = NULL;
     psPlane *tmpCoord = NULL;
-
-    for (tmpCell = chip->cells; tmpCell != NULL; tmpCell++) {
-        if (tmpCell->readouts != NULL) {
-            tmpReadout = tmpCell->readouts;
-            tmpCoord = psPlaneTransformApply(out, tmpCell->fromChip, coord);
-            if (p_psCheckValidImageCoords(tmpCoord->x, tmpCoord->y,
-                                          tmpReadout->image)) {
-                return(tmpCell);
-            }
+    
+    for ( tmpCell = chip->cells; tmpCell != NULL; tmpCell++ ) {
+            if ( tmpCell->readouts != NULL ) {
+                    tmpReadout = tmpCell->readouts;
+                    tmpCoord = psPlaneTransformApply( out, tmpCell->fromChip, coord );
+                    if ( p_psCheckValidImageCoords( tmpCoord->x, tmpCoord->y,
+                                                    tmpReadout->image ) ) {
+                            return ( tmpCell );
+                        }
+                }
         }
-    }
-    return(NULL);
-}
-
-psPlane *psCoordCelltoChip(psPlane *out,
+    return ( NULL );
+}
+
+psPlane *psCoordCelltoChip( psPlane *out,
+                            const psPlane *in,
+                            const psCell *cell )
+{
+    return ( psPlaneTransformApply( out, cell->toChip, in ) );
+}
+
+psPlane *psCoordChipToFPA( psPlane *out,
                            const psPlane *in,
-                           const psCell *cell)
-{
-    return(psPlaneTransformApply(out, cell->toChip, in));
-}
-
-psPlane *psCoordChipToFPA(psPlane *out,
+                           const psChip *chip )
+{
+    return ( psPlaneTransformApply( out, chip->toFPA, in ) );
+}
+
+psPlane *psCoordFPAtoTP( psPlane *out,
+                         const psPlane *in,
+                         const psFPA *fpa )
+{
+    return ( psPlaneTransformApply( out, fpa->toTangentPlane, in ) );
+}
+
+psSphere *psCoordTPtoSky( psSphere *out,
                           const psPlane *in,
-                          const psChip *chip)
-{
-    return(psPlaneTransformApply(out, chip->toFPA, in));
-}
-
-psPlane *psCoordFPAtoTP(psPlane *out,
-                        const psPlane *in,
-                        const psFPA *fpa)
-{
-    return(psPlaneTransformApply(out, fpa->toTangentPlane, in));
-}
-
-psSphere *psCoordTPtoSky(psSphere *out,
-                         const psPlane *in,
-                         const psGrommit *grommit)
+                          const psGrommit *grommit )
 {}
 
 
-psPlane *psCoordCellToFPA(psPlane *out,
-                          const psPlane *in,
-                          const psCell *cell)
-{
-    return(psPlaneTransformApply(out, cell->toFPA, in));
+psPlane *psCoordCellToFPA( psPlane *out,
+                           const psPlane *in,
+                           const psCell *cell )
+{
+    return ( psPlaneTransformApply( out, cell->toFPA, in ) );
 }
 
@@ -147,96 +162,97 @@
 // transformation, as well as a few psPlane structs.  Can this be implemented
 // better?
-psSphere *psCoordCelltoSky(psSphere *out,
-                           const psPlane *in,
-                           const psCell *cell)
-{
-    psPlane *tmp1 = NULL;
+psSphere *psCoordCelltoSky( psSphere *out,
+                            const psPlane *in,
+                            const psCell *cell )
+{
+    psPlane * tmp1 = NULL;
     psPlane *tmp2 = NULL;
-    psFPA *parFPA = (cell->parent)->parent;
+    psFPA *parFPA = ( cell->parent ) ->parent;
     psGrommit *tmpGrommit = NULL;
-
-    tmp1 = psPlaneTransformApply(tmp1, cell->toFPA, in)
-           tmp2 = psPlaneTransformApply(tmp2, parFPA->toTangentPlane, tmp1)
-                  tmpGrommit = psGrommitAlloc(parFPA->exposure)
-                               tmp3 = psCoordTPtoSky(out, tmp2, psGrommit);
-
-    psFree(tmp1);
-    psFree(tmp2);
-    psFree(tmpGrommit);
-
-    return(psCoordTPtoSky(out, tmp2, psGrommit);
-       }
-
-       psSphere *psCoordCelltoSkyQuick(psSphere *out,
-                                       const psPlane *in,
-                                       const psCell *cell)
-       {
-           psPlane *tmp1 = NULL;
-
-           tmp1 = psPlaneTransformApply(tmp1, cell->toSky, in);
-
-           //XXX: Do something to convert the linear coords in tmp1 to spherical
-           // coords in out.
-
-           free(tmp1)
-
-           return(out);
-       }
-
-       psPlane *psCoordSkytoTP(psPlane *out,
-                               const psSphere *in,
-                               const psGrommit *grommit)
-       {
-           if (out == NULL) {
-               out = (psPlane *) psAlloc(sizeof(psPlane));
-           }
-
-           return(out);
-       }
-
-       psPlane *psCoordTPtoFPA(psPlane *out,
-                               const psPlane *in,
-                               const psFPA *fpa)
-       {
-           return(psPlaneTransformApply(out, fpa->fromTangentPlane, in));
-       }
-
-       psPlane *psCoordFPAtoChip(psPlane *out,
-                                 const psPlane *in,
-                                 const psChip *chip)
-       {
-           return(psPlaneTransformApply(out, chip->fromFPA, in));
-       }
-
-
-       psPlane *psCoordChiptoCell(psPlane *out,
+    
+    tmp1 = psPlaneTransformApply( tmp1, cell->toFPA, in )
+           tmp2 = psPlaneTransformApply( tmp2, parFPA->toTangentPlane, tmp1 )
+                  tmpGrommit = psGrommitAlloc( parFPA->exposure )
+                               tmp3 = psCoordTPtoSky( out, tmp2, psGrommit );
+                               
+    psFree( tmp1 );
+    psFree( tmp2 );
+    psFree( tmpGrommit );
+    
+    return ( psCoordTPtoSky( out, tmp2, psGrommit );
+         }
+         
+         psSphere *psCoordCelltoSkyQuick( psSphere *out,
+                                          const psPlane *in,
+                                          const psCell *cell )
+         {
+             psPlane * tmp1 = NULL;
+             
+             tmp1 = psPlaneTransformApply( tmp1, cell->toSky, in );
+             
+             //XXX: Do something to convert the linear coords in tmp1 to spherical
+             // coords in out.
+             
+             free( tmp1 )
+             
+             return ( out );
+         }
+         
+         psPlane *psCoordSkytoTP( psPlane *out,
+                                  const psSphere *in,
+                                  const psGrommit *grommit )
+         {
+             if ( out == NULL ) {
+                     out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
+                 }
+                 
+             return ( out );
+         }
+         
+         psPlane *psCoordTPtoFPA( psPlane *out,
                                   const psPlane *in,
-                                  const psCell *cell)
-       {
-           return(psPlaneTransformApply(out, cell->fromChip, in));
-       }
-
-       psPlane *psCoordSkytoCell(psPlane *out,
-                                 const psSphere *in,
-                                 const psCell *cell)
-       {
-           out = psCoordSkytoTP(out, in, tmpGrommit);
-           out = psCoordTPtoFPA(out, out, whichFPA);
-           out = psCoordFPAtoChip(out, out, whichChip);
-           out = psCoordChiptoCell(out, out, whichCell);
-
-           return(out);
-       }
-
-       psPlane *psCoordSkytoCellQuick(psPlane *out,
-                                      const psSphere *in,
-                                      const psCell *cell)
-       {
-           if (out == NULL) {
-               out = (psPlane *) psAlloc(sizeof(psPlane));
-           }
-
-           return(out);
-       }
-
-
+                                  const psFPA *fpa )
+         {
+             return ( psPlaneTransformApply( out, fpa->fromTangentPlane, in ) );
+         }
+         
+         psPlane *psCoordFPAtoChip( psPlane *out,
+                                    const psPlane *in,
+                                    const psChip *chip )
+         {
+             return ( psPlaneTransformApply( out, chip->fromFPA, in ) );
+         }
+         
+         
+         psPlane *psCoordChiptoCell( psPlane *out,
+                                     const psPlane *in,
+                                     const psCell *cell )
+         {
+             return ( psPlaneTransformApply( out, cell->fromChip, in ) );
+         }
+         
+         psPlane *psCoordSkytoCell( psPlane *out,
+                                    const psSphere *in,
+                                    const psCell *cell )
+         {
+             out = psCoordSkytoTP( out, in, tmpGrommit );
+             out = psCoordTPtoFPA( out, out, whichFPA );
+             out = psCoordFPAtoChip( out, out, whichChip );
+             out = psCoordChiptoCell( out, out, whichCell );
+             
+             return ( out );
+         }
+         
+         psPlane *psCoordSkytoCellQuick( psPlane *out,
+                                         const psSphere *in,
+                                         const psCell *cell )
+         {
+             if ( out == NULL ) {
+                     out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
+                 }
+                 
+             return ( out );
+         }
+         
+         
+         
