Index: /trunk/psLib/src/astronomy/psAstrometry.c
===================================================================
--- /trunk/psLib/src/astronomy/psAstrometry.c	(revision 3558)
+++ /trunk/psLib/src/astronomy/psAstrometry.c	(revision 3559)
@@ -8,6 +8,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.61 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-03-29 19:41:56 $
+ *  @version $Revision: 1.62 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-03-30 02:21:14 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -62,25 +62,25 @@
     PS_PTR_CHECK_NULL(transform->y, 0);
 
-    int i;
-
-    for (i=2;i<(transform->x->nX);i++) {
-        if (transform->x->coeff[i][0] != 0.0) {
-            return(0);
-        }
-    }
-    for (i=2;i<(transform->x->nY);i++) {
-        if (transform->x->coeff[0][i] != 0.0) {
-            return(0);
-        }
-    }
-
-    for (i=2;i<(transform->y->nX);i++) {
-        if (transform->y->coeff[i][0] != 0.0) {
-            return(0);
-        }
-    }
-    for (i=2;i<(transform->y->nY);i++) {
-        if (transform->y->coeff[0][i] != 0.0) {
-            return(0);
+    for (psS32 i=0;i<(transform->x->nX);i++) {
+        for (psS32 j=0;j<(transform->x->nY);j++) {
+            if (transform->x->coeff[i][j] != 0.0) {
+                if (!(((i == 0) && (j == 0)) ||
+                        ((i == 0) && (j == 1)) ||
+                        ((i == 1) && (j == 0)))) {
+                    return(0);
+                }
+            }
+        }
+    }
+
+    for (psS32 i=0;i<(transform->y->nX);i++) {
+        for (psS32 j=0;j<(transform->y->nY);j++) {
+            if (transform->y->coeff[i][j] != 0.0) {
+                if (!(((i == 0) && (j == 0)) ||
+                        ((i == 0) && (j == 1)) ||
+                        ((i == 1) && (j == 0)))) {
+                    return(0);
+                }
+            }
         }
     }
@@ -108,6 +108,7 @@
              (Y2 * (1.0 / (F - ((C*E)/B))));
  
-XXX: Since thre is now a general psPlaneTransformInvertTmp() function, we
+XXX: Since thre is now a general psPlaneTransformInvert() function, we
 should rename this.
+ 
  *****************************************************************************/
 static psPlaneTransform *invertPlaneTransform(psPlaneTransform *transform)
@@ -117,13 +118,29 @@
     PS_PTR_CHECK_NULL(transform->y, 0);
 
-    double A = transform->x->coeff[0][0];
-    double B = transform->x->coeff[1][0];
-    double C = transform->x->coeff[0][1];
-    double D = transform->y->coeff[0][0];
-    double E = transform->y->coeff[1][0];
-    double F = transform->y->coeff[0][1];
+    psF64 A = 0.0;
+    psF64 B = 0.0;
+    psF64 C = 0.0;
+    psF64 D = 0.0;
+    psF64 E = 0.0;
+    psF64 F = 0.0;
+
+    // XXX: Test this for correctness.
+    A = transform->x->coeff[0][0];
+    if (transform->x->nX >= 2) {
+        B = transform->x->coeff[1][0];
+    }
+    if (transform->x->nY >= 2) {
+        C = transform->x->coeff[0][1];
+    }
+    D = transform->y->coeff[0][0];
+    if (transform->y->nX >= 2) {
+        E = transform->y->coeff[1][0];
+    }
+    if (transform->y->nY >= 2) {
+        F = transform->y->coeff[0][1];
+    }
 
     // XXX: Use the constructor here.
-    psPlaneTransform *out = psAlloc(sizeof(psPlaneTransform));
+    psPlaneTransform *out = psPlaneTransformAlloc(2, 2);
 
     out->x->coeff[0][0] = -D + ((F*A)/C) / (E - ((F*B)/C));
@@ -1092,25 +1109,18 @@
 
 /*****************************************************************************
-psPlaneTranformFit(trans, source, dest, nRejIter, sigmaClip)
+psPlaneTransformFit(trans, source, dest, nRejIter, sigmaClip)
  
 XXX: What about nRejIter?  Iterations?
 XXX: Use static vectors for internal data.
  *****************************************************************************/
-bool psPlaneTranformFit(psPlaneTransform *trans,
-                        const psArray *source,
-                        const psArray *dest,
-                        int nRejIter,
-                        float sigmaClip)
+bool psPlaneTransformFit(psPlaneTransform *trans,
+                         const psArray *source,
+                         const psArray *dest,
+                         int nRejIter,
+                         float sigmaClip)
 {
     PS_PTR_CHECK_NULL(trans, NULL);
     PS_PTR_CHECK_NULL(source, NULL);
     PS_PTR_CHECK_NULL(dest, NULL);
-
-    // Ensure that the input transformation is symmetrical.
-    if ((trans->x->nX != trans->x->nY) ||
-            (trans->y->nX != trans->y->nY) ||
-            (trans->x->nX != trans->y->nX)) {
-        psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Input transformation must have same nX==nY.");
-    }
 
     psS32 numCoords = PS_MIN(source->n, dest->n);
@@ -1226,8 +1236,9 @@
     //
     if (isProjectionLinear((psPlaneTransform *) in)) {
+        printf("COOL: is linear\n");
         return(invertPlaneTransform((psPlaneTransform *) in));
     }
     PS_PTR_CHECK_NULL(region, NULL);
-    PS_INT_COMPARE(0, nSamples, NULL);
+    PS_INT_COMPARE(1, nSamples, NULL);
 
     // Ensure that the input transformation is symmetrical.
@@ -1300,5 +1311,5 @@
         }
     }
-    bool rc = psPlaneTranformFit(myPT, inData, outData, 10, 100.0);
+    bool rc = psPlaneTransformFit(myPT, inData, outData, 10, 100.0);
 
     psFree(inCoord);
Index: /trunk/psLib/src/astronomy/psAstrometry.h
===================================================================
--- /trunk/psLib/src/astronomy/psAstrometry.h	(revision 3558)
+++ /trunk/psLib/src/astronomy/psAstrometry.h	(revision 3559)
@@ -8,6 +8,6 @@
 *  @author GLG, MHPCC
 *
-*  @version $Revision: 1.36 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-03-29 19:41:56 $
+*  @version $Revision: 1.37 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-03-30 02:21:14 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -552,5 +552,5 @@
 
 // XXX: Doxygenate.
-bool psPlaneTranformFit(
+bool psPlaneTransformFit(
     psPlaneTransform *trans,
     const psArray *source,
Index: /trunk/psLib/test/astronomy/tst_psAstrometry01.c
===================================================================
--- /trunk/psLib/test/astronomy/tst_psAstrometry01.c	(revision 3558)
+++ /trunk/psLib/test/astronomy/tst_psAstrometry01.c	(revision 3559)
@@ -5,6 +5,17 @@
 *  @author GLG, MHPCC
 *
-*  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-03-30 00:17:04 $
+*  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-03-30 02:21:53 $
+*
+* XXX: Must test
+* pmSourceAddModel
+* pmSourceSubModel
+* pmSourceFitModel
+* pmSourceContour
+* pmSourceModelGuess
+* pmSourceRoughClass
+* pmSourceMoments
+* pmSourceLocalSky
+*
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
