Index: trunk/psLib/src/math/psSpline.c
===================================================================
--- trunk/psLib/src/math/psSpline.c	(revision 1859)
+++ trunk/psLib/src/math/psSpline.c	(revision 1861)
@@ -7,6 +7,6 @@
  *  polynomials.  It also contains a Gaussian functions.
  *
- *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-09-23 04:56:40 $
+ *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-23 06:12:22 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -1661,5 +1661,4 @@
 
 /*****************************************************************************
-XXX: Ensure that domain[i+1] != domain[i]
  *****************************************************************************/
 psSpline1D *psSpline1DAllocGeneric(const psVector *bounds,
@@ -1681,6 +1680,12 @@
 
     tmp->domains = (float *) psAlloc((bounds->n) * sizeof(float));
+
     for (i=0;i<bounds->n;i++) {
         (tmp->domains)[i] = bounds->data.F32[i];
+        if (i<(bounds->n-1)) {
+            if (FLT_EPSILON < fabs(bounds->data.F32[i+1]-bounds->data.F32[i])) {
+                // XXX: psErrorMsg(data points must be distinct)
+            }
+        }
     }
 
@@ -1697,4 +1702,6 @@
  
 XXX: Macro this for a few different types.
+ 
+XXX: name since we don't take psVectors as input.
  *****************************************************************************/
 int p_psVectorBinDisectF32(float *bins,
@@ -1867,5 +1874,8 @@
 
 
-// This is a
+/*****************************************************************************
+p_ps1DInterpolateF32(): this is the base 1-D flat memory routine to perform
+LaGrange interpolation.
+ *****************************************************************************/
 float p_ps1DInterpolateF32(float *domain,
                            float *range,
@@ -1910,5 +1920,7 @@
 order around the point x.
  
-XXX: This stuff does not work with a mask.
+XXX: This stuff does not currently work with a mask.
+ 
+XXX: nobody asked for us to generate this routine.
  *****************************************************************************/
 psScalar *p_psVectorInterpolate(psVector *domain,
@@ -1948,4 +1960,13 @@
 
 
+/*****************************************************************************
+psSpline1DEval(): this routine takes an existing spline of arbitrary order
+and an independent x value.  Each determines which spline that x corresponds
+to by doing a bracket disection on the domains of the spline data structure
+(p_psVectorBinDisectF32()).  Then it evaluates the spline at that x location
+by a call to the 1D polynomial functions.
+ 
+XXX: SDR is silent about data types.  PS_TYPE_F32 is implemented.
+ *****************************************************************************/
 float psSpline1DEval(const psSpline1D *spline,
                      float x)
@@ -1985,58 +2006,2 @@
     return(tmpVector);
 }
-
-
-
-/*****************************************************************************
-psSpline1DGen(): This routine will take an existing spline data structure,
-along with a set of data values for each of the domains, and fit splines of
-the specified order (currently, linear only), and set the coefficients in the
-appropriate spline polynomials.  This function is not part of the API in the
-latest SDR, but I'm guessing it will be, and I need it to generate test
-cases, so I included it here.
- *****************************************************************************/
-
-psSpline1D *psSpline1DGen(const psSpline1D *spline,
-                          psVector *data)
-{
-    int i;
-    float slope;
-
-    psTrace(".psLib.dataManip.psFunctions.psSpline1DGen", 4,
-            "---- Calling psSpline1DGen()\n");
-
-    if (data->n != (1 + spline->n)) {
-        psLogMsg(__func__, PS_LOG_WARN,
-                 "data size / spline size mismatch (%d %d)\n",
-                 data->n, spline->n);
-        return(NULL);
-    }
-    // XXX: verify your math
-    if (2 == (spline->spline[0])->n) {
-        for (i=0;i<spline->n;i++) {
-            slope = (data->data.F32[i+1] - data->data.F32[i]) /
-                    (spline->domains[i+1] - spline->domains[i]);
-            (spline->spline[i])->coeff[0] = data->data.F32[i] -
-                                            (slope * spline->domains[i]);
-            //printf("HMMM (%f, %f, %f)\n", data->data.F32[i], slope, spline->domains[i]);
-
-            (spline->spline[i])->coeff[1] = slope;
-            psTrace(".psLib.dataManip.psFunctions.psSpline1DGen", 4,
-                    "---- spline %d coeffs are (%f, %f)\n", i,
-                    (spline->spline[i])->coeff[0],
-                    (spline->spline[i])->coeff[1]);
-        }
-        psTrace(".psLib.dataManip.psFunctions.psSpline1DGen", 4,
-                "---- Exiting psSpline1DGen()\n");
-        return((psSpline1D *) spline);
-    } else if (4 == (spline->spline[0])->n) {
-        psLogMsg(__func__, PS_LOG_WARN,
-                 "Cubic splines have not been implemented.");
-        return(NULL);
-    } else {
-        psLogMsg(__func__, PS_LOG_WARN,
-                 "Don't know how to generate %d-order splines.",
-                 (spline->spline[0])->n-1);
-        return(NULL);
-    }
-}
