Index: trunk/psModules/src/pmSubtractBias.c
===================================================================
--- trunk/psModules/src/pmSubtractBias.c	(revision 1885)
+++ trunk/psModules/src/pmSubtractBias.c	(revision 1889)
@@ -8,6 +8,6 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-09-24 23:00:37 $
+ *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-24 23:47:21 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -144,14 +144,43 @@
 }
 
-// XXX: Must scale the overscan vector
+/******************************************************************************
+ScaleOverscanVector(): this routine takes as input an arbitrary vector,
+creates anew vector of length n, and fills the new vector with the
+interpolated values of the old vector.  The type of interpolation is:
+    PM_FIT_POLYNOMIAL: fit a polynomial to the entire input vector data.
+    PM_FIT_SPLINE: fit splines to the input vector data.
+XXX: Doesn't it make more sense to do polynomial interpolation on a few
+elements of the input vector, rather than fit a polynomial to the entire
+vector?
+ *****************************************************************************/
 psVector *ScaleOverscanVector(psVector *overscanVector,
                               int n,
+                              void *fitSpec,
                               pmFit fit)
 {
     psVector *newVec = psVectorAlloc(n, PS_TYPE_F32);
-
-    if (fit == PM_FIT_POLYNOMIAL) {}
-    else if (fit == PM_FIT_SPLINE) {}
-    else {}
+    psPolynomial1D *myPoly;
+    psSpline1D *mySpline;
+    float x;
+    int i;
+
+    if (fit == PM_FIT_POLYNOMIAL) {
+        myPoly = (psPolynomial1D *) fitSpec;
+        myPoly = psVectorFitPolynomial1D(myPoly, NULL, overscanVector, NULL);
+        for (i=0;i<n;i++) {
+            x = (((float) i) / ((float) n)) * ((float) overscanVector->n);
+            newVec->data.F32[i] = psPolynomial1DEval(x, myPoly);
+        }
+    } else if (fit == PM_FIT_SPLINE) {
+        mySpline = (psSpline1D *) fitSpec;
+        mySpline = psVectorFitSpline1D(mySpline, NULL, overscanVector, NULL);
+        for (i=0;i<n;i++) {
+            x = (((float) i) / ((float) n)) * ((float) overscanVector->n);
+            newVec->data.F32[i] = psSpline1DEval(mySpline, x);
+        }
+    } else {
+        // XXX: psErrorMsg()
+    }
+
     return(newVec);
 }
@@ -251,5 +280,5 @@
             }
             psFree(tmpRow);
-            ScaleOverscanVector(overscanVector, (in->image)->numCols, fit);
+            ScaleOverscanVector(overscanVector, (in->image)->numCols, fitSpec, fit);
         }
         if (overScanAxis == PM_OVERSCAN_COLUMNS) {
@@ -274,5 +303,5 @@
             }
             psFree(tmpCol);
-            ScaleOverscanVector(overscanVector, (in->image)->numRows, fit);
+            ScaleOverscanVector(overscanVector, (in->image)->numRows, fitSpec, fit);
         }
 
