Index: trunk/psLib/src/astronomy/psAstrometry.h
===================================================================
--- trunk/psLib/src/astronomy/psAstrometry.h	(revision 1476)
+++ trunk/psLib/src/astronomy/psAstrometry.h	(revision 1479)
@@ -8,6 +8,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-11 20:08:05 $
+*  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-11 22:01:35 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -163,19 +163,19 @@
 typedef struct psFPA
 {
-    psArray* chips;             ///< chips in the focal plane array
-    psMetadata* metadata;       ///< focal-plane's metadata
-
-    psPlaneDistort* fromTangentPlane;   ///< transformation from tangent plane to focal plane
-    psPlaneDistort* toTangentPlane;     ///< transformation from focal plane to tangent plane
-    psFixedPattern* pattern;    ///< fixed pattern residual offsets
-
-    const struct psExposure* exposure;  ///< information about this exposure
-
-    psPhotSystem* colorPlus;    ///< Color reference
-    psPhotSystem* colorMinus;   ///< Color reference
-
-    float rmsX;                 ///< RMS for x transformation fits
-    float rmsY;                 ///< RMS for y transformation fits
-    float chi2;                 ///< chi^2 of astrometric solution
+    psArray* chips;                    ///< chips in the focal plane array
+    psMetadata* metadata;              ///< focal-plane's metadata
+
+    psPlaneDistort* fromTangentPlane;  ///< transformation from tangent plane to focal plane
+    psPlaneDistort* toTangentPlane;    ///< transformation from focal plane to tangent plane
+    psFixedPattern* pattern;           ///< fixed pattern residual offsets
+
+    const struct psExposure* exposure; ///< information about this exposure
+
+    psPhotSystem* colorPlus;           ///< Color reference
+    psPhotSystem* colorMinus;          ///< Color reference
+
+    float rmsX;                        ///< RMS for x transformation fits
+    float rmsY;                        ///< RMS for y transformation fits
+    float chi2;                        ///< chi^2 of astrometric solution
 }
 psFPA;
@@ -190,40 +190,49 @@
 typedef struct psExposure
 {
-    const double ra;            ///< Telescope boresight, right ascention
-    const double dec;           ///< Telescope boresight, declination
-    const double hourAngle;     ///< Hour angle
-    const double zenith;        ///< Zenith distance
-    const double azimuth;       ///< Azimuth
-    const double localTime;     ///< Local Sidereal Time
-    const float date;           ///< Modified Jullian Date of observation
-    const float rotAngle;       ///< Rotator position angle
-    const float temperature;    ///< Air temperature, for estimating refraction
-    const float pressure;       ///< Air pressure, for calculating refraction
-    const float humidity;       ///< Relative humidity, for refraction
-    const float exposureTime;   ///< Exposure time
+    const double ra;                   ///< Telescope boresight, right ascention
+    const double dec;                  ///< Telescope boresight, declination
+    const double hourAngle;            ///< Hour angle
+    const double zenith;               ///< Zenith distance
+    const double azimuth;              ///< Azimuth
+    const double localTime;            ///< Local Sidereal Time
+    const float date;                  ///< Modified Jullian Date of observation
+    const float rotAngle;              ///< Rotator position angle
+    const float temperature;           ///< Air temperature, for estimating refraction
+    const float pressure;              ///< Air pressure, for calculating refraction
+    const float humidity;              ///< Relative humidity, for refraction
+    const float exposureTime;          ///< Exposure time
 
     /* Derived quantities */
-    const float positionAngle;  ///< Position angle
-    const float parallacticAngle;       ///< Parallactic angle
-    const float airmass;        ///< Airmass, calculated from zenith distance
-    const float parallacticFactor;      ///< Parallactic factor
-    const char *cameraName;     ///< name of camera which provided exposure
-    const char *telescopeName;  ///< name of telescope which provided exposure
+    const float positionAngle;         ///< Position angle
+    const float parallacticAngle;      ///< Parallactic angle
+    const float airmass;               ///< Airmass, calculated from zenith distance
+    const float parallacticFactor;     ///< Parallactic factor
+    const char *cameraName;            ///< name of camera which provided exposure
+    const char *telescopeName;         ///< name of telescope which provided exposure
 }
 psExposure;
 
-psExposure* psExposureAlloc(double ra,  ///< Telescope boresight, right ascention
-                            double dec, ///< Telescope boresight, declination
-                            double hourAngle,   ///< Hour angle
-                            double zenith,      ///< Zenith distance
-                            double azimuth,     ///< Azimuth
-                            double localTime,   ///< Local Sidereal Time
-                            float date, ///< MJD
-                            float rotAngle,     ///< Rotator position angle
-                            float temperature,  ///< Temperature
-                            float pressure,     ///< Pressure
-                            float humidity,     ///< Relative humidity
-                            float exposureTime  ///< Exposure time
-                           );
+/** Allocator for psExposure
+ *
+ *  We need several quantities from the telescope in order to make a first 
+ *  guess at the astrometric solution. From these quantities, further 
+ *  quantities can be derived and stored for later use.
+ *
+ *  @return     psExposure*    new psExposure struct
+ */
+psExposure* psExposureAlloc(
+    double ra,                         ///< Telescope boresight, right ascention
+    double dec,                        ///< Telescope boresight, declination
+    double hourAngle,                  ///< Hour angle
+    double zenith,                     ///< Zenith distance
+    double azimuth,                    ///< Azimuth
+    double localTime,                  ///< Local Sidereal Time
+    float date,                        ///< MJD
+    float rotAngle,                    ///< Rotator position angle
+    float temperature,                 ///< Temperature
+    float pressure,                    ///< Pressure
+    float humidity,                    ///< Relative humidity
+    float exposureTime                 ///< Exposure time
+);
 
 /** Allocates a Wallace's Grommit structure.
@@ -234,42 +243,169 @@
  *  @return psGrommit* New grommit structure.
  */
-psGrommit* psGrommitAlloc(const psExposure* exp        ///< the cooresponding exposure structure.
-                         );
-
-/// XXX: This is defined as a private p_ps() type of function in the SDRS.
-/// I changed this to a public function.
-void psGrommitFree(psGrommit *grommit);
-
-psCell* psCellinFPA(psCell* out, const psPlane* coord, const psFPA* FPA);
-
-psChip* psChipinFPA(psChip* out, const psPlane* coord, const psFPA* FPA);
-
-psCell* psCellinChip(psCell* out, const psPlane* coord, const psChip* chip);
-
-psPlane* psCoordCelltoChip(psPlane* out, const psPlane* in, const psCell* cell);
-
-psPlane* psCoordChipToFPA(psPlane* out, const psPlane* in, const psChip* chip);
-
-psPlane* psCoordFPAtoTP(psPlane* out, const psPlane* in, const psFPA* fpa);
-
-psSphere* psCoordTPtoSky(psSphere* out, const psPlane* in, const psGrommit* grommit);
-
-psPlane* psCoordCellToFPA(psPlane* out, const psPlane* in, const psCell* cell);
-
-psSphere* psCoordCelltoSky(psSphere* out, const psPlane* in, const psCell* cell);
-
-psSphere* psCoordCelltoSkyQuick(psSphere* out, const psPlane* in, const psCell* cell);
-
-psPlane* psCoordSkytoTP(psPlane* out, const psSphere* in, const psGrommit* grommit);
-
-psPlane* psCoordTPtoFPA(psPlane* out, const psPlane* in, const psFPA* fpa);
-
-psPlane* psCoordFPAtoChip(psPlane* out, const psPlane* in, const psChip* chip);
-
-psPlane* psCoordChiptoCell(psPlane* out, const psPlane* in, const psCell* cell);
-
-psPlane* psCoordSkytoCell(psPlane* out, const psSphere* in, const psCell* cell);
-
-psPlane* psCoordSkytoCellQuick(psPlane* out, const psSphere* in, const psCell* cell);
+psGrommit* psGrommitAlloc(
+    const psExposure* exp              ///< the cooresponding exposure structure.
+);
+
+/** Find cooresponding cell for given FPA coordinate
+ *
+ *  @return psCell*    the cell cooresponding to the coord in FPA
+ */
+psCell* psCellInFPA(
+    psCell* out,                       ///< a cell struct to recycle. If NULL, a new struct is created
+    const psPlane* coord,              ///< the coordinate in FPA plane
+    const psFPA* FPA                   ///< the FPA to search for the cell
+);
+
+/** Find cooresponding chip for given FPA coordinate
+ *
+ *  @return psChip*    the chip cooresponding to coord
+ */
+psChip* psChipInFPA(
+    psChip* out,                       ///< a chip struct to recycle. If NULL, a new struct is created
+    const psPlane* coord,              ///< the coordinate in FPA plane
+    const psFPA* FPA                   ///< the FPA to search for the cell
+);
+
+/** Find cooresponding cell for given Chip coordinate
+ *
+ *  @return psCell*    the cell cooresponding to coord
+ */
+psCell* psCellInChip(
+    psCell* out,                       ///< a cell struct to recycle. If NULL, a new struct is created
+    const psPlane* coord,              ///< the coordinate in Chip plane
+    const psChip* chip                 ///< the chip to search for the cell
+);
+
+/** Translate a cell coordinate into a chip coordinate
+ *
+ *  @return psPlane*    the resulting chip coordinate
+ */
+psPlane* psCoordCellToChip(
+    psPlane* out,                      ///< a plane struct to recycle. If NULL, a new struct is created
+    const psPlane* in,                 ///< the coordinate within Cell
+    const psCell* cell                 ///< the Cell in interest
+);
+
+/** Translate a chip coordinate into a FPA coordinate
+ *
+ *  @return psPlane*    the resulting FPA coordinate
+ */
+psPlane* psCoordChipToFPA(
+    psPlane* out,                      ///< a plane struct to recycle. If NULL, a new struct is created
+    const psPlane* in,                 ///< the coordinate within Chip
+    const psChip* chip                 ///< the chip in interest
+);
+
+/** Translate a FPA coordinate into a Tangent Plane coordinate
+ *
+ *  @return psPlane*    the resulting Tangent Plane coordinate
+ */
+psPlane* psCoordFPAToTP(
+    psPlane* out,                      ///< a plane struct to recycle. If NULL, a new struct is created
+    const psPlane* in,                 ///< the coordinate within FPA
+    const psFPA* fpa                   ///< the FPA in interest
+);
+
+/** Translate a Tangent Plane coordinate into a Sky coordinate
+ *
+ *  @return psSphere*    the resulting Sky coordinate
+ */
+psSphere* psCoordTPToSky(
+    psSphere* out,                     ///< a sphere struct to recycle. If NULL, a new struct is created
+    const psPlane* in,                 ///< the coordinate within Tangent Plane
+    const psGrommit* grommit           ///< the grommit of the tangent plane
+);
+
+/** Translate a cell coordinate into a FPA coordinate
+ *
+ *  @return psPlane*    the resulting FPA coordinate
+ */
+psPlane* psCoordCellToFPA(
+    psPlane* out,                      ///< a plane struct to recycle. If NULL, a new struct is created
+    const psPlane* in,                 ///< the coordinate within cell
+    const psCell* cell                 ///< the cell in interest
+);
+
+/** Translate a cell coordinate into a Sky coordinate
+ *
+ *  @return psSphere*    the resulting Sky coordinate
+ */
+psSphere* psCoordCellToSky(
+    psSphere* out,                     ///< a sphere struct to recycle. If NULL, a new struct is created
+    const psPlane* in,                 ///< the coordinate within cell
+    const psCell* cell                 ///< the cell in interest
+);
+
+/** Translate a cell coordinate into a Sky coordinate using a 'quick and
+ *  dirty' method
+ *
+ *  @return psSphere*    the resulting Sky coordinate
+ */
+psSphere* psCoordCellToSkyQuick(
+    psSphere* out,                     ///< a sphere struct to recycle. If NULL, a new struct is created
+    const psPlane* in,                 ///< the coordinate within cell
+    const psCell* cell                 ///< the cell in interest
+);
+
+/** Translate a Sky coordinate into a Tangent Plane coordinate
+ *
+ *  @return psPlane*    the resulting Tangent Plane coordinate
+ */
+psPlane* psCoordSkyToTP(
+    psPlane* out,                      ///< a plane struct to recycle. If NULL, a new struct is created
+    const psSphere* in,                ///< the sky coordinate
+    const psGrommit* grommit           ///< the grommit
+);
+
+/** Translate a Tangent Plane coordinate into a FPA coordinate
+ *
+ *  @return psPlane*    the resulting FPA coordinate
+ */
+psPlane* psCoordTPToFPA(
+    psPlane* out,                      ///< a plane struct to recycle. If NULL, a new struct is created
+    const psPlane* in,                 ///< the coordinate within tangent plane
+    const psFPA* fpa                   ///< the FPA of interest
+);
+
+/** Translate a FPA coordinate into a chip coordinate
+ *
+ *  @return psPlane*    the resulting chip coordinate
+ */
+psPlane* psCoordFPAToChip(
+    psPlane* out,                      ///< a plane struct to recycle. If NULL, a new struct is created
+    const psPlane* in,                 ///< the FPA coordinate
+    const psChip* chip                 ///< the chip of interest
+);
+
+/** Translate a chip coordinate into a cell coordinate
+ *
+ *  @return psPlane*    the resulting cell coordinate
+ */
+psPlane* psCoordChipToCell(
+    psPlane* out,                      ///< a plane struct to recycle. If NULL, a new struct is created
+    const psPlane* in,                 ///< the Chip coordinate
+    const psCell* cell                 ///< the cell of interest
+);
+
+/** Translate a sky coordinate into a cell coordinate
+ *
+ *  @return psPlane*    the resulting cell coordinate
+ */
+psPlane* psCoordSkyToCell(
+    psPlane* out,                      ///< a plane struct to recycle. If NULL, a new struct is created
+    const psSphere* in,                ///< the Sky coordinate
+    const psCell* cell                 ///< the cell of interest
+);
+
+/** Translate a sky coordinate into a cell coordinate using a 'quick and
+ *  dirty' method
+ *
+ *  @return psPlane*    the resulting cell coordinate
+ */
+psPlane* psCoordSkyToCellQuick(
+    psPlane* out,                      ///< a plane struct to recycle. If NULL, a new struct is created
+    const psSphere* in,                ///< the Sky coordinate
+    const psCell* cell                 ///< the cell of interest
+);
 
 #endif
