Libbarrett
1.2.4
|
#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) |
Implementation of bt_spline, an n-dimensional vector interpolator.
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.
[in] | spline | The bt_spline object to which to add the point |
[in] | vec | The point to add |
[in] | s | The values of the external parameter at this point |
0 | Success |
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().
[in] | spline | The bt_spline object to destroy |
0 | Success |
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.
[in] | spline | The bt_spline object to use |
[in] | result | The vector at the given paramter value |
[in] | s | The parameter value to use |
0 | Success |
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.
[in] | spline | The bt_spline object to initialize |
[in] | start | A vector to replace the original start vector with, or 0 to skip this step |
[in] | direction | A vector to use as the direction of the new spline |
0 | Success |