Robotran C Documentation
cubic_spline.h
Go to the documentation of this file.
1 
11 #ifndef CUBICSPLINE_h
12 #define CUBICSPLINE_h
13 
14 // ============================================================ //
15 
16 
17 typedef struct CubicSpline
18 {
19  int nx;
20  double* x;
24  double** coef;
26  int lastindex;
28 } CubicSpline;
29 
30 // ============================================================ //
31 
60 CubicSpline * cubic_spline_new_from_file(const char* filename);
61 
62 
71 int cubic_spline_get_index(CubicSpline *cs, double x_in);
72 
73 
84 double cubic_spline_comp_value(CubicSpline *cs, double x_in, int index);
85 
96 double cubic_spline_comp_firstder(CubicSpline *cs, double x_in, int index);
97 
108 double cubic_spline_comp_secondder(CubicSpline *cs, double x_in, int index);
109 
123 void cubic_spline_comp_val_and_der(CubicSpline *cs, double x_in, int index, double* y, double* yp, double* ypp);
124 
125 
131 
132 # endif
cubic_spline.h
cubic_spline_comp_val_and_der
void cubic_spline_comp_val_and_der(CubicSpline *cs, double x_in, int index, double *y, double *yp, double *ypp)
Compute the value of the cubic spline and its first and second derivatives at the specified coordinat...
Definition: cubic_spline.c:166
CubicSpline::x
double * x
Starting value of each segment.
Definition: cubic_spline.h:20
cubic_spline_comp_val_and_der
void cubic_spline_comp_val_and_der(CubicSpline *cs, double x_in, int index, double *y, double *yp, double *ypp)
Compute the value of the cubic spline and its first and second derivatives at the specified coordinat...
Definition: cubic_spline.c:166
mbs_error_msg
void mbs_error_msg(char *msg,...)
Send an error message.
Definition: mbs_message.c:102
get_dvec_0
double * get_dvec_0(int l_v)
create (with memory allocation) a vector (length l_v) of doubles, starting at index 0
Definition: mbs_1D_array.c:880
free_dmat_0
void free_dmat_0(double **mat)
release memory for a matrix of doubles, starting at index 0
Definition: mbs_matrix.c:293
get_dmatfiles_size
int get_dmatfiles_size(const char *fileName, int *n_row, int *n_col)
Function to load a file and calculate the number of rows and columns.
Definition: mbs_matrix.c:858
mbs_matrix.h
cubic_spline_get_index
int cubic_spline_get_index(CubicSpline *cs, double x_in)
Retrieve the index (starting at zero) in the spline coefficient table corresponding to the specified ...
Definition: cubic_spline.c:69
mbs_1D_array.h
get_dmat_0
double ** get_dmat_0(int nb_r, int nb_c)
create (with memory allocation) a [nb_r times nb_c] matrix of doubles, starting at index 0
Definition: mbs_matrix.c:238
cubic_spline_comp_value
double cubic_spline_comp_value(CubicSpline *cs, double x_in, int index)
Compute the value of the cubic spline at the specified coordinate.
Definition: cubic_spline.c:102
cubic_spline_get_index
int cubic_spline_get_index(CubicSpline *cs, double x_in)
Retrieve the index (starting at zero) in the spline coefficient table corresponding to the specified ...
Definition: cubic_spline.c:69
CubicSpline
Definition: cubic_spline.h:17
cubic_spline_comp_value
double cubic_spline_comp_value(CubicSpline *cs, double x_in, int index)
Compute the value of the cubic spline at the specified coordinate.
Definition: cubic_spline.c:102
cubic_spline_comp_firstder
double cubic_spline_comp_firstder(CubicSpline *cs, double x_in, int index)
Compute the value of the first derivative of the cubic spline at the specified coordinate.
Definition: cubic_spline.c:124
cubic_spline_new_from_file
CubicSpline * cubic_spline_new_from_file(const char *filename)
Load the coefficient of the cubic splines from a file.
Definition: cubic_spline.c:21
CubicSpline::lastindex
int lastindex
Last used index (line). Default value -1.
Definition: cubic_spline.h:26
cubic_spline_delete
void cubic_spline_delete(CubicSpline *cs)
Free the memory of cubic spline.
Definition: cubic_spline.c:191
mbs_message.h
cubic_spline_comp_secondder
double cubic_spline_comp_secondder(CubicSpline *cs, double x_in, int index)
Compute the value of the second derivative of the cubic spline at the specified coordinate.
Definition: cubic_spline.c:145
cubic_spline_comp_firstder
double cubic_spline_comp_firstder(CubicSpline *cs, double x_in, int index)
Compute the value of the first derivative of the cubic spline at the specified coordinate.
Definition: cubic_spline.c:124
cubic_spline_delete
void cubic_spline_delete(CubicSpline *cs)
Free the memory of cubic spline.
Definition: cubic_spline.c:191
cubic_spline_comp_secondder
double cubic_spline_comp_secondder(CubicSpline *cs, double x_in, int index)
Compute the value of the second derivative of the cubic spline at the specified coordinate.
Definition: cubic_spline.c:145
free_dvec_0
void free_dvec_0(double *vec)
release memory for a vector of doubles, starting at index 0
Definition: mbs_1D_array.c:896
CubicSpline::coef
double ** coef
The size is [CubicSpline::nx,4]
Definition: cubic_spline.h:24
CubicSpline::nx
int nx
Number of cubic spline segments.
Definition: cubic_spline.h:19
read_dmat_0
int read_dmat_0(double **mat, int nb_r, int nb_c, const char *name)
read a [nb_r times nb_c] matrix of doubles from a file starting with index 0 and store the values in ...
Definition: mbs_matrix.c:495
cubic_spline_new_from_file
CubicSpline * cubic_spline_new_from_file(const char *filename)
Load the coefficient of the cubic splines from a file.
Definition: cubic_spline.c:21