/*
    GDAM - Geoff & Dave's Audio Mixer
    Copyright (C) 1999    Dave Benson, Geoff Matters.

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA

    Contact:
        daveb@ffem.org <Dave Benson>
        geoff@ugcs.caltech.edu <Geoff Matters>

*/
/* gdamspline:  cubic split manipulation functions */
#ifndef __GDAM_SPLINE_H_
#define __GDAM_SPLINE_H_

typedef struct _GdamSpline GdamSpline;
#include <glib.h>

/*
 * About splines:
 *
 *   Splines are collections of cubic polynomials;
 *   splines are curves in n-dimensions which are described
 *   completely by:
 *
 *	a set of keypoints,
 *	derivatives at those keypoints.
 *
 *   In other words, they are polynomial approximators which have continuous
 *   derivatives.
 */
/*
 * Spline creation functions.
 */
/*
GdamSpline*        gdam_spline_new               (int           num_keypoints,
                                                  const gfloat* inputs,
                                                  const gfloat* values,
						  const gfloat* derivatives);*/

/* If taughtness == 1, the endpoint derivatives are made to be straight
 *                     line segments, by angling the derivatives at eachother.
 * If taughtness == 0, the normal to the bisector is used:
 *
 *                             |
 *                             |
 *          this line is normal|to the curve when taughtness == 0
 *          -------------------*-------------------------------------- the
 *                            /|\                            
 *  * = spline keypoint      / | \
 *                          /  |  \  these lines represent taughtness == 1.
 *                         /   |   \
 *                        /    |    \
 *                       *           *
 */
GdamSpline*        gdam_spline_new               (int           num_keypoints,
                                                  const gfloat* inputs,
                                                  const gfloat* values,
						  gfloat        taughtness);
gfloat             gdam_spline_eval              (GdamSpline*   spline,
                                                  gfloat        t);
void               gdam_spline_delete            (GdamSpline*   spline);

void               gdam_spline_get_domain        (GdamSpline*   spline,
                                                  gfloat*       min_x,
						  gfloat*       max_x);

#endif
