Index: trunk/archive/pslib/include/psPosition.h
===================================================================
--- trunk/archive/pslib/include/psPosition.h	(revision 247)
+++ trunk/archive/pslib/include/psPosition.h	(revision 251)
@@ -7,138 +7,37 @@
  */
 
-/***********************************************************************************************************/
+/*************************************************/
+typedef struct {
+    union {
+	double x;				//!< x position
+	double r;				//!< x position
+    }
+    union {
+	double xErr;				//!< Error in x position
+	double rErr;				//!< Error in x position
+    }
+    union {
+	double y;				//!< y position
+	double d;				//!< y position
+    }
+    union {
+	double yErr;				//!< Error in y position
+	double dErr;				//!< Error in y position
+    }
+} psCoord;
 
-/** Planets */
-typedef enum {
-    PS_MERCURY = 1,
-    PS_VENUS = 2,
-    PS_MARS = 4,
-    PS_JUPITER = 5,
-    PS_SATURN = 6,
-    PS_URANUS = 7,
-    PS_NEPTUNE = 8,
-    PS_PLUTO = 9
-} psPlanetNum;
+typedef struct {
+    psDPolynomial4D *x;
+    psDPolynomial4D *y;
+} psDistortion;
 
-/** Catalogues */
-typedef enum {
-    PS_PANSTARRS,			//!< Pan-STARRS object catalogue
-    PS_USNO,				//!< USNO-B1 catalogue
-    PS_2MASS,				//!< 2MASS catalogue
-    PS_TYCHO,				//!< Tycho catalogue
-    PS_UCAC2 = 4			//!< UCAC2 catalogue
-} psCatalogue;
+typedef struct {
+    psDPolynomial2D *x;
+    psDPolynomial2D *y;
+} psCoordXform;
 
-/***********************************************************************************************************/
+psCoord *psCoordXformApply (psCoordXform *frame, psCoord *coords);
 
-/** A position on an OTA */
-typedef struct {
-    int chip;				//!< Chip number
-    float x;				//!< x position
-    float xErr;				//!< Error in x position
-    float y;				//!< y position
-    float yErr;				//!< Error in y position
-} psOTAPos;
-
-/** Constructor */
-psOTAPos *
-psOTAPosAlloc(void);
-
-/** Destructor */
-void
-psOTAPosFree(psOTAPos *restrict myOTAPos	//!< Object to destroy
-    );
-
-/***********************************************************************************************************/
-
-/** A position on a cell */
-typedef psOTAPos psCellPos;		//!< Same thing as for an OTA.
-#define psCellPosAlloc() psOTAPosAlloc() //!< Constructor
-#define psCellPosFree(C) psOTAPosFree(C) //!< Destructor
-
-/***********************************************************************************************************/
-
-/** An array of detector positions */
-typedef struct {
-    psType type;			//!< Type of data.  THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT!
-    int size;				//!< Total number of elements available
-    int n;				//!< Number of elements in use
-    psOTAPos *arr;			//!< The array data
-} psOTAPosArray;
-
-/** Constructor */
-psOTAPosArray *psOTAPosArrayAlloc(int s, //!< Total number of elements to make available
-				  int n	//!< Number of elements that will be used
-    );
-/** Reallocator */
-psOTAPosArray *psOTAPosArrayRealloc(psOTAPosArray *myArray, //!< Array to reallocate
-				    int s	//!< Total number of elements to make available
-    );
-/** Destructor */
-void psOTAPosArrayFree(psOTAPosArray *restrict myArray //!< Array to free
-    );
-
-/***********************************************************************************************************/
-
-/*
- * \brief A simple RA/Dec position on the sky, default system is ICRS.  Double precision needed for
- * milli-arcsec.
- */
-typedef struct {
-    double ra;				//!< Right Ascension
-    double raErr;			//!< Error in RA
-    double dec;				//!< Declination
-    double decErr;			//!< Error in Dec
-} psSkyPos;
-
-/** Constructor */
-psSkyPos *
-psSkyPosAlloc(void);
-
-/** Destructor */
-void
-psSkyPosFree(psSkyPos *restrict mySkyPos	//!< Object to destroy
-    );
-
-/***********************************************************************************************************/
-
-/** An array of sky positions */
-typedef struct {
-    psType type;			//!< Type of data.  THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT!
-    int size;				//!< Total number of elements available
-    int n;				//!< Number of elements in use
-    psSkyPos *arr;			//!< The array data
-} psSkyPosArray;
-
-/** Constructor */
-psSkyPosArray *psSkyPosArrayAlloc(int s, //!< Total number of elements to make available
-				  int n	//!< Number of elements that will be used
-    );
-/** Reallocator */
-psSkyPosArray *psSkyPosArrayRealloc(psSkyPosArray *myArray, //!< Array to reallocate
-				    int s	//!< Total number of elements to make available
-    );
-/** Destructor */
-void psSkyPosArrayFree(psSkyPosArray *restrict myArray //!< Array to free
-    );
-
-/***********************************************************************************************************/
-
-/** Latitude and Longitude.  Double precision needed for milli-arcsec */
-typedef struct {
-    double lat;				//!< Latitude
-    double latErr;			//!< Error in Latitude
-    double lng;			        //!< Longitude (can't use "long")
-    double lngErr;			//!< Error in Longitude
-} psLatLong;
-
-/** Constructor */
-psLatLong *
-psLatLongAlloc(void);
-
-/** Destructor */
-void
-psLatLongFree(psLatLong *restrict myLatLong //!< Object to destroy
-    );
+psCoord *psDistortionApply (psCoordXform *frame, psCoord *coords);
 
 /***********************************************************************************************************/
@@ -147,14 +46,16 @@
 
 /** Get offset (RA,Dec) on the sky between two positions position1 and position2 may not be identical */
-psSkyPos *
-psGetOffset(const psSkyPos *restrict position1, //!< Position 1
-	    const psSkyPos *restrict position2 //!< Position 2
+psCoords *
+psGetOffset(const psCoords *restrict position1, //!< Position 1
+	    const psCoords *restrict position2, //!< Position 2
+	    char *system
 	    );
 
 /** Apply an offset to a position */
-psSkyPos *
-psApplyOffset(const psSkyPos *restrict position, //!< Position
-	      const psSkyPos *restrict offset //!< Offset
-	      );
+psCoords *
+psApplyOffset(const psCoords *restrict position, //!< Position
+	      const psCoords *restrict offset, //!< Offset
+	      char *system
+    );
 
 /***********************************************************************************************************/
@@ -163,10 +64,10 @@
 
 /** Get Sun Position */
-psSkyPos *
+psCoords *
 psGetSunPos(float mjd			//!< MJD to get position for
 	    );
 
 /** Get Moon position */
-psSkyPos *
+psCoords *
 psGetMoonPos(float mjd,			//!< MJD to get position for
 	     double latitude,		//!< Latitude for apparent position
@@ -180,16 +81,7 @@
 
 /** Get Planet positions */
-psSkyPos *
-psGetPlanetPos(psPlanetNum myPlanetNum, //!< Number for planet
-	       float mjd		//!< MJD to get position for
-	       );
-
-/** Get star list from catalogue */
-struct psObjectArray *
-psReadStarCatalogue(double ra,		//!< RA of centre of search
-		    double dec,		//!< Declination of centre of search
-		    float radius,	//!< Radius of search for stars in catalogue
-		    float mjd,		//!< The epoch (in MJD) for which to get positions
-		    psCatalogue myCatalogue //!< The catalogue to use
+psCoords *
+psGetSolarSystemPos(char *solarSystemObject, //!< Named S.S. object
+		    float mjd		//!< MJD to get position for
     );
 
@@ -199,21 +91,21 @@
 
 /** Convert ICRS to Ecliptic */
-psLatLong *
-psCoordinatesItoE(const psSkyPos *restrict coordinates //!< ICRS coordinates to convert
+psCoord *
+psCoordinatesItoE(const psCoord *restrict coordinates //!< ICRS coordinates to convert
 		  );
 
 /** Convert Ecliptic to ICRS */
-psSkyPos *
-psCoordinatesEtoI(const psLatLong *restrict coordinates //!< Ecliptic coordinates to convert
+psCoord *
+psCoordinatesEtoI(const psCoord *restrict coordinates //!< Ecliptic coordinates to convert
 		  );
 
 /** Convert ICRS to Galactic */
-psLatLong *
-psCoordinatesItoG(const psSkyPos *restrict coordinates //!< ICRS coordinates to convert
+psCoord *
+psCoordinatesItoG(const psCoord *restrict coordinates //!< ICRS coordinates to convert
 		  );
 
 /** Convert Galactic to ICRS */
-psSkyPos *
-psCoordinatesGtoI(const psLatLong *restrict coordinates //!< Galactic coordinates to convert
+psCoord *
+psCoordinatesGtoI(const psCoord *restrict coordinates //!< Galactic coordinates to convert
 		  );
 
