BRL-CAD
wdb.c File Reference
#include "common.h"
#include <math.h>
#include <string.h>
#include "bio.h"
#include "vmath.h"
#include "bn.h"
#include "rtgeom.h"
#include "raytrace.h"
#include "wdb.h"
Include dependency graph for wdb.c:

Go to the source code of this file.

Functions

int mk_half (struct rt_wdb *wdbp, const char *name, const fastf_t *norm, fastf_t d)
 
int mk_grip (struct rt_wdb *wdbp, const char *name, const point_t center, const vect_t normal, const fastf_t magnitude)
 
int mk_rpp (struct rt_wdb *wdbp, const char *name, const fastf_t *min, const fastf_t *max)
 
int mk_wedge (struct rt_wdb *wdbp, const char *name, const fastf_t *vert, const fastf_t *xdirv, const fastf_t *zdirv, fastf_t xlen, fastf_t ylen, fastf_t zlen, fastf_t x_top_len)
 
int mk_arb4 (struct rt_wdb *wdbp, const char *name, const fastf_t *pts)
 
int mk_arb5 (struct rt_wdb *wdbp, const char *name, const fastf_t *pts)
 
int mk_arb6 (struct rt_wdb *wdbp, const char *name, const fastf_t *pts)
 
int mk_arb7 (struct rt_wdb *wdbp, const char *name, const fastf_t *pts)
 
int mk_arb8 (struct rt_wdb *wdbp, const char *name, const fastf_t *pts)
 
int mk_sph (struct rt_wdb *wdbp, const char *name, const fastf_t *center, fastf_t radius)
 
int mk_ell (struct rt_wdb *wdbp, const char *name, const fastf_t *center, const fastf_t *a, const fastf_t *b, const fastf_t *c)
 
int mk_hyp (struct rt_wdb *wdbp, const char *name, const point_t vertex, const vect_t height_vector, const vect_t vectA, fastf_t magB, fastf_t base_neck_ratio)
 
int mk_tor (struct rt_wdb *wdbp, const char *name, const fastf_t *center, const fastf_t *inorm, double r1, double r2)
 
int mk_rcc (struct rt_wdb *wdbp, const char *name, const fastf_t *base, const fastf_t *height, fastf_t radius)
 
int mk_tgc (struct rt_wdb *wdbp, const char *name, const fastf_t *base, const fastf_t *height, const fastf_t *a, const fastf_t *b, const fastf_t *c, const fastf_t *d)
 
int mk_cone (struct rt_wdb *wdbp, const char *name, const fastf_t *base, const fastf_t *dirv, fastf_t height, fastf_t rad1, fastf_t rad2)
 
int mk_trc_h (struct rt_wdb *wdbp, const char *name, const fastf_t *base, const fastf_t *height, fastf_t radbase, fastf_t radtop)
 
int mk_trc_top (struct rt_wdb *wdbp, const char *name, const fastf_t *ibase, const fastf_t *itop, fastf_t radbase, fastf_t radtop)
 
int mk_rpc (struct rt_wdb *wdbp, const char *name, const point_t vert, const vect_t height, const vect_t breadth, double half_w)
 
int mk_rhc (struct rt_wdb *wdbp, const char *name, const point_t vert, const vect_t height, const vect_t breadth, fastf_t half_w, fastf_t asymp)
 
int mk_epa (struct rt_wdb *wdbp, const char *name, const point_t vert, const vect_t height, const vect_t breadth, fastf_t r1, fastf_t r2)
 
int mk_ehy (struct rt_wdb *wdbp, const char *name, const point_t vert, const vect_t height, const vect_t breadth, fastf_t r1, fastf_t r2, fastf_t c)
 
int mk_hrt (struct rt_wdb *wdbp, const char *name, const point_t center, const vect_t x, const vect_t y, const vect_t z, const fastf_t dist)
 
int mk_eto (struct rt_wdb *wdbp, const char *name, const point_t vert, const vect_t norm, const vect_t smajor, fastf_t rrot, fastf_t sminor)
 
int mk_metaball (struct rt_wdb *wdbp, const char *name, const size_t nctlpt, const int method, const fastf_t threshold, const fastf_t *verts[5])
 
int mk_binunif (struct rt_wdb *wdbp, const char *name, const void *data, wdb_binunif data_type, long count)
 

Detailed Description

Library for writing MGED databases from arbitrary procedures. Assumes that some of the structure of such databases are known by the calling routines.

It is expected that this library will grow as experience is gained. Routines for writing every permissible solid do not yet exist.

Note that routines which are passed point_t or vect_t or mat_t parameters (which are call-by-address) must be VERY careful to leave those parameters unmodified (e.g., by scaling), so that the calling routine is not surprised.

Return codes of 0 are OK, -1 signal an error.

Definition in file wdb.c.

Function Documentation

int mk_half ( struct rt_wdb wdbp,
const char *  name,
const fastf_t norm,
fastf_t  d 
)

Definition at line 53 of file wdb.c.

References BU_ALLOC, ID_HALF, mk_conv2mm, RT_HALF_INTERNAL_MAGIC, and wdb_export().

Here is the call graph for this function:

int mk_rpp ( struct rt_wdb wdbp,
const char *  name,
const fastf_t min,
const fastf_t max 
)

Definition at line 87 of file wdb.c.

References mk_arb8(), VSET, X, Y, and Z.

Here is the call graph for this function:

int mk_wedge ( struct rt_wdb wdbp,
const char *  name,
const fastf_t vert,
const fastf_t xdirv,
const fastf_t zdirv,
fastf_t  xlen,
fastf_t  ylen,
fastf_t  zlen,
fastf_t  x_top_len 
)

Definition at line 106 of file wdb.c.

References mk_arb8(), and X.

Here is the call graph for this function:

int mk_sph ( struct rt_wdb wdbp,
const char *  name,
const fastf_t center,
fastf_t  radius 
)

Definition at line 252 of file wdb.c.

References BU_ALLOC, ID_ELL, mk_conv2mm, RT_ELL_INTERNAL_MAGIC, VSET, and wdb_export().

Here is the call graph for this function:

int mk_ell ( struct rt_wdb wdbp,
const char *  name,
const fastf_t center,
const fastf_t a,
const fastf_t b,
const fastf_t c 
)

Definition at line 268 of file wdb.c.

References BU_ALLOC, ID_ELL, mk_conv2mm, RT_ELL_INTERNAL_MAGIC, and wdb_export().

Here is the call graph for this function:

int mk_tor ( struct rt_wdb wdbp,
const char *  name,
const fastf_t center,
const fastf_t inorm,
double  r1,
double  r2 
)

Definition at line 334 of file wdb.c.

References BU_ALLOC, ID_TOR, mk_conv2mm, RT_TOR_INTERNAL_MAGIC, and wdb_export().

Here is the call graph for this function:

int mk_rcc ( struct rt_wdb wdbp,
const char *  name,
const fastf_t base,
const fastf_t height,
fastf_t  radius 
)

Definition at line 350 of file wdb.c.

References bn_vec_ortho(), mk_tgc(), and SQRT_SMALL_FASTF.

Here is the call graph for this function:

int mk_tgc ( struct rt_wdb wdbp,
const char *  name,
const fastf_t base,
const fastf_t height,
const fastf_t a,
const fastf_t b,
const fastf_t c,
const fastf_t d 
)

Definition at line 371 of file wdb.c.

References BU_ALLOC, ID_TGC, mk_conv2mm, RT_TGC_INTERNAL_MAGIC, and wdb_export().

Referenced by mk_cone(), mk_rcc(), and mk_trc_h().

Here is the call graph for this function:

int mk_cone ( struct rt_wdb wdbp,
const char *  name,
const fastf_t base,
const fastf_t dirv,
fastf_t  height,
fastf_t  rad1,
fastf_t  rad2 
)

Definition at line 389 of file wdb.c.

References bn_vec_ortho(), mk_tgc(), and SQRT_SMALL_FASTF.

Here is the call graph for this function:

int mk_trc_h ( struct rt_wdb wdbp,
const char *  name,
const fastf_t base,
const fastf_t height,
fastf_t  radbase,
fastf_t  radtop 
)

Definition at line 420 of file wdb.c.

References bn_vec_ortho(), mk_tgc(), and SQRT_SMALL_FASTF.

Referenced by mk_trc_top().

Here is the call graph for this function:

int mk_trc_top ( struct rt_wdb wdbp,
const char *  name,
const fastf_t ibase,
const fastf_t itop,
fastf_t  radbase,
fastf_t  radtop 
)

Definition at line 444 of file wdb.c.

References mk_trc_h().

Here is the call graph for this function: