BRL-CAD
dspline.h File Reference
#include "common.h"
#include "vmath.h"
#include "rt/defines.h"
Include dependency graph for dspline.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void rt_dspline_matrix (mat_t m, const char *type, const double tension, const double bias)
 
double rt_dspline4 (mat_t m, double a, double b, double c, double d, double alpha)
 
void rt_dspline4v (double *pt, const mat_t m, const double *a, const double *b, const double *c, const double *d, const int depth, const double alpha)
 
void rt_dspline_n (double *r, const mat_t m, const double *knots, const int n, const int depth, const double alpha)
 

Function Documentation

◆ rt_dspline_matrix()

void rt_dspline_matrix ( mat_t  m,
const char *  type,
const double  tension,
const double  bias 
)

Initialize a spline matrix for a particular spline type.

◆ rt_dspline4()

double rt_dspline4 ( mat_t  m,
double  a,
double  b,
double  c,
double  d,
double  alpha 
)

m spline matrix (see rt_dspline4_matrix) a, b, c, d knot values alpha: 0..1 interpolation point

Evaluate a 1-dimensional spline at a point "alpha" on knot values a, b, c, d.

◆ rt_dspline4v()

void rt_dspline4v ( double *  pt,
const mat_t  m,
const double *  a,
const double *  b,
const double *  c,
const double *  d,
const int  depth,
const double  alpha 
)

pt vector to receive the interpolation result m spline matrix (see rt_dspline4_matrix) a, b, c, d knot values alpha: 0..1 interpolation point

Evaluate a spline at a point "alpha" between knot pts b & c. The knots and result are all vectors with "depth" values (length).

◆ rt_dspline_n()

void rt_dspline_n ( double *  r,
const mat_t  m,
const double *  knots,
const int  n,
const int  depth,
const double  alpha 
)

Interpolate n knot vectors over the range 0..1

"knots" is an array of "n" knot vectors. Each vector consists of "depth" values. They define an "n" dimensional surface which is evaluated at the single point "alpha". The evaluated point is returned in "r"

Example use:

double result[MAX_DEPTH], knots[MAX_DEPTH*MAX_KNOTS]; mat_t m; int knot_count, depth;

knots = bu_malloc(sizeof(double) * knot_length * knot_count); result = bu_malloc(sizeof(double) * knot_length);

rt_dspline4_matrix(m, "Catmull", (double *)NULL, 0.0);

for (i=0; i < knot_count; i++) get a knot(knots, i, knot_length);

rt_dspline_n(result, m, knots, knot_count, knot_length, alpha);