Index: /trunk/psLib/test/math/tst_psPolyFit4D.c
===================================================================
--- /trunk/psLib/test/math/tst_psPolyFit4D.c	(revision 7136)
+++ /trunk/psLib/test/math/tst_psPolyFit4D.c	(revision 7137)
@@ -11,15 +11,15 @@
 #include "pslib.h"
 #include "psTest.h"
-#define NUM_DATA 30
-#define POLY_ORDER_X 2
-#define POLY_ORDER_Y 2
-#define POLY_ORDER_Z 2
-#define POLY_ORDER_T 2
-#define A 1.0
+#define NUM_DATA 200
+#define POLY_ORDER_X 1
+#define POLY_ORDER_Y 1
+#define POLY_ORDER_Z 1
+#define POLY_ORDER_T 1
+#define A 100.0
 #define B 2.0
 #define C 3.0
 #define D 4.0
 #define E 5.0
-#define F 4.0
+#define F 6.0
 #define H 3.0
 #define J 3.0
@@ -31,9 +31,9 @@
 #define P 1.0
 #define Q 5.0
-#define ERROR_TOLERANCE 0.10
-#define YERR 10.0
-#define VERBOSE 1
+#define ERROR_TOLERANCE 0.05
+#define YERR 0.1
+#define VERBOSE 0
 #define NUM_ITERATIONS 5
-#define CLIP_SIGMA 4.0
+#define CLIP_SIGMA 3.0
 #define OUTLIERS true
 #define MASK_VALUE 1
@@ -76,7 +76,13 @@
         return(A + (B * x) + (C * y) + (D * z) + (E * t));
     } else {
+        #if 0
         return(A + (B * x) + (C * y) + (D * z) + (E * t) +
                (F * x * x) + (H * y * y) + (J * z * z) + (K * t * t) +
                (L * x * y) + (M * x * z) + (N * x * t) + (O * y * z) + (P * y * t) + (Q * z * t));
+        #else
+
+        return A + (B * x) + (C * y) + (D * z) + (E * t) + (F * x * y);
+        #endif
+
     }
 }
@@ -143,4 +149,26 @@
         myPoly = psPolynomial4DAlloc(PS_POLYNOMIAL_ORD, polyOrderX, polyOrderY,
                                      polyOrderZ, polyOrderT);
+
+        #if 1
+
+        for (int ix = 0; ix < polyOrderX + 1; ix++) {
+            for (int iy = 0; iy < polyOrderY + 1; iy++) {
+                for (int iz = 0; iz < polyOrderZ + 1; iz++) {
+                    for (int it = 0; it < polyOrderT + 1; it++) {
+                        myPoly->mask[ix][iy][iz][it] = 0xff; // Mask it out
+                    }
+                }
+            }
+        }
+
+        // Put these back in
+        myPoly->mask[0][0][0][0] = 0;   // A
+        myPoly->mask[1][0][0][0] = 0;   // B * x
+        myPoly->mask[0][1][0][0] = 0;   // C * y
+        myPoly->mask[0][0][1][0] = 0;   // D * z
+        myPoly->mask[0][0][0][1] = 0;   // E * t
+        myPoly->mask[1][1][0][0] = 0;   // F * xy
+        #endif
+
     }
 
@@ -232,7 +260,7 @@
         // Set a few outliers in the data.
         if (OUTLIERS && (flags & TS00_CLIP_FIT)) {
-            f->data.F32[numData/4]*= 2.0;
-            f->data.F32[numData/2]*= 2.0;
-            f->data.F32[3*numData/4]*= 2.0;
+            f->data.F32[numData/4] *= 2.0;
+            f->data.F32[numData/2] *= 2.0;
+            f->data.F32[3*numData/4] *= 2.0;
         }
     }
@@ -243,7 +271,7 @@
         // Set a few outliers in the data.
         if (OUTLIERS && (flags & TS00_CLIP_FIT)) {
-            f->data.S32[numData/4]*= 2.0;
-            f->data.S32[numData/2]*= 2.0;
-            f->data.S32[3*numData/4]*= 2.0;
+            f->data.S32[numData/4] *= 2.0;
+            f->data.S32[numData/2] *= 2.0;
+            f->data.S32[3*numData/4] *= 2.0;
         }
     }
@@ -254,7 +282,7 @@
         // Set a few outliers in the data.
         if (OUTLIERS && (flags & TS00_CLIP_FIT)) {
-            f->data.F64[numData/4]*= 2.0;
-            f->data.F64[numData/2]*= 2.0;
-            f->data.F64[3*numData/4]*= 2.0;
+            f->data.F64[numData/4] *= 2.0;
+            f->data.F64[numData/2] *= 2.0;
+            f->data.F64[3*numData/4] *= 2.0;
         }
     }
@@ -354,5 +382,5 @@
 
             if (fabs(actualData-expectData) > fabs(ERROR_TOLERANCE * expectData)) {
-                printf("TEST ERROR: Fitted data %d: (%.1f), expected was (%.1f)\n",
+                printf("TEST ERROR: Fitted data %d: (%f), expected was (%f)\n",
                        i, actualData, expectData);
                 testStatus = false;
