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 <stdio.h>
#include <math.h>
#include <fcntl.h>
#include <strings.h>
#include "machine.h"
#include "vmath.h"
#include "bu.h"
#include "bn.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)
bn_tablebn_table_make_uniform (int 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)
int 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)
bn_tabdatabn_tabdata_resample_max (const struct bn_table *newtable, const struct bn_tabdata *olddata)
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)
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)
bn_tabdatabn_read_table_and_tabdata (const char *filename)
bn_tabdatabn_tabdata_binary_read (const char *filename, int num, const struct bn_table *tabp)
bn_tabdatabn_tabdata_malloc_array (const struct bn_table *tabp, int num)
void bn_tabdata_copy (struct bn_tabdata *out, const struct bn_tabdata *in)
bn_tabdatabn_tabdata_dup (const struct bn_tabdata *in)
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)
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, int i, int j)
bn_tablebn_table_merge2 (const struct bn_table *a, const struct bn_table *b)
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

Author:
Michael John Muuss
Source
The U. S. Army Research Laboratory
Aberdeen Proving Ground, Maryland 21005-5068 USA
Inspired by -
Roy Hall and his book "Illumination and Color in Computer
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_table_free struct bn_table tabp  ) 
 

Definition at line 79 of file tabdata.c.

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

Here is the call graph for this function:

void bn_tabdata_free struct bn_tabdata data  ) 
 

Definition at line 92 of file tabdata.c.

References BN_CK_TABDATA, BN_CK_TABLE, bu_debug, BU_DEBUG_TABDATA, bu_free(), bu_log(), data, and NULL.

Here is the call graph for this function:

void bn_ck_table const struct bn_table tabp  ) 
 

Definition at line 108 of file tabdata.c.

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

Here is the call graph for this function:

struct bn_table* bn_table_make_uniform int  num,
double  first,
double  last
 

Definition at line 131 of file tabdata.c.

References BN_GET_TABLE, bu_bomb(), bu_debug, BU_DEBUG_TABDATA, bu_log(), fp, and bn_table::x.

Here is the call graph for this function:

void bn_tabdata_add struct bn_tabdata out,
const struct bn_tabdata in1,
const struct bn_tabdata in2
 

Definition at line 162 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_mul struct bn_tabdata out,
const struct bn_tabdata in1,
const struct bn_tabdata in2
 

Definition at line 193 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_mul3 struct bn_tabdata out,
const struct bn_tabdata in1,
const struct bn_tabdata in2,
const struct bn_tabdata in3
 

Definition at line 224 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_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 259 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 293 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 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_table_scale struct bn_table tabp,
register double  scale
 

Definition at line 352 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 375 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 411 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 445 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 476 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:

double bn_tabdata_area1 const struct bn_tabdata in  ) 
 

Definition at line 515 of file tabdata.c.

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

Here is the call graph for this function:

double bn_tabdata_area2 const struct bn_tabdata in  ) 
 

Definition at line 542 of file tabdata.c.

References BN_CK_TABDATA, BN_CK_TABLE, bu_debug, BU_DEBUG_TABDATA, bu_log(), FAST, bn_tabdata::ny, bn_tabdata::table, width, bn_table::x, and bn_tabdata::y.

Here is the call graph for this function:

double bn_tabdata_mul_area1 const struct bn_tabdata in1,
const struct bn_tabdata in2
 

Definition at line 573 of file tabdata.c.

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

Here is the call graph for this function:

double bn_tabdata_mul_area2 const struct bn_tabdata in1,
const struct bn_tabdata in2
 

Definition at line 601 of file tabdata.c.

References BN_CK_TABDATA, BN_CK_TABLE, bu_debug, BU_DEBUG_TABDATA, bu_log(), FAST, bn_tabdata::ny, bn_tabdata::table, width, bn_table::x, and bn_tabdata::y.

Here is the call graph for this function:

int bn_table_find_x const struct bn_table tabp,
double  xval
 

Definition at line 639 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 665 of file tabdata.c.

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

Here is the call graph for this function:

struct bn_tabdata* bn_tabdata_resample_max const struct bn_table newtable,
const struct bn_tabdata olddata
 

Definition at line 715 of file tabdata.c.

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

Here is the call graph for this function:

struct bn_tabdata* bn_tabdata_resample_avg const struct bn_table newtable,
const struct bn_tabdata olddata
 

Definition at line 796 of file tabdata.c.

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

Here is the call graph for this function:

int bn_table_write const char *  filename,
const struct bn_table tabp
 

Definition at line 879 of file tabdata.c.

References BN_CK_TABLE, bu_debug, BU_DEBUG_TABDATA, bu_log(), BU_SEM_SYSCALL, bu_semaphore_acquire(), bu_semaphore_release(), fp, NULL, bn_table::nx, perror(), and bn_table::x.

Here is the call graph for this function:

struct bn_table* bn_table_read const char *  filename  ) 
 

Definition at line 916 of file tabdata.c.

References BN_GET_TABLE, bu_bomb(), bu_debug, BU_DEBUG_TABDATA, bu_log(), BU_SEM_SYSCALL, bu_semaphore_acquire(), bu_semaphore_release(), bu_vls_addr(), bu_vls_free(), bu_vls_gets(), bu_vls_init(), fp, NULL, bn_table::nx, perror(), and bn_table::x.

Here is the call graph for this function:

void bn_pr_table const char *  title,
const struct bn_table tabp
 

Definition at line 963 of file tabdata.c.

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

Here is the call graph for this function:

void bn_pr_tabdata const char *  title,
const struct bn_tabdata data
 

Definition at line 979 of file tabdata.c.

References BN_CK_TABDATA, bu_log(), and data.

Here is the call graph for this function:

int bn_print_table_and_tabdata const char *  filename,
const struct bn_tabdata data
 

Definition at line 1003 of file tabdata.c.

References BN_CK_TABDATA, BN_CK_TABLE, bu_debug, BU_DEBUG_TABDATA, bu_log(), BU_SEM_SYSCALL, bu_semaphore_acquire(), bu_semaphore_release(), data, fp, NULL, bn_table::nx, perror(), and bn_table::x.

Here is the call graph for this function:

struct bn_tabdata* bn_read_table_and_tabdata const char *  filename  ) 
 

Definition at line 1047 of file tabdata.c.

References bu_debug, BU_DEBUG_TABDATA, bu_log(), BU_SEM_SYSCALL, bu_semaphore_acquire(), bu_semaphore_release(), data, fp, NULL, and perror().

Here is the call graph for this function:

struct bn_tabdata* bn_tabdata_binary_read const char *  filename,
int  num,
const struct bn_table tabp
 

Definition at line 1107 of file tabdata.c.

References BN_CK_TABDATA, BN_CK_TABLE, BN_SIZEOF_TABDATA, bu_debug, BU_DEBUG_TABDATA, bu_free(), bu_log(), bu_malloc(), BU_SEM_SYSCALL, bu_semaphore_acquire(), bu_semaphore_release(), data, NULL, and perror().

Here is the call graph for this function:

struct bn_tabdata* bn_tabdata_malloc_array const struct bn_table tabp,
int  num
 

Definition at line 1180 of file tabdata.c.

References BN_CK_TABLE, BN_SIZEOF_TABDATA, BN_TABDATA_MAGIC, bu_calloc(), bu_debug, BU_DEBUG_TABDATA, bu_log(), data, and bn_table::nx.

Here is the call graph for this function:

void bn_tabdata_copy struct bn_tabdata out,
const struct bn_tabdata in
 

Definition at line 1214 of file tabdata.c.

References bcopy, BN_CK_TABDATA, BN_SIZEOF_TABDATA_Y, 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:

struct bn_tabdata* bn_tabdata_dup const struct bn_tabdata in  ) 
 

Definition at line 1233 of file tabdata.c.

References bcopy, BN_CK_TABDATA, BN_GET_TABDATA, BN_SIZEOF_TABDATA_Y, bu_debug, BU_DEBUG_TABDATA, bu_log(), data, bn_tabdata::table, and bn_tabdata::y.

Here is the call graph for this function:

struct bn_tabdata* bn_tabdata_get_constval double  val,
const struct bn_table tabp
 

Definition at line 1253 of file tabdata.c.

References BN_CK_TABLE, BN_GET_TABDATA, bu_debug, BU_DEBUG_TABDATA, bu_log(), and data.

Here is the call graph for this function:

void bn_tabdata_constval struct bn_tabdata data,
double  val
 

Definition at line 1277 of file tabdata.c.

References BN_CK_TABDATA, bu_debug, BU_DEBUG_TABDATA, bu_log(), and data.

Here is the call graph for this function:

void bn_tabdata_to_tcl struct bu_vls vp,
const struct bn_tabdata data
 

Definition at line 1299 of file tabdata.c.

References BN_CK_TABDATA, BN_CK_TABLE, BU_CK_VLS, bu_debug, BU_DEBUG_TABDATA, bu_log(), bu_vls_printf(), bu_vls_strcat(), data, FAST, MAX_FASTF, bn_table::nx, and bn_table::x.

Here is the call graph for this function:

struct bn_tabdata* bn_tabdata_from_array const double *  array  ) 
 

Definition at line 1338 of file tabdata.c.

References BN_GET_TABLE, data, and bn_table::x.

void bn_tabdata_freq_shift struct bn_tabdata out,
const struct bn_tabdata in,
double  offset
 

Definition at line 1374 of file tabdata.c.

References BN_CK_TABDATA, bn_table_lin_interp(), bu_bomb(), bu_debug, bu_log(), bn_tabdata::ny, bn_tabdata::table, bn_table::x, and bn_tabdata::y.

Here is the call graph for this function:

int bn_table_interval_num_samples const struct bn_table tabp,
double  low,
double  hi
 

Definition at line 1401 of file tabdata.c.

References BN_CK_TABLE, bn_table::nx, and bn_table::x.

Referenced by rt_spect_make_CIE_XYZ().

int bn_table_delete_sample_pts struct bn_table tabp,
int  i,
int  j
 

Definition at line 1424 of file tabdata.c.

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

Here is the call graph for this function:

struct bn_table* bn_table_merge2 const struct bn_table a,
const struct bn_table b
 

Definition at line 1455 of file tabdata.c.

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

Here is the call graph for this function:

struct bn_tabdata* bn_tabdata_mk_linear_filter const struct bn_table spectrum,
double  lower_wavelen,
double  upper_wavelen
 

Definition at line 1510 of file tabdata.c.

References BN_CK_TABLE, BN_GET_TABDATA, bn_table_find_x(), BU_ASSERT, bu_debug, BU_DEBUG_TABDATA, bu_log(), NULL, bn_table::nx, bn_table::x, and bn_tabdata::y.

Here is the call graph for this function:


Generated on Mon Sep 18 01:25:03 2006 for BRL-CAD by  doxygen 1.4.6