bn.h File Reference

#include "common.h"
#include <limits.h>
#include <stddef.h>
#include <signal.h>
#include "common.h"
#include <stdlib.h>
#include <sys/types.h>
#include <setjmp.h>
#include "tcl.h"
#include <math.h>
#include <float.h>
#include "bu.h"
Include dependency graph for bn.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  bn_tol
 Support for uniform tolerances. More...
struct  bn_complex
struct  bn_unif
struct  bn_gauss
struct  bn_poly
struct  bn_multipoly
struct  bn_table
struct  bn_tabdata
struct  bn_vlist
struct  bn_vlblock
struct  vert_root
struct  plane_specific
struct  tri_specific
struct  tri_float_specific

Defines

#define BN_AZIMUTH   0
#define BN_ELEVATION   1
#define BN_TWIST   2
#define BN_CK_TOL(_p)   BU_CKMAG(_p, BN_TOL_MAGIC, "bn_tol")
#define BN_TOL_INIT(_p)
#define BN_TOL_INIT_ZERO   { BN_TOL_MAGIC, 0.0, 0.0, 0.0, 1.0 }
#define BN_TOL_IS_INITIALIZED(_p)   (((struct bn_tol *)(_p) != (struct bn_tol *)0) && LIKELY((_p)->magic == BN_TOL_MAGIC))
#define BN_VECT_ARE_PARALLEL(_dot, _tol)   (((_dot) <= -SMALL_FASTF) ? (NEAR_EQUAL((_dot), -1.0, (_tol)->perp)) : (NEAR_EQUAL((_dot), 1.0, (_tol)->perp)))
#define BN_VECT_ARE_PERP(_dot, _tol)   (((_dot) < 0) ? ((-(_dot))<=(_tol)->perp) : ((_dot) <= (_tol)->perp))
#define bn_cx_copy(ap, bp)   {*(ap) = *(bp);}
#define bn_cx_neg(cp)   { (cp)->re = -((cp)->re);(cp)->im = -((cp)->im);}
#define bn_cx_real(cp)   (cp)->re
#define bn_cx_imag(cp)   (cp)->im
#define bn_cx_add(ap, bp)   { (ap)->re += (bp)->re; (ap)->im += (bp)->im;}
#define bn_cx_ampl(cp)   hypot((cp)->re, (cp)->im)
#define bn_cx_amplsq(cp)   ((cp)->re * (cp)->re + (cp)->im * (cp)->im)
#define bn_cx_conj(cp)   { (cp)->im = -(cp)->im; }
#define bn_cx_cons(cp, r, i)   { (cp)->re = r; (cp)->im = i; }
#define bn_cx_phas(cp)   atan2((cp)->im, (cp)->re)
#define bn_cx_scal(cp, s)   { (cp)->re *= (s); (cp)->im *= (s); }
#define bn_cx_sub(ap, bp)   { (ap)->re -= (bp)->re; (ap)->im -= (bp)->im;}
#define bn_cx_mul(ap, bp)
#define bn_cx_mul2(ap, bp, cp)
#define bn_mat_zero(_m)
#define bn_mat_idn(_m)
#define bn_mat_copy(_d, _s)
#define BN_CK_UNIF(_p)   BU_CKMAG(_p, BN_UNIF_MAGIC, "bn_unif")
#define BN_CK_GAUSS(_p)   BU_CKMAG(_p, BN_GAUSS_MAGIC, "bn_gauss")
#define BN_UNIF_LONG(_p)
#define BN_UNIF_DOUBLE(_p)
#define BN_UNIF_CIRCLE(_p, _x, _y, _r)
#define BN_UNIF_SPHERE(_p, _x, _y, _z, _r)
#define BN_GAUSS_DOUBLE(_p)
#define BN_MAX_POLY_DEGREE   4
#define BN_CK_POLY(_p)   BU_CKMAG(_p, BN_POLY_MAGIC, "struct bn_poly")
#define BN_POLY_NULL   ((struct bn_poly *)NULL)
#define BN_RAND_TABSIZE   4096
#define BN_RAND_TABMASK   0xfff
#define BN_RANDSEED(_i, _seed)   _i = ((unsigned)_seed) % BN_RAND_TABSIZE
#define BN_RANDOM(_i)   bn_rand_table[ _i = (_i+1) % BN_RAND_TABSIZE ]
#define BN_RANDHALF(_i)   (bn_rand_table[ _i = (_i+1) % BN_RAND_TABSIZE ]-0.5)
#define BN_RANDHALF_INIT(_p)   _p = bn_rand_table
#define BN_RANDHALFTABSIZE   16535
#define bn_rand_half(_p)
#define bn_rand_init(_p, _seed)
#define bn_rand0to1(_q)   (bn_rand_half(_q)+0.5)
#define BN_SINTABSIZE   2048
#define bn_tab_sin(_a)
#define CK_POW_2(dimen)
#define BN_CK_TABLE(_p)   BU_CKMAG(_p, BN_TABLE_MAGIC, "bn_table")
#define BN_TABLE_NULL   ((struct bn_table *)NULL)
#define BN_GET_TABLE(_table, _nx)
#define BN_CK_TABDATA(_p)   BU_CKMAG(_p, BN_TABDATA_MAGIC, "bn_tabdata")
#define BN_TABDATA_NULL   ((struct bn_tabdata *)NULL)
#define BN_SIZEOF_TABDATA_Y(_tabdata)   sizeof(fastf_t)*((_tabdata)->ny)
#define BN_SIZEOF_TABDATA(_table)
#define BN_GET_TABDATA(_data, _table)
#define BN_VLIST_CHUNK   35
 32-bit mach => just less than 1k
#define BN_VLIST_NULL   ((struct bn_vlist *)0)
#define BN_CK_VLIST(_p)   BU_CKMAG((_p), BN_VLIST_MAGIC, "bn_vlist")
#define BN_VLIST_LINE_MOVE   0
#define BN_VLIST_LINE_DRAW   1
#define BN_VLIST_POLY_START   2
 pt[] has surface normal
#define BN_VLIST_POLY_MOVE   3
 move to first poly vertex
#define BN_VLIST_POLY_DRAW   4
 subsequent poly vertex
#define BN_VLIST_POLY_END   5
 last vert (repeats 1st), draw poly
#define BN_VLIST_POLY_VERTNORM   6
 per-vertex normal, for interpoloation
#define BN_VLIST_TRI_START   7
 pt[] has surface normal
#define BN_VLIST_TRI_MOVE   8
 move to first triangle vertex
#define BN_VLIST_TRI_DRAW   9
 subsequent triangle vertex
#define BN_VLIST_TRI_END   10
 last vert (repeats 1st), draw poly
#define BN_VLIST_TRI_VERTNORM   11
 per-vertex normal, for interpoloation
#define BN_VLIST_POINT_DRAW   12
 Draw a single point.
#define BN_VLIST_CMD_MAX   12
 Max command number.
#define BN_GET_VLIST(_free_hd, p)
#define BN_FREE_VLIST(_free_hd, hd)
#define BN_ADD_VLIST(_free_hd, _dest_hd, pnt, draw)
#define BN_CK_VLBLOCK(_p)   BU_CKMAG((_p), BN_VLBLOCK_MAGIC, "bn_vlblock")
#define TREE_TYPE_VERTS   1
#define TREE_TYPE_VERTS_AND_NORMS   2
#define VERT_BLOCK   512
 number of vertices to malloc per call when building the array
#define BN_CK_VERT_TREE(_p)   BU_CKMAG(_p, VERT_TREE_MAGIC, "vert_tree")
#define MAXPTS   4
 All we need are 4 points.
#define pl_A   pl_points[0]
 Synonym for A point.

Typedefs

typedef struct bn_complex bn_complex_t
typedef struct bn_poly bn_poly_t
typedef struct bn_multipoly bn_multipoly_t
typedef struct tri_specific tri_specific_double
typedef struct tri_float_specific tri_specific_float

Functions

void anim_v_permute (mat_t m)
 Pre-multiply a rotation matrix by a matrix which maps the z-axis to the negative x-axis, the y-axis to the z-axis and the x-axis to the negative y-axis.
void anim_v_unpermute (mat_t m)
 Undo the mapping done by anim_v_permute().
void anim_tran (mat_t m)
 Transpose matrix in place.
int anim_mat2zyx (const mat_t viewrot, vect_t angle)
 Convert the rotational part of a 4x4 transformation matrix to zyx form, that is to say, rotations carried out in the order z, y, and then x. The angles are stored in radians as a vector in the order x, y, z. A return value of ERROR1 means that arbitrary assumptions were necessary. ERROR2 means that the conversion failed.
int anim_mat2ypr (mat_t viewrot, vect_t angle)
 Convert the rotational part of a 4x4 transformation matrix to yaw-pitch-roll form, that is to say, +roll degrees about the x-axis, -pitch degrees about the y-axis, and +yaw degrees about the z-axis. The angles are stored in radians as a vector in the order y, p, r. A return of ERROR1 means that arbitrary assumptions were necessary. ERROR2 means that the conversion failed.
int anim_mat2quat (quat_t quat, const mat_t viewrot)
 This interprets the rotational part of a 4x4 transformation matrix in terms of unit quaternions. The result is stored as a vector in the order x, y, z, w. The algorithm is from Ken Shoemake, Animating Rotation with Quaternion Curves, 1985 SIGGraph Conference Proceeding, p.245.
void anim_ypr2mat (mat_t m, const vect_t a)
 Create a premultiplication rotation matrix to turn the front of an object (its x-axis) to the given yaw, pitch, and roll, which is stored in radians in the vector a.
void anim_ypr2vmat (mat_t m, const vect_t a)
 Create a post-multiplication rotation matrix, which could be used to move the virtual camera to the given yaw, pitch, and roll, which are stored in radians in the given vector a. The following are equivalent sets of commands:
void anim_y_p_r2mat (mat_t m, double y, double p, double r)
 Make matrix to rotate an object to the given yaw, pitch, and roll. (Specified in radians.).
void anim_dy_p_r2mat (mat_t m, double y, double p, double r)
 Make matrix to rotate an object to the given yaw, pitch, and roll. (Specified in degrees.).
void anim_dy_p_r2vmat (mat_t m, double yaw, double pch, double rll)
 Make a view rotation matrix, given desired yaw, pitch and roll. (Note that the matrix is a permutation of the object rotation matrix).
void anim_x_y_z2mat (mat_t m, double x, double y, double z)
 Make a rotation matrix corresponding to a rotation of "x" radians about the x-axis, "y" radians about the y-axis, and then "z" radians about the z-axis.
void anim_dx_y_z2mat (mat_t m, double x, double y, double z)
 Make a rotation matrix corresponding to a rotation of "x" degrees about the x-axis, "y" degrees about the y-axis, and then "z" degrees about the z-axis.
void anim_zyx2mat (mat_t m, const vect_t a)
 Make a rotation matrix corresponding to a rotation of "z" radians about the z-axis, "y" radians about the y-axis, and then "x" radians about the x-axis.
void anim_z_y_x2mat (mat_t m, double x, double y, double z)
 Make a rotation matrix corresponding to a rotation of "z" radians about the z-axis, "y" radians about the y-axis, and then "x" radians about the x-axis.
void anim_dz_y_x2mat (mat_t m, double x, double y, double z)
 Make a rotation matrix corresponding to a rotation of "z" degrees about the z-axis, "y" degrees about the y-axis, and then "x" degrees about the x-axis.
void anim_quat2mat (mat_t m, const quat_t qq)
 Make 4x4 matrix from the given quaternion Note: these quaternions are the conjugates of the quaternions used in the librt/qmath.c quat_quat2mat().
void anim_dir2mat (mat_t m, const vect_t d, const vect_t d2)
 make a matrix which turns a vehicle from the x-axis to point in the desired direction, staying "right-side up" (ie the y-axis never has a z-component). A second direction vector is consulted when the given direction is vertical. This is intended to represent the the direction from a previous frame.
void anim_dirn2mat (mat_t m, const vect_t dx, const vect_t dn)
 make a matrix which turns a vehicle from the x-axis to point in the desired direction, staying "right-side up". In cases where the direction is vertical, the second vector is consulted. The second vector defines a normal to the the vertical plane into which the vehicle's x and z axes should be put. A good choice to put here is the direction of the vehicle's y-axis in the previous frame.
int anim_steer_mat (mat_t mat, vect_t point, int end)
 given the next frame's position, remember the value of the previous frame's position and calculate a matrix which points the x-axis in the direction defined by those two positions. Return new matrix, and the remembered value of the current position, as arguments; return 1 as the normal value, and 0 when there is not yet information to remember.
void anim_add_trans (mat_t m, const vect_t post, const vect_t pre)
 Add pre- and post- translation to a rotation matrix. The resulting matrix has the effect of performing the first translation, followed by the rotation, followed by the second translation.
void anim_rotatez (fastf_t a, vect_t d)
 Rotate the vector "d" through "a" radians about the z-axis.
void anim_mat_print (FILE *fp, const mat_t m, int s_colon)
 print out 4X4 matrix, with optional colon
void anim_mat_printf (FILE *fp, const mat_t m, const char *formstr, const char *linestr, const char *endstr)
 print out 4X4 matrix. formstr must be less than twenty chars
void anim_view_rev (mat_t m)
 Reverse the direction of a view matrix, keeping it right-side up.
int bn_decode_mat (mat_t m, const char *str)
int bn_decode_quat (quat_t q, const char *str)
int bn_decode_vect (vect_t v, const char *str)
int bn_decode_hvect (hvect_t v, const char *str)
void bn_encode_mat (struct bu_vls *vp, const mat_t m)
void bn_encode_quat (struct bu_vls *vp, const quat_t q)
void bn_encode_vect (struct bu_vls *vp, const vect_t v)
void bn_encode_hvect (struct bu_vls *vp, const hvect_t v)
void bn_tcl_setup ()
int Bn_Init ()
void bn_tcl_mat_print ()
void bn_cx_div (bn_complex_t *ap, const bn_complex_t *bp)
 Divide one complex by another.
void bn_cx_sqrt (bn_complex_t *op, const bn_complex_t *ip)
 Compute square root of complex number.
void bn_mat_print (const char *title, const mat_t m)
void bn_mat_print_guts (const char *title, const mat_t m, char *buf, int buflen)
void bn_mat_print_vls (const char *title, const mat_t m, struct bu_vls *vls)
double bn_atan2 (double x, double y)
void bn_mat_mul (mat_t o, const mat_t a, const mat_t b)
void bn_mat_mul2 (const mat_t i, mat_t o)
void bn_mat_mul3 (mat_t o, const mat_t a, const mat_t b, const mat_t c)
void bn_mat_mul4 (mat_t o, const mat_t a, const mat_t b, const mat_t c, const mat_t d)
void bn_matXvec (hvect_t ov, const mat_t im, const hvect_t iv)
void bn_mat_inv (mat_t output, const mat_t input)
int bn_mat_inverse (mat_t output, const mat_t input)
void bn_vtoh_move (vect_t h, const vect_t v)
void bn_htov_move (vect_t v, const vect_t h)
void bn_mat_trn (mat_t om, const mat_t im)
void bn_mat_ae (mat_t m, double azimuth, double elev)
void bn_ae_vec (fastf_t *azp, fastf_t *elp, const vect_t v)
void bn_aet_vec (fastf_t *az, fastf_t *el, fastf_t *twist, vect_t vec_ae, vect_t vec_twist, fastf_t accuracy)
void bn_vec_ae (vect_t vec, fastf_t az, fastf_t el)
void bn_vec_aed (vect_t vec, fastf_t az, fastf_t el, fastf_t dist)
void bn_mat_angles (mat_t mat, double alpha, double beta, double ggamma)
void bn_mat_angles_rad (mat_t mat, double alpha, double beta, double ggamma)
void bn_eigen2x2 (fastf_t *val1, fastf_t *val2, vect_t vec1, vect_t vec2, fastf_t a, fastf_t b, fastf_t c)
void bn_vec_perp (vect_t new_vec, const vect_t old_vec)
void bn_mat_fromto (mat_t m, const vect_t from, const vect_t to)
void bn_mat_xrot (mat_t m, double sinx, double cosx)
void bn_mat_yrot (mat_t m, double siny, double cosy)
void bn_mat_zrot (mat_t m, double sinz, double cosz)
void bn_mat_lookat (mat_t rot, const vect_t dir, int yflip)
void bn_vec_ortho (vect_t out, const vect_t in)
int bn_mat_scale_about_pt (mat_t mat, const point_t pt, const double scale)
void bn_mat_xform_about_pt (mat_t mat, const mat_t xform, const point_t pt)
int bn_mat_is_equal (const mat_t a, const mat_t b, const struct bn_tol *tol)
int bn_mat_is_identity (const mat_t m)
void bn_mat_arb_rot (mat_t m, const point_t pt, const vect_t dir, const fastf_t ang)
matp_t bn_mat_dup (const mat_t in)
int bn_mat_ck (const char *title, const mat_t m)
fastf_t bn_mat_det3 (const mat_t m)
fastf_t bn_mat_determinant (const mat_t m)
int bn_mat_is_non_unif (const mat_t m)
void bn_wrt_point_direc (mat_t out, const mat_t change, const mat_t in, const point_t point, const vect_t direc)
struct bn_unifbn_unif_init (long setseed, int method)
void bn_unif_free (struct bn_unif *p)
long bn_unif_long_fill (struct bn_unif *p)
double bn_unif_double_fill (struct bn_unif *p)
struct bn_gaussbn_gauss_init (long setseed, int method)
void bn_gauss_free (struct bn_gauss *p)
double bn_gauss_fill (struct bn_gauss *p)
struct bn_polybn_poly_mul (struct bn_poly *product, const struct bn_poly *m1, const struct bn_poly *m2)
struct bn_polybn_poly_scale (struct bn_poly *eqn, double factor)
struct bn_polybn_poly_add (struct bn_poly *sum, const struct bn_poly *poly1, const struct bn_poly *poly2)
struct bn_polybn_poly_sub (struct bn_poly *diff, const struct bn_poly *poly1, const struct bn_poly *poly2)
void bn_poly_synthetic_division (struct bn_poly *quo, struct bn_poly *rem, const struct bn_poly *dvdend, const struct bn_poly *dvsor)
int bn_poly_quadratic_roots (struct bn_complex roots[], const struct bn_poly *quadrat)
int bn_poly_cubic_roots (struct bn_complex roots[], const struct bn_poly *eqn)
int bn_poly_quartic_roots (struct bn_complex roots[], const struct bn_poly *eqn)
int bn_poly_findroot (bn_poly_t *eqn, bn_complex_t *nxZ, const char *str)
void bn_poly_eval_w_2derivatives (bn_complex_t *cZ, bn_poly_t *eqn, bn_complex_t *b, bn_complex_t *c, bn_complex_t *d)
int bn_poly_checkroots (bn_poly_t *eqn, bn_complex_t *roots, int nroots)
void bn_poly_deflate (bn_poly_t *oldP, bn_complex_t *root)
int bn_poly_roots (bn_poly_t *eqn, bn_complex_t roots[], const char *name)
void bn_pr_poly (const char *title, const struct bn_poly *eqn)
void bn_pr_roots (const char *title, const struct bn_complex roots[], int n)
void quat_mat2quat (quat_t quat, const mat_t mat)
void quat_quat2mat (mat_t mat, const quat_t quat)
double quat_distance (const quat_t q1, const quat_t q2)
void quat_double (quat_t qout, const quat_t q1, const quat_t q2)
void quat_bisect (quat_t qout, const quat_t q1, const quat_t q2)
void quat_slerp (quat_t qout, const quat_t q1, const quat_t q2, double f)
void quat_sberp (quat_t qout, const quat_t q1, const quat_t qa, const quat_t qb, const quat_t q2, double f)
void quat_make_nearest (quat_t q1, const quat_t q2)
void quat_print (const char *title, const quat_t quat)
void quat_exp (quat_t out, const quat_t in)
void quat_log (quat_t out, const quat_t in)
void bn_mathtab_constant (void)
 For benchmarking purposes, make the random number table predictable. Setting to all zeros keeps dithered values at their original values.
double bn_randmt ()
void bn_randmt_seed (unsigned long seed)
void bn_wlt_haar_1d_double_decompose (double *tbuf, double *buf, unsigned long dimen, unsigned long depth, unsigned long limit)
void bn_wlt_haar_1d_double_reconstruct (double *tbuf, double *buf, unsigned long dimen, unsigned long depth, unsigned long subimage_size, unsigned long limit)
void bn_wlt_haar_1d_float_decompose (float *tbuf, float *buf, unsigned long dimen, unsigned long depth, unsigned long limit)
void bn_wlt_haar_1d_float_reconstruct (float *tbuf, float *buf, unsigned long dimen, unsigned long depth, unsigned long subimage_size, unsigned long limit)
void bn_wlt_haar_1d_char_decompose (char *tbuf, char *buf, unsigned long dimen, unsigned long depth, unsigned long limit)
void bn_wlt_haar_1d_char_reconstruct (char *tbuf, char *buf, unsigned long dimen, unsigned long depth, unsigned long subimage_size, unsigned long limit)
void bn_wlt_haar_1d_short_decompose (short *tbuf, short *buf, unsigned long dimen, unsigned long depth, unsigned long limit)
void bn_wlt_haar_1d_short_reconstruct (short *tbuf, short *buf, unsigned long dimen, unsigned long depth, unsigned long subimage_size, unsigned long limit)
void bn_wlt_haar_1d_int_decompose (int *tbuf, int *buf, unsigned long dimen, unsigned long depth, unsigned long limit)
void bn_wlt_haar_1d_int_reconstruct (int *tbuf, int *buf, unsigned long dimen, unsigned long depth, unsigned long subimage_size, unsigned long limit)
void bn_wlt_haar_1d_long_decompose (long *tbuf, long *buf, unsigned long dimen, unsigned long depth, unsigned long limit)
void bn_wlt_haar_1d_long_reconstruct (long *tbuf, long *buf, unsigned long dimen, unsigned long depth, unsigned long subimage_size, unsigned long limit)
void bn_wlt_haar_2d_double_decompose (double *tbuf, double *buf, unsigned long dimen, unsigned long depth, unsigned long limit)
void bn_wlt_haar_2d_double_reconstruct (double *tbuf, double *buf, unsigned long dimen, unsigned long depth, unsigned long subimage_size, unsigned long limit)
void bn_wlt_haar_2d_float_decompose (float *tbuf, float *buf, unsigned long dimen, unsigned long depth, unsigned long limit)
void bn_wlt_haar_2d_float_reconstruct (float *tbuf, float *buf, unsigned long dimen, unsigned long depth, unsigned long subimage_size, unsigned long limit)
void bn_wlt_haar_2d_char_decompose (char *tbuf, char *buf, unsigned long dimen, unsigned long depth, unsigned long limit)
void bn_wlt_haar_2d_char_reconstruct (char *tbuf, char *buf, unsigned long dimen, unsigned long depth, unsigned long subimage_size, unsigned long limit)
void bn_wlt_haar_2d_short_decompose (short *tbuf, short *buf, unsigned long dimen, unsigned long depth, unsigned long limit)
void bn_wlt_haar_2d_short_reconstruct (short *tbuf, short *buf, unsigned long dimen, unsigned long depth, unsigned long subimage_size, unsigned long limit)
void bn_wlt_haar_2d_int_decompose (int *tbuf, int *buf, unsigned long dimen, unsigned long depth, unsigned long limit)
void bn_wlt_haar_2d_int_reconstruct (int *tbuf, int *buf, unsigned long dimen, unsigned long depth, unsigned long subimage_size, unsigned long limit)
void bn_wlt_haar_2d_long_decompose (long *tbuf, long *buf, unsigned long dimen, unsigned long depth, unsigned long limit)
void bn_wlt_haar_2d_long_reconstruct (long *tbuf, long *buf, unsigned long dimen, unsigned long depth, unsigned long subimage_size, unsigned long limit)
void bn_wlt_haar_2d_double_decompose2 (double *tbuf, double *buf, unsigned long dimen, unsigned long width, unsigned long height, unsigned long limit)
void bn_wlt_haar_2d_double_reconstruct2 (double *tbuf, double *buf, unsigned long dimen, unsigned long width, unsigned long height, unsigned long subimage_size, unsigned long limit)
void bn_wlt_haar_2d_float_decompose2 (float *tbuf, float *buf, unsigned long dimen, unsigned long width, unsigned long height, unsigned long limit)
void bn_wlt_haar_2d_float_reconstruct2 (float *tbuf, float *buf, unsigned long dimen, unsigned long width, unsigned long height, unsigned long subimage_size, unsigned long limit)
void bn_wlt_haar_2d_char_decompose2 (char *tbuf, char *buf, unsigned long dimen, unsigned long width, unsigned long height, unsigned long limit)
void bn_wlt_haar_2d_char_reconstruct2 (char *tbuf, char *buf, unsigned long dimen, unsigned long width, unsigned long height, unsigned long subimage_size, unsigned long limit)
void bn_wlt_haar_2d_short_decompose2 (short *tbuf, short *buf, unsigned long dimen, unsigned long width, unsigned long height, unsigned long limit)
void bn_wlt_haar_2d_short_reconstruct2 (short *tbuf, short *buf, unsigned long dimen, unsigned long width, unsigned long height, unsigned long subimage_size, unsigned long limit)
void bn_wlt_haar_2d_int_decompose2 (int *tbuf, int *buf, unsigned long dimen, unsigned long width, unsigned long height, unsigned long limit)
void bn_wlt_haar_2d_int_reconstruct2 (int *tbuf, int *buf, unsigned long dimen, unsigned long width, unsigned long height, unsigned long subimage_size, unsigned long limit)
void bn_wlt_haar_2d_long_decompose2 (long *tbuf, long *buf, unsigned long dimen, unsigned long width, unsigned long height, unsigned long limit)
void bn_wlt_haar_2d_long_reconstruct2 (long *tbuf, long *buf, unsigned long dimen, unsigned long width, unsigned long height, unsigned long subimage_size, unsigned long limit)
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, double scale)
void bn_tabdata_incr_mul2_scale (struct bn_tabdata *out, const struct bn_tabdata *in1, const struct bn_tabdata *in2, double scale)
void bn_tabdata_scale (struct bn_tabdata *out, const struct bn_tabdata *in1, double scale)
void bn_table_scale (struct bn_table *tabp, double scale)
void bn_tabdata_join1 (struct bn_tabdata *out, const struct bn_tabdata *in1, double scale, const struct bn_tabdata *in2)
void bn_tabdata_join2 (struct bn_tabdata *out, const struct bn_tabdata *in1, double scale2, const struct bn_tabdata *in2, double scale3, const struct bn_tabdata *in3)
void bn_tabdata_blend2 (struct bn_tabdata *out, double scale1, const struct bn_tabdata *in1, double scale2, const struct bn_tabdata *in2)
void bn_tabdata_blend3 (struct bn_tabdata *out, double scale1, const struct bn_tabdata *in1, double scale2, const struct bn_tabdata *in2, 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)
fastf_t bn_table_lin_interp (const struct bn_tabdata *samp, 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)
void bn_vlist_3string (struct bu_list *vhead, struct bu_list *free_hd, const char *string, const point_t origin, const mat_t rot, double scale)
 Convert a string to a vlist.
void bn_vlist_2string (struct bu_list *vhead, struct bu_list *free_hd, const char *string, double x, double y, double scale, double theta)
 Convert string to vlist in 2D.
struct vert_rootcreate_vert_tree ()
 routine to create a vertex tree.
struct vert_rootcreate_vert_tree_w_norms ()
 routine to create a vertex tree.
void free_vert_tree (struct vert_root *tree_root)
 Routine to free a vertex tree and all associated dynamic memory.
int Add_vert (double x, double y, double z, struct vert_root *tree_root, fastf_t local_tol_sq)
 Routine to add a vertex to the current list of part vertices. The array is re-alloc'd if needed. Returns index into the array of vertices where this vertex is stored.
int Add_vert_and_norm (double x, double y, double z, double nx, double ny, double nz, struct vert_root *tree_root, fastf_t local_tol_sq)
 Routine to add a vertex and a normal to the current list of part vertices. The array is re-alloc'd if needed. Returns index into the array of vertices where this vertex and normal is stored.
void clean_vert_tree (struct vert_root *tree_root)
 Routine to free the binary search tree and reset the current number of vertices. The vertex array is left untouched, for re-use later.
void tp_setup ()
 Once-only setup routine Used by libplot3/symbol.c, so it can't be static.
const char * bn_version (void)

Variables

const mat_t bn_mat_identity
const float bn_rand_table [BN_RAND_TABSIZE]
int bn_randhalftabsize
float bn_rand_halftab [BN_RANDHALFTABSIZE]
double bn_sin_scale
const float bn_sin_table [BN_SINTABSIZE]
const double bn_pi
const double bn_twopi
const double bn_halfpi
const double bn_invpi
const double bn_inv2pi
const double bn_inv255
const double bn_degtorad
const double bn_radtodeg



#define BN_CLASSIFY_UNIMPLEMENTED   0x0000
#define BN_CLASSIFY_INSIDE   0x0001
#define BN_CLASSIFY_OVERLAPPING   0x0002
#define BN_CLASSIFY_OUTSIDE   0x0003
void bn_noise_init ()
double bn_noise_perlin (point_t pt)
void bn_noise_vec (point_t point, point_t result)
double bn_noise_fbm (point_t point, double h_val, double lacunarity, double octaves)
double bn_noise_turb (point_t point, double h_val, double lacunarity, double octaves)
double bn_noise_mf (point_t point, double h_val, double lacunarity, double octaves, double offset)
double bn_noise_ridged (point_t point, double h_val, double lacunarity, double octaves, double offset)
int bn_distsq_line3_line3 (fastf_t dist[3], point_t P, vect_t d, point_t Q, vect_t e, point_t pt1, point_t pt2)
int bn_dist_pt3_line3 (fastf_t *dist, point_t pca, const point_t a, const point_t p, const vect_t dir, const struct bn_tol *tol)
int bn_dist_line3_lseg3 (fastf_t *dist, const fastf_t *p, const fastf_t *d, const fastf_t *a, const fastf_t *b, const struct bn_tol *tol)
int bn_dist_line3_line3 (fastf_t dist[2], const point_t p1, const point_t p2, const vect_t d1, const vect_t d2, const struct bn_tol *tol)
int bn_dist_pt3_lseg3 (fastf_t *dist, point_t pca, const point_t a, const point_t b, const point_t p, const struct bn_tol *tol)
int bn_3pts_collinear (point_t a, point_t b, point_t c, const struct bn_tol *tol)
int bn_pt3_pt3_equal (const point_t a, const point_t b, const struct bn_tol *tol)
int bn_dist_pt2_lseg2 (fastf_t *dist_sq, fastf_t pca[2], const point_t a, const point_t b, const point_t p, const struct bn_tol *tol)
int bn_isect_lseg3_lseg3 (fastf_t *dist, const point_t p, const vect_t pdir, const point_t q, const vect_t qdir, const struct bn_tol *tol)
int bn_isect_line3_line3 (fastf_t *s, fastf_t *t, const point_t p0, const vect_t u, const point_t q0, const vect_t v, const struct bn_tol *tol)
int bn_2line3_colinear (const point_t p1, const vect_t d1, const point_t p2, const vect_t d2, double range, const struct bn_tol *tol)
int bn_isect_pt2_lseg2 (fastf_t *dist, const point_t a, const point_t b, const point_t p, const struct bn_tol *tol)
int bn_isect_line2_lseg2 (fastf_t *dist, const point_t p, const vect_t d, const point_t a, const vect_t c, const struct bn_tol *tol)
int bn_isect_lseg2_lseg2 (fastf_t *dist, const point_t p, const vect_t pdir, const point_t q, const vect_t qdir, const struct bn_tol *tol)
int bn_isect_line2_line2 (fastf_t *dist, const point_t p, const vect_t d, const point_t a, const vect_t c, const struct bn_tol *tol)
double bn_dist_pt3_pt3 (const point_t a, const point_t b)
int bn_3pts_distinct (const point_t a, const point_t b, const point_t c, const struct bn_tol *tol)
int bn_npts_distinct (const int npts, const point_t *pts, const struct bn_tol *tol)
int bn_mk_plane_3pts (plane_t plane, const point_t a, const point_t b, const point_t c, const struct bn_tol *tol)
int bn_mkpoint_3planes (point_t pt, const plane_t a, const plane_t b, const plane_t c)
int bn_isect_line3_plane (fastf_t *dist, const point_t pt, const vect_t dir, const plane_t plane, const struct bn_tol *tol)
int bn_isect_2planes (point_t pt, vect_t dir, const plane_t a, const plane_t b, const vect_t rpp_min, const struct bn_tol *tol)
int bn_isect_2lines (fastf_t *t, fastf_t *u, const point_t p, const vect_t d, const point_t a, const vect_t c, const struct bn_tol *tol)
int bn_isect_line_lseg (fastf_t *t, const point_t p, const vect_t d, const point_t a, const point_t b, const struct bn_tol *tol)
double bn_dist_line3_pt3 (const point_t pt, const vect_t dir, const point_t a)
double bn_distsq_line3_pt3 (const point_t pt, const vect_t dir, const point_t a)
double bn_dist_line_origin (const point_t pt, const vect_t dir)
double bn_dist_line2_point2 (const point_t pt, const vect_t dir, const point_t a)
double bn_distsq_line2_point2 (const point_t pt, const vect_t dir, const point_t a)
double bn_area_of_triangle (const point_t a, const point_t b, const point_t c)
int bn_isect_pt_lseg (fastf_t *dist, const point_t a, const point_t b, const point_t p, const struct bn_tol *tol)
double bn_dist_pt_lseg (point_t pca, const point_t a, const point_t b, const point_t p, const struct bn_tol *tol)
void bn_rotate_bbox (point_t omin, point_t omax, const mat_t mat, const point_t imin, const point_t imax)
void bn_rotate_plane (plane_t oplane, const mat_t mat, const plane_t iplane)
int bn_coplanar (const plane_t a, const plane_t b, const struct bn_tol *tol)
double bn_angle_measure (vect_t vec, const vect_t x_dir, const vect_t y_dir)
double bn_dist_pt3_along_line3 (const point_t p, const vect_t d, const point_t x)
double bn_dist_pt2_along_line2 (const point_t p, const vect_t d, const point_t x)
int bn_between (double left, double mid, double right, const struct bn_tol *tol)
int bn_does_ray_isect_tri (const point_t pt, const vect_t dir, const point_t V, const point_t A, const point_t B, point_t inter)
int bn_hlf_class (const plane_t half_eqn, const vect_t min, const vect_t max, const struct bn_tol *tol)
int bn_isect_planes (point_t pt, const plane_t planes[], const size_t pl_count)

Detailed Description

Header file for the BRL-CAD Numerical Computation Library, LIBBN.

The library provides a broad assortment of numerical algorithms and computational routines, including random number generation, vector math, matrix math, quaternion math, complex math, synthetic division, root finding, etc.

Definition in file bn.h.


Define Documentation

#define BN_CLASSIFY_UNIMPLEMENTED   0x0000

Definition at line 992 of file bn.h.

Referenced by bn_hlf_class().

#define BN_CLASSIFY_INSIDE   0x0001

Definition at line 993 of file bn.h.

#define BN_CLASSIFY_OVERLAPPING   0x0002

Definition at line 994 of file bn.h.

#define BN_CLASSIFY_OUTSIDE   0x0003

Definition at line 995 of file bn.h.


Function Documentation

double bn_noise_perlin ( point_t  pt  ) 
void bn_noise_vec ( point_t  point,
point_t  result 
)
double bn_noise_fbm ( point_t  point,
double  h_val,
double  lacunarity,
double  octaves 
)

Referenced by bn_cmd_noise(), and bn_cmd_noise_slice().

double bn_noise_turb ( point_t  point,
double  h_val,
double  lacunarity,
double  octaves 
)

Referenced by bn_cmd_noise(), and bn_cmd_noise_slice().

double bn_noise_mf ( point_t  point,
double  h_val,
double  lacunarity,
double  octaves,
double  offset 
)
double bn_noise_ridged ( point_t  point,
double  h_val,
double  lacunarity,
double  octaves,
double  offset 
)
int bn_distsq_line3_line3 ( fastf_t  dist[3],
point_t  P,
vect_t  d,
point_t  Q,
vect_t  e,
point_t  pt1,
point_t  pt2 
)
int bn_dist_pt3_line3 ( fastf_t *  dist,
point_t  pca,
const point_t  a,
const point_t  p,
const vect_t  dir,
const struct bn_tol tol 
)
int bn_dist_line3_line3 ( fastf_t  dist[2],
const point_t  p1,
const point_t  p2,
const vect_t  d1,
const vect_t  d2,
const struct bn_tol tol 
)

Referenced by bn_dist_line3_lseg3().

int bn_dist_pt3_lseg3 ( fastf_t *  dist,
point_t  pca,
const point_t  a,
const point_t  b,
const point_t  p,
const struct bn_tol tol 
)
int bn_3pts_collinear ( point_t  a,
point_t  b,
point_t  c,
const struct bn_tol tol 
)
int bn_pt3_pt3_equal ( const point_t  a,
const point_t  b,
const struct bn_tol tol 
)

Referenced by bn_coplanar().

int bn_dist_pt2_lseg2 ( fastf_t *  dist_sq,
fastf_t  pca[2],
const point_t  a,
const point_t  b,
const point_t  p,
const struct bn_tol tol 
)
int bn_isect_lseg3_lseg3 ( fastf_t *  dist,
const point_t  p,
const vect_t  pdir,
const point_t  q,
const vect_t  qdir,
const struct bn_tol tol 
)

Referenced by main().

int bn_isect_line3_line3 ( fastf_t *  s,
fastf_t *  t,
const point_t  p0,
const vect_t  u,
const point_t  q0,
const vect_t  v,
const struct bn_tol tol 
)
int bn_2line3_colinear ( const point_t  p1,
const vect_t  d1,
const point_t  p2,
const vect_t  d2,
double  range,
const struct bn_tol tol 
)

Referenced by main().

int bn_isect_pt2_lseg2 ( fastf_t *  dist,
const point_t  a,
const point_t  b,
const point_t  p,
const struct bn_tol tol 
)

Referenced by bn_isect_line2_lseg2().

int bn_isect_line2_lseg2 ( fastf_t *  dist,
const point_t  p,
const vect_t  d,
const point_t  a,
const vect_t  c,
const struct bn_tol tol 
)
int bn_isect_lseg2_lseg2 ( fastf_t *  dist,
const point_t  p,
const vect_t  pdir,
const point_t  q,
const vect_t  qdir,
const struct bn_tol tol 
)
int bn_isect_line2_line2 ( fastf_t *  dist,
const point_t  p,
const vect_t  d,
const point_t  a,
const vect_t  c,
const struct bn_tol tol 
)
double bn_dist_pt3_pt3 ( const point_t  a,
const point_t  b 
)
int bn_3pts_distinct ( const point_t  a,
const point_t  b,
const point_t  c,
const struct bn_tol tol 
)
int bn_mk_plane_3pts ( plane_t  plane,
const point_t  a,
const point_t  b,
const point_t  c,
const struct bn_tol tol 
)
int bn_mkpoint_3planes ( point_t  pt,
const plane_t  a,
const plane_t  b,
const plane_t  c 
)

Referenced by bn_isect_2planes().

int bn_isect_line3_plane ( fastf_t *  dist,
const point_t  pt,
const vect_t  dir,
const plane_t  plane,
const struct bn_tol tol 
)
int bn_isect_2planes ( point_t  pt,
vect_t  dir,
const plane_t  a,
const plane_t  b,
const vect_t  rpp_min,
const struct bn_tol tol 
)
int bn_isect_2lines ( fastf_t *  t,
fastf_t *  u,
const point_t  p,
const vect_t  d,
const point_t  a,
const vect_t  c,
const struct bn_tol tol 
)
int bn_isect_line_lseg ( fastf_t *  t,
const point_t  p,
const vect_t  d,
const point_t  a,
const point_t  b,
const struct bn_tol tol 
)
double bn_dist_line3_pt3 ( const point_t  pt,
const vect_t  dir,
const point_t  a 
)

Referenced by bn_dist_line3_line3().

double bn_distsq_line3_pt3 ( const point_t  pt,
const vect_t  dir,
const point_t  a 
)
double bn_dist_line_origin ( const point_t  pt,
const vect_t  dir 
)
double bn_dist_line2_point2 ( const point_t  pt,
const vect_t  dir,
const point_t  a 
)
double bn_distsq_line2_point2 ( const point_t  pt,
const vect_t  dir,
const point_t  a 
)

Referenced by bn_isect_line2_lseg2().

double bn_area_of_triangle ( const point_t  a,
const point_t  b,
const point_t  c 
)
int bn_isect_pt_lseg ( fastf_t *  dist,
const point_t  a,
const point_t  b,
const point_t  p,
const struct bn_tol tol 
)
double bn_dist_pt_lseg ( point_t  pca,
const point_t  a,
const point_t  b,
const point_t  p,
const struct bn_tol tol 
)
void bn_rotate_bbox ( point_t  omin,
point_t  omax,
const mat_t  mat,
const point_t  imin,
const point_t  imax 
)
void bn_rotate_plane ( plane_t  oplane,
const mat_t  mat,
const plane_t  iplane 
)
int bn_coplanar ( const plane_t  a,
const plane_t  b,
const struct bn_tol tol 
)

Referenced by bn_isect_2planes().

double bn_angle_measure ( vect_t  vec,
const vect_t  x_dir,
const vect_t  y_dir 
)
double bn_dist_pt3_along_line3 ( const point_t  p,
const vect_t  d,
const point_t  x 
)
double bn_dist_pt2_along_line2 ( const point_t  p,
const vect_t  d,
const point_t  x 
)

Referenced by bn_isect_line2_lseg2().

int bn_hlf_class ( const plane_t  half_eqn,
const vect_t  min,
const vect_t  max,
const struct bn_tol tol 
)
int bn_isect_planes ( point_t  pt,
const plane_t  planes[],
const size_t  pl_count 
)
Generated on Tue Dec 11 13:14:28 2012 for LIBBN by  doxygen 1.6.3