BRL-CAD
tabdata.c File Reference

Routines for processing tables (curves) of data with one independent parameter which is common to many sets of dependent data values. More...

#include "common.h"
#include <math.h>
#include <string.h>
#include "bio.h"
#include "bu/debug.h"
#include "bu/log.h"
#include "bu/malloc.h"
#include "bu/parallel.h"
#include "vmath.h"
#include "bn/tabdata.h"
Include dependency graph for tabdata.c:

Go to the source code of this file.

Functions

void bn_table_free (struct bn_table *tabp)
 
void bn_tabdata_free (struct bn_tabdata *data)
 
void bn_ck_table (const struct bn_table *tabp)
 
struct bn_tablebn_table_make_uniform (size_t num, double first, double last)
 
void bn_tabdata_add (struct bn_tabdata *out, const struct bn_tabdata *in1, const struct bn_tabdata *in2)
 
void bn_tabdata_mul (struct bn_tabdata *out, const struct bn_tabdata *in1, const struct bn_tabdata *in2)
 
void bn_tabdata_mul3 (struct bn_tabdata *out, const struct bn_tabdata *in1, const struct bn_tabdata *in2, const struct bn_tabdata *in3)
 
void bn_tabdata_incr_mul3_scale (struct bn_tabdata *out, const struct bn_tabdata *in1, const struct bn_tabdata *in2, const struct bn_tabdata *in3, register double scale)
 
void bn_tabdata_incr_mul2_scale (struct bn_tabdata *out, const struct bn_tabdata *in1, const struct bn_tabdata *in2, register double scale)
 
void bn_tabdata_scale (struct bn_tabdata *out, const struct bn_tabdata *in1, register double scale)
 
void bn_table_scale (struct bn_table *tabp, register double scale)
 
void bn_tabdata_join1 (struct bn_tabdata *out, const struct bn_tabdata *in1, register double scale, const struct bn_tabdata *in2)
 
void bn_tabdata_join2 (struct bn_tabdata *out, const struct bn_tabdata *in1, register double scale2, const struct bn_tabdata *in2, register double scale3, const struct bn_tabdata *in3)
 
void bn_tabdata_blend2 (struct bn_tabdata *out, register double scale1, const struct bn_tabdata *in1, register double scale2, const struct bn_tabdata *in2)
 
void bn_tabdata_blend3 (struct bn_tabdata *out, register double scale1, const struct bn_tabdata *in1, register double scale2, const struct bn_tabdata *in2, register double scale3, const struct bn_tabdata *in3)
 
double bn_tabdata_area1 (const struct bn_tabdata *in)
 
double bn_tabdata_area2 (const struct bn_tabdata *in)
 
double bn_tabdata_mul_area1 (const struct bn_tabdata *in1, const struct bn_tabdata *in2)
 
double bn_tabdata_mul_area2 (const struct bn_tabdata *in1, const struct bn_tabdata *in2)
 
long bn_table_find_x (const struct bn_table *tabp, double xval)
 
fastf_t bn_table_lin_interp (const struct bn_tabdata *samp, register double wl)
 
struct bn_tabdatabn_tabdata_resample_max (const struct bn_table *newtable, const struct bn_tabdata *olddata)
 
struct bn_tabdatabn_tabdata_resample_avg (const struct bn_table *newtable, const struct bn_tabdata *olddata)
 
int bn_table_write (const char *filename, const struct bn_table *tabp)
 
struct bn_tablebn_table_read (const char *filename)
 
void bn_pr_table (const char *title, const struct bn_table *tabp)
 
void bn_pr_tabdata (const char *title, const struct bn_tabdata *data)
 
int bn_print_table_and_tabdata (const char *filename, const struct bn_tabdata *data)
 
struct bn_tabdatabn_read_table_and_tabdata (const char *filename)
 
struct bn_tabdatabn_tabdata_binary_read (const char *filename, size_t num, const struct bn_table *tabp)
 
struct bn_tabdatabn_tabdata_malloc_array (const struct bn_table *tabp, size_t num)
 
void bn_tabdata_copy (struct bn_tabdata *out, const struct bn_tabdata *in)
 
struct bn_tabdatabn_tabdata_dup (const struct bn_tabdata *in)
 
struct bn_tabdatabn_tabdata_get_constval (double val, const struct bn_table *tabp)
 
void bn_tabdata_constval (struct bn_tabdata *data, double val)
 
void bn_tabdata_to_tcl (struct bu_vls *vp, const struct bn_tabdata *data)
 
struct bn_tabdatabn_tabdata_from_array (const double *array)
 
void bn_tabdata_freq_shift (struct bn_tabdata *out, const struct bn_tabdata *in, double offset)
 
int bn_table_interval_num_samples (const struct bn_table *tabp, double low, double hi)
 
int bn_table_delete_sample_pts (struct bn_table *tabp, unsigned int i, unsigned int j)
 
struct bn_tablebn_table_merge2 (const struct bn_table *a, const struct bn_table *b)
 
struct bn_tabdatabn_tabdata_mk_linear_filter (const struct bn_table *spectrum, double lower_wavelen, double upper_wavelen)
 

Detailed Description

Routines for processing tables (curves) of data with one independent parameter which is common to many sets of dependent data values.

Operates on bn_table (independent var) and bn_tabdata (dependent variable) structures.

One application is for storing spectral curves, see spectrum.c

Inspired by -
Roy Hall and his book "Illumination and Color in Computer @n Generated Imagery", Springer Verlag, New York, 1989.
ISBN 0-387-96774-5

With thanks to Russ Moulton Jr, EOSoft Inc. for his "rad.c" module.

Definition in file tabdata.c.

Function Documentation

void bn_tabdata_incr_mul3_scale ( struct bn_tabdata out,
const struct bn_tabdata in1,
const struct bn_tabdata in2,
const struct bn_tabdata in3,
register double  scale 
)

Definition at line 203 of file tabdata.c.

References BN_CK_TABDATA, bu_bomb(), bu_debug, BU_DEBUG_TABDATA, bu_log(), bn_tabdata::ny, bn_tabdata::table, and bn_tabdata::y.

Here is the call graph for this function:

void bn_tabdata_incr_mul2_scale ( struct bn_tabdata out,
const struct bn_tabdata in1,
const struct bn_tabdata in2,
register double  scale 
)

Definition at line 230 of file tabdata.c.

References BN_CK_TABDATA, bu_bomb(), bu_debug, BU_DEBUG_TABDATA, bu_log(), bn_tabdata::ny, bn_tabdata::table, and bn_tabdata::y.

Here is the call graph for this function:

void bn_tabdata_scale ( struct bn_tabdata out,
const struct bn_tabdata in1,
register double  scale 
)

Definition at line 255 of file tabdata.c.

References BN_CK_TABDATA, bu_bomb(), bu_debug, BU_DEBUG_TABDATA, bu_log(), bn_tabdata::ny, bn_tabdata::table, and bn_tabdata::y.

Here is the call graph for this function:

void bn_table_scale ( struct bn_table tabp,
register double  scale 
)

Definition at line 279 of file tabdata.c.

References BN_CK_TABLE, bu_debug, BU_DEBUG_TABDATA, bu_log(), bn_table::nx, and bn_table::x.

Here is the call graph for this function:

void bn_tabdata_join1 ( struct bn_tabdata out,
const struct bn_tabdata in1,
register double  scale,
const struct bn_tabdata in2 
)

Definition at line 295 of file tabdata.c.

References BN_CK_TABDATA, bu_bomb(), bu_debug, BU_DEBUG_TABDATA, bu_log(), bn_tabdata::ny, bn_tabdata::table, and bn_tabdata::y.

Here is the call graph for this function:

void bn_tabdata_join2 ( struct bn_tabdata out,
const struct bn_tabdata in1,
register double  scale2,
const struct bn_tabdata in2,
register double  scale3,
const struct bn_tabdata in3 
)

Definition at line 323 of file tabdata.c.

References BN_CK_TABDATA, bu_bomb(), bu_debug, BU_DEBUG_TABDATA, bu_log(), bn_tabdata::ny, bn_tabdata::table, and bn_tabdata::y.

Here is the call graph for this function:

void bn_tabdata_blend2 ( struct bn_tabdata out,
register double  scale1,
const struct bn_tabdata in1,
register double  scale2,
const struct bn_tabdata in2 
)

Definition at line 354 of file tabdata.c.

References BN_CK_TABDATA, bu_bomb(), bu_debug, BU_DEBUG_TABDATA, bu_log(), bn_tabdata::ny, bn_tabdata::table, and bn_tabdata::y.

Here is the call graph for this function:

void bn_tabdata_blend3 ( struct bn_tabdata out,
register double  scale1,
const struct bn_tabdata in1,
register double  scale2,
const struct bn_tabdata in2,
register double  scale3,
const struct bn_tabdata in3 
)

Definition at line 382 of file tabdata.c.

References BN_CK_TABDATA, bu_bomb(), bu_debug, BU_DEBUG_TABDATA, bu_log(), bn_tabdata::ny, bn_tabdata::table, and bn_tabdata::y.

Here is the call graph for this function:

long bn_table_find_x ( const struct bn_table tabp,
double  xval 
)

Definition at line 512 of file tabdata.c.

References BN_CK_TABLE, bu_debug, BU_DEBUG_TABDATA, bu_log(), bn_table::nx, and bn_table::x.

Referenced by bn_tabdata_mk_linear_filter(), bn_tabdata_resample_avg(), bn_tabdata_resample_max(), and bn_table_lin_interp().

Here is the call graph for this function:

fastf_t bn_table_lin_interp ( const struct bn_tabdata samp,
register double  wl 
)

Definition at line 531 of file tabdata.c.

References BN_CK_TABDATA, BN_CK_TABLE, bn_table_find_x(), bu_bomb(), bu_debug, BU_DEBUG_TABDATA, bu_log(), if(), bn_table::nx, bn_tabdata::table, bn_table::x, and bn_tabdata::y.

Referenced by bn_tabdata_freq_shift(), bn_tabdata_resample_avg(), and bn_tabdata_resample_max().

Here is the call graph for this function: