I've searched the net all over.
All I want to do is generate a cubic b-spline function from a set of 2-d points and evaluate it at different x. I need the kind where the curve runs through the control points (knots). I want to use it for interpolating a cumulative distribution function. I'm looking for two simple c/c++ functions:
[code=c]
void calculateBSplin e(some_simple_d ata_type* bspline, double** source_points, int num_points);
double evaluateBSpline (some_simple_da ta_type* bspline, int num_points, double x);
[/code]
Where the double** is an array of points such that the x coordinate of point n is points[n][0], and the y coordinate is points[n][1]. The first function would create the spline from "source_poi nts" and pass it back in "bspline", and the second would evaluate "bspline" at a given point "x". I imagine I can generate the inverse function just by swapping the x and y coordinates of the source_points, so that would provide me with a way of evaluating the spline at y. If not, an inverse eval would also be helpful.
In sum, my question is simple:
[code=c]
void calculateBSplin e(some_simple_d ata_type* bspline, double** source_points, int num_points) {
<what goes here?>
}
double evaluateBSpline (some_simple_da ta_type* bspline, int num_points, double x) {
<and what goes here?>
}
[/code]
Thanks.
All I want to do is generate a cubic b-spline function from a set of 2-d points and evaluate it at different x. I need the kind where the curve runs through the control points (knots). I want to use it for interpolating a cumulative distribution function. I'm looking for two simple c/c++ functions:
[code=c]
void calculateBSplin e(some_simple_d ata_type* bspline, double** source_points, int num_points);
double evaluateBSpline (some_simple_da ta_type* bspline, int num_points, double x);
[/code]
Where the double** is an array of points such that the x coordinate of point n is points[n][0], and the y coordinate is points[n][1]. The first function would create the spline from "source_poi nts" and pass it back in "bspline", and the second would evaluate "bspline" at a given point "x". I imagine I can generate the inverse function just by swapping the x and y coordinates of the source_points, so that would provide me with a way of evaluating the spline at y. If not, an inverse eval would also be helpful.
In sum, my question is simple:
[code=c]
void calculateBSplin e(some_simple_d ata_type* bspline, double** source_points, int num_points) {
<what goes here?>
}
double evaluateBSpline (some_simple_da ta_type* bspline, int num_points, double x) {
<and what goes here?>
}
[/code]
Thanks.
Comment