Index: /trunk/psLib/src/astro/psCoord.c
===================================================================
--- /trunk/psLib/src/astro/psCoord.c	(revision 6253)
+++ /trunk/psLib/src/astro/psCoord.c	(revision 6254)
@@ -10,6 +10,6 @@
 *  @author GLG, MHPCC
 *
-*  @version $Revision: 1.104 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-01-30 22:56:01 $
+*  @version $Revision: 1.105 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2006-01-30 23:42:24 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -206,6 +206,5 @@
 
 // XXX: Verify the order/nterms poly changes
-psPlaneTransform* psPlaneTransformAlloc(int order1,
-                                        int order2)
+psPlaneTransform* psPlaneTransformAlloc(int order1, int order2)
 {
     PS_ASSERT_INT_NONNEGATIVE(order1, NULL);
@@ -241,7 +240,8 @@
 }
 
-psPlane* psPlaneTransformApply(psPlane* out,
-                               const psPlaneTransform* transform,
-                               const psPlane* coords)
+psPlane* psPlaneTransformApply(
+    psPlane* out,
+    const psPlaneTransform* transform,
+    const psPlane* coords)
 {
     PS_ASSERT_PTR_NON_NULL(transform, NULL);
@@ -267,8 +267,5 @@
 
 // XXX: Verify the order/nterms poly changes
-psPlaneDistort* psPlaneDistortAlloc(int order1,
-                                    int order2,
-                                    int order3,
-                                    int order4)
+psPlaneDistort* psPlaneDistortAlloc(int order1, int order2, int order3, int order4)
 {
     PS_ASSERT_INT_NONNEGATIVE(order1, NULL);
@@ -350,9 +347,10 @@
 }
 
-psProjection* psProjectionAlloc(double R,
-                                double D,
-                                double Xs,
-                                double Ys,
-                                psProjectionType type)
+psProjection* psProjectionAlloc(
+    double R,
+    double D,
+    double Xs,
+    double Ys,
+    psProjectionType type)
 {
     psProjection *p = psAlloc(sizeof(psProjection));
@@ -374,7 +372,8 @@
 
 
-psPlane* p_psProject(psPlane *outPlane,
-                     const psSphere* coord,
-                     const psProjection* projection)
+psPlane* p_psProject(
+    psPlane *outPlane,
+    const psSphere* coord,
+    const psProjection* projection)
 {
     PS_ASSERT_PTR_NON_NULL(coord, NULL);
@@ -458,7 +457,8 @@
 }
 
-psSphere* p_psDeproject(psSphere *outSphere,
-                        const psPlane* coord,
-                        const psProjection* projection)
+psSphere* p_psDeproject(
+    psSphere *outSphere,
+    const psPlane* coord,
+    const psProjection* projection)
 {
     PS_ASSERT_PTR_NON_NULL(coord, NULL);
@@ -604,9 +604,10 @@
 routine far too many times.
  *****************************************************************************/
-psPlaneTransform *psPlaneTransformCombine(psPlaneTransform *out,
-        const psPlaneTransform *trans1,
-        const psPlaneTransform *trans2,
-        psRegion region,
-        int nSamples)
+psPlaneTransform *psPlaneTransformCombine(
+    psPlaneTransform *out,
+    const psPlaneTransform *trans1,
+    const psPlaneTransform *trans2,
+    psRegion region,
+    int nSamples)
 {
     psTrace(__func__, 3, "---- %s() begin ----\n", __func__);
@@ -1015,7 +1016,9 @@
 }
 
-psPlane *psPlaneTransformDeriv(psPlane *out,
-                               const psPlaneTransform *transformation,
-                               const psPlane *coord)
+psPlane *psPlaneTransformDeriv(
+    psPlane *out,
+    const psPlaneTransform *transformation,
+    const psPlane *coord
+)
 {
     PS_ASSERT_PTR_NON_NULL(transformation, NULL);
@@ -1047,9 +1050,10 @@
         for (psS32 loop_y = 0; loop_y < (1 + xPoly->nY); loop_y++) {
             //
-            // For each iteration of the loop, we multiple the (x, y) coefficient
-            // by (coord->x^(loop_x-1) * coord->y^loop_y)
+            // For each iteration of the loop, we multiply the (x, y) coefficient
+            // by (x^(loop_x-1) * y^loop_y) * loop_x
             //
 
-            out->x+= xPoly->coeff[loop_x][loop_y] * xSum * ySum;
+            out->x+= xPoly->coeff[loop_x][loop_y] * xSum * ySum * ((psF32) loop_x);
+            psTrace(__func__, 6, "out->x+= (%.2f * %.2f * %.2f * %.2f)\n", xPoly->coeff[loop_x][loop_y], xSum, ySum, ((psF32) loop_x));
             ySum*= coord->y;
         }
@@ -1067,13 +1071,16 @@
         for (psS32 loop_y = 1; loop_y < (1 + yPoly->nY); loop_y++) {
             //
-            // For each iteration of the loop, we multiple the (x, y) coefficient
-            // by (coord->x^(loop_x-1) * coord->y^loop_y)
+            // For each iteration of the loop, we multiply the (x, y) coefficient
+            // by (x^(loop_x-1) * y^loop_y) * loop_y
+            // by (x^(loop_x) * y^(loop_y-1))
             //
 
-            out->y+= yPoly->coeff[loop_x][loop_y] * xSum * ySum;
+            out->y+= yPoly->coeff[loop_x][loop_y] * xSum * ySum * ((psF32) loop_y);
+            psTrace(__func__, 6, "out->y+= (%.2f * %.2f * %.2f * %.2f)\n", yPoly->coeff[loop_x][loop_y], xSum, ySum, ((psF32) loop_y));
             ySum*= coord->y;
         }
         xSum*= coord->x;
     }
+
     return(out);
 }
