BRL-CAD
#include "common.h"
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <setjmp.h>
#include "bnetwork.h"
#include "bu/cv.h"
#include "bu/parallel.h"
#include "vmath.h"
#include "raytrace.h"
#include "rtgeom.h"
#include "db.h"
#include "plot3.h"
#include "./dsp.h"
Include dependency graph for dsp.c:

Go to the source code of this file.

Data Structures

struct  dsp_rpp
 
struct  dsp_bb
 
struct  dsp_bb_layer
 
struct  dsp_specific
 
struct  bbox_isect
 
struct  isect_stuff
 

Macros

#define FULL_DSP_DEBUGGING   1
 
#define ORDERED_ISECT   1
 
#define DIM_BB_CHILDREN   4
 
#define NUM_BB_CHILDREN   (DIM_BB_CHILDREN*DIM_BB_CHILDREN)
 
#define IMPORT_FAIL(_s)
 
#define MAGIC_dsp_bb   234
 
#define DSP_BB_CK(_p)   BU_CKMAG(_p, MAGIC_dsp_bb, "dsp_bb")
 
#define LAYER(l, x, y)   l->p[l->dim[1]*y+x]
 
#define XCNT(_p)   (((struct rt_dsp_internal *)_p)->dsp_xcnt)
 
#define YCNT(_p)   (((struct rt_dsp_internal *)_p)->dsp_ycnt)
 
#define XSIZ(_p)   (_p->dsp_i.dsp_xcnt - 1)
 
#define YSIZ(_p)   (_p->dsp_i.dsp_ycnt - 1)
 
#define dlog   if (RT_G_DEBUG & DEBUG_HF) bu_log
 
#define BBOX_PLANES   7 /* 2 tops & 5 other sides */
 
#define XMIN   0
 
#define XMAX   1
 
#define YMIN   2
 
#define YMAX   3
 
#define ZMIN   4
 
#define ZMAX   5
 
#define ZMID   6
 
#define ZTOP   7
 
#define DSP_O(m)   bu_offsetof(struct rt_dsp_internal, m)
 
#define PLOT_LAYERS
 
#define BBOX_PT(_x, _y, _z)
 
#define BBOX_PT(_x, _y, _z)
 
#define SMOOTHSTEP(x)   ((x)*(x)*(3 - 2*(x)))
 
#define MOVE(_pt)
 
#define DRAW(_pt)
 
#define CHECK_VERTS(_v)
 

Functions

int rt_retrieve_binunif (struct rt_db_internal *intern, const struct db_i *dbip, const char *name)
 
HIDDEN void hook_mtos_from_stom (const struct bu_structparse *sp, const char *sp_name, void *base, const char *p, void *data)
 
HIDDEN void hook_file (const struct bu_structparse *sp, const char *sp_name, void *base, const char *p, void *data)
 
HIDDEN void plot_rpp (FILE *fp, struct bound_rpp *rpp, int r, int g, int b)
 
HIDDEN void plot_dsp_bb (FILE *fp, struct dsp_bb *dsp_bb, struct dsp_specific *dsp, int r, int g, int b, int blather)
 
HIDDEN FILE * draw_dsp_bb (int *plotnum, struct dsp_bb *dsp_bb, struct dsp_specific *dsp, int r, int g, int b)
 
HIDDEN void plot_layers (struct dsp_specific *dsp_sp)
 
HIDDEN void plot_cell_top (struct isect_stuff *isect, struct dsp_bb *dsp_bb, point_t A, point_t B, point_t C, point_t D, struct hit hitlist[], int hitflags, int style)
 
HIDDEN void dsp_print_v4 (struct bu_vls *vls, const struct rt_dsp_internal *dsp_ip)
 
HIDDEN void dsp_print_v5 (struct bu_vls *vls, const struct rt_dsp_internal *dsp_ip)
 
void rt_dsp_print (register const struct soltab *stp)
 
HIDDEN void dsp_layers (struct dsp_specific *dsp, unsigned short *d_min, unsigned short *d_max)
 
int rt_dsp_bbox (struct rt_db_internal *ip, point_t *min, point_t *max, const struct bn_tol *tol)
 
int rt_dsp_prep (struct soltab *stp, struct rt_db_internal *ip, struct rt_i *rtip)
 
HIDDEN void plot_seg (struct isect_stuff *isect, struct hit *in_hit, struct hit *out_hit, const point_t bbmin, const point_t bbmax, int r, int g, int b)
 
HIDDEN int add_seg (struct isect_stuff *isect, struct hit *in_hit, struct hit *out_hit, const point_t bbmin, const point_t bbmax, int r, int g, int b)
 
HIDDEN int isect_ray_triangle (struct isect_stuff *isect, point_t A, point_t B, point_t C, struct hit *hitp, fastf_t alphabbeta[])
 
HIDDEN int permute_cell (point_t A, point_t B, point_t C, point_t D, struct dsp_specific *dsp, struct dsp_rpp *dsp_rpp)
 
HIDDEN int check_bbpt_hit_elev (int i, point_t A, point_t B, point_t C, point_t D, point_t P)
 
HIDDEN int isect_ray_cell_top (struct isect_stuff *isect, struct dsp_bb *dsp_bb)
 
int dsp_in_rpp (struct isect_stuff *isect, register const fastf_t *min, register const fastf_t *max)
 
HIDDEN int isect_ray_dsp_bb (struct isect_stuff *isect, struct dsp_bb *dsp_bb)
 
HIDDEN int recurse_dsp_bb (struct isect_stuff *isect, struct dsp_bb *dsp_bb, point_t minpt, point_t maxpt, point_t bbmin, point_t bbmax)
 
int rt_dsp_shot (struct soltab *stp, register struct xray *rp, struct application *ap, struct seg *seghead)
 
HIDDEN void compute_normal_at_gridpoint (vect_t N, struct dsp_specific *dsp, unsigned int x, unsigned int y, FILE *fd, fastf_t len)
 
void rt_dsp_norm (register struct hit *hitp, struct soltab *stp, register struct xray *rp)
 
void rt_dsp_curve (register struct curvature *cvp, register struct hit *hitp, struct soltab *stp)
 
void rt_dsp_uv (struct application *ap, struct soltab *stp, register struct hit *hitp, register struct uvcoord *uvp)
 
void rt_dsp_free (register struct soltab *stp)
 
int rt_dsp_class (const struct soltab *s, const vect_t v0, const vect_t v2, const struct bn_tol *b)
 
int rt_dsp_plot (struct bu_list *vhead, struct rt_db_internal *ip, const struct rt_tess_tol *ttol, const struct bn_tol *tol, const struct rt_view_info *info)
 
HIDDEN int get_cut_dir (struct rt_dsp_internal *dsp_ip, int x, int y, int xlim, int ylim)
 
int rt_dsp_tess (struct nmgregion **r, struct model *m, struct rt_db_internal *ip, const struct rt_tess_tol *ttol, const struct bn_tol *tol)
 
HIDDEN int get_file_data (struct rt_dsp_internal *dsp_ip, const struct db_i *dbip)
 
HIDDEN int get_obj_data (struct rt_dsp_internal *dsp_ip, const struct db_i *dbip)
 
HIDDEN int dsp_get_data (struct rt_dsp_internal *dsp_ip, const mat_t mat, const struct db_i *dbip)
 
int rt_dsp_import4 (struct rt_db_internal *ip, const struct bu_external *ep, register const fastf_t *mat, const struct db_i *dbip)
 
int rt_dsp_export4 (struct bu_external *ep, const struct rt_db_internal *ip, double local2mm, const struct db_i *dbip)
 
int rt_dsp_import5 (struct rt_db_internal *ip, const struct bu_external *ep, register const fastf_t *mat, const struct db_i *dbip, struct resource *resp)
 
int rt_dsp_export5 (struct bu_external *ep, const struct rt_db_internal *ip, double local2mm, const struct db_i *dbip, struct resource *resp)
 
int rt_dsp_describe (struct bu_vls *str, const struct rt_db_internal *ip, int verbose, double mm2local, struct resource *resp, struct db_i *db_ip)
 
void rt_dsp_ifree (struct rt_db_internal *ip)
 
HIDDEN void hook_verify (const struct bu_structparse *sp, const char *sp_name, void *base, const char *p, void *data)
 
int rt_dsp_get (struct bu_vls *logstr, const struct rt_db_internal *intern, const char *attr)
 
int rt_dsp_adjust (struct bu_vls *logstr, struct rt_db_internal *intern, int argc, const char **argv)
 
void rt_dsp_make (const struct rt_functab *ftp, struct rt_db_internal *intern)
 
int rt_dsp_params (struct pc_pc_set *ps, const struct rt_db_internal *ip)
 
HIDDEN int swap_cell_pts (int A[3], int B[3], int C[3], int D[3], struct dsp_specific *dsp)
 
int project_pt (point_t out, int A[3], int B[3], int C[3], point_t pt)
 
int dsp_pos (point_t out, struct soltab *stp, point_t p)
 

Variables

const struct bu_structparse rt_dsp_parse []
 
const struct bu_structparse rt_dsp_ptab []
 
const struct bu_structparse fake_dsp_printab []
 

Detailed Description

Intersect a ray with a displacement map.

The bounding box planes (in dsp coordinates) are numbered 0 .. 5

For purposes of the "struct hit" surface number, the "non-elevation" surfaces are numbered 0 .. 7 where:

Plane #     Name  plane dist

0 XMIN (dist = 0) 1 XMAX (dist = xsiz) 2 YMIN (dist = 0) 3 YMAX (dist = ysiz) 4 ZMIN (dist = 0) 5 ZMAX (dsp_max)

6 ZMID (dsp_min) 7 ZTOP (computed)

if the "struct hit" surfno surface is ZMAX, then hit_vpriv[X, Y] holds the cell that was hit. hit_vpriv[Z] is 0 if this was an in-hit. 1 if an out-hit.

Definition in file dsp.c.

Macro Definition Documentation

#define BBOX_PT (   _x,
  _y,
  _z 
)
Value:
VSET(pt, (fastf_t)_x, (fastf_t)_y, (fastf_t)_z); \
MAT4X3PNT(bbpt, dsp_ip->dsp_stom, pt); \
VMINMAX((*min), (*max), bbpt)
#define VSET(a, b, c, d)
Definition: color.c:53
double fastf_t
Definition: defines.h:300

Referenced by rt_dsp_bbox(), and rt_dsp_prep().

#define BBOX_PT (   _x,
  _y,
  _z 
)
Value:
VSET(pt, (fastf_t)_x, (fastf_t)_y, (fastf_t)_z); \
MAT4X3PNT(bbpt, dsp_ip->dsp_stom, pt); \
VMINMAX(stp->st_min, stp->st_max, bbpt)
#define VSET(a, b, c, d)
Definition: color.c:53
double fastf_t
Definition: defines.h:300
#define SMOOTHSTEP (   x)    ((x)*(x)*(3 - 2*(x)))

Referenced by rt_dsp_norm().

#define MOVE (   _pt)
Value:
MAT4X3PNT(m_pt, dsp_ip->dsp_stom, _pt); \
#define RT_ADD_VLIST(hd, pnt, draw)
Definition: raytrace.h:1865
#define BN_VLIST_LINE_MOVE
Definition: vlist.h:82

Referenced by KeyHandler::handle(), and rt_dsp_plot().

#define DRAW (   _pt)
Value:
MAT4X3PNT(m_pt, dsp_ip->dsp_stom, _pt); \
#define RT_ADD_VLIST(hd, pnt, draw)
Definition: raytrace.h:1865
#define BN_VLIST_LINE_DRAW
Definition: vlist.h:83

Referenced by rt_dsp_plot().