Libbarrett  1.2.4
Functions
src/cdlbt/spline.c File Reference
#include <math.h>
#include <syslog.h>
#include <gsl/gsl_blas.h>
#include <barrett/cdlbt/spline.h>
#include <barrett/cdlbt/interp.h>

Functions

int bt_spline_create (struct bt_spline **splineptr, const gsl_vector *start, enum bt_spline_mode mode)
int bt_spline_add (struct bt_spline *spline, const gsl_vector *vec, double s)
int bt_spline_init (struct bt_spline *spline, gsl_vector *start, gsl_vector *direction)
int bt_spline_destroy (struct bt_spline *spline)
int bt_spline_get (struct bt_spline *spline, gsl_vector *result, double s)

Detailed Description

Implementation of bt_spline, an n-dimensional vector interpolator.

Author:
Christopher Dellin
Date:
2008-2009

Function Documentation

int bt_spline_add ( struct bt_spline spline,
const gsl_vector *  vec,
double  s 
)

Add a point to a bt_spline.

This function is called iteratively once a bt_spline has been created to add points to the end of the spline. If the mode is BT_SPLINE_MODE_EXTERNAL, care must be take to ensure that the parameter s is monotonically increasing. If the mode is BT_SPLINE_MODE_ARCLEN, the s parameter is ignored.

Parameters:
[in]splineThe bt_spline object to which to add the point
[in]vecThe point to add
[in]sThe values of the external parameter at this point
Return values:
0Success
int bt_spline_create ( struct bt_spline **  splineptr,
const gsl_vector *  start,
enum bt_spline_mode  mode 
)

Copyright 2009-2014 Barrett Technology <support@barrett.com>

This file is part of libbarrett.

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

This version of libbarrett 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 General Public License for more details.

You should have received a copy of the GNU General Public License along with this version of libbarrett. If not, see <http://www.gnu.org/licenses/>.

Barrett Technology Inc. 73 Chapel Street Newton, MA 02458

int bt_spline_destroy ( struct bt_spline spline)

Destroy a bt_spline object.

This function destroys a bt_spline object created by bt_spline_create().

Parameters:
[in]splineThe bt_spline object to destroy
Return values:
0Success
int bt_spline_get ( struct bt_spline spline,
gsl_vector *  result,
double  s 
)

Retrieve the interpolated vector at a given parameter value.

This function is designed to be called in a control loop to retrieve the interpolated vector at the paramater value s.

Parameters:
[in]splineThe bt_spline object to use
[in]resultThe vector at the given paramter value
[in]sThe parameter value to use
Return values:
0Success
int bt_spline_init ( struct bt_spline spline,
gsl_vector *  start,
gsl_vector *  direction 
)

Initialize the bt_spline after adding all points.

Once points are added to the spline using bt_spline_add(), the spline is initialized. This will create the interpolating objects for each dimension. If the start argument is passed, the original starting point given in bt_spline_create() will be replaced before any calculations take place. If the direction argument is passed, the initial slopes to each interpolator will be proportional to the normalized direction vector's values.

Note:
The direction vector, if passed and non-zero, will be normalized in place.
Parameters:
[in]splineThe bt_spline object to initialize
[in]startA vector to replace the original start vector with, or 0 to skip this step
[in]directionA vector to use as the direction of the new spline
Return values:
0Success
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Defines