1 ] <= key < base[ index ]. If key == base[ num - 1 ] then index is set to num - 1.
#include <BsplineEval/bsplineval.h> #include <BsplineEval/spline_coef.h>BsplineErr Bspline_determine_index( double *key, const void *base, size_t num, double minval, double maxval, size_t *index );
double *key
- The key to search for
const void *base
- Points to the element at the base of array
size_t num
- Number of elements in the array
double minval
- The left most knot boundary
double maxval
- The right most knot boundary
size_t *index
- base[ index - 1 ] <= key < base[ index ]
Do a Binary search to find the location of the key within the knots. If this routine is usually called iteratively between the ideal surface and the deformation map then it can improve a bit by making use of the last position found.
The enum BsplineErr.
Possible values for a
BsplineErr
are as follows:
Bspline_Success
- Success
Bspline_OutOfRange
- One of the arguments is out of range
Bspline_OutOfRangeT
- The theta value is not within the limits of the t_knots
Bspline_OutOfRangeZ
- The z value is outside the limits of the z_knots
Bspline_WrongMethod1
- The method request must be one of : a, A, b or B
Bspline_WrongMethod2
- The method request must be one of : a, A, b or B