BRL-CAD
Collaboration diagram for WriteDatabase:

Files

file  wdb.c
 
file  wdb.h
 

Data Structures

struct  wmember
 

Macros

#define WMEMBER_INIT_ZERO   { BU_LIST_INIT_ZERO, 0, MAT_INIT_IDN, NULL }
 
#define WMEMBER_INIT(x)   { BU_LIST_INIT(&((x)->l)); (x)->wm_op = 0; MAT_IDN((x)->wm_mat); (x)->wm_name = NULL; }
 
#define WMEMBER_NULL   ((struct wmember *)0)
 
#define WDB_CK_WMEMBER(_p)   BU_CKMAG(_p, WMEMBER_MAGIC, "wmember" );
 
#define mk_lcomb(_fp, _name, _headp, _rf, _shadername, _shaderargs, _rgb, _inh)
 
#define mk_lrcomb(fp, name, _headp, region_flag, shadername, shaderargs, rgb, id, air, material, los, inherit_flag)
 
#define WMOP_INTERSECT   DB_OP_INTERSECT
 
#define WMOP_SUBTRACT   DB_OP_SUBTRACT
 
#define WMOP_UNION   DB_OP_UNION
 
#define mk_lfcomb(fp, name, headp, region)
 
#define mk_export_fwrite(wdbp, name, gp, id)   wdb_export(wdbp, name, gp, id, mk_conv2mm)
 

Enumerations

enum  wdb_binunif {
  WDB_BINUNIF_FLOAT, WDB_BINUNIF_DOUBLE, WDB_BINUNIF_CHAR, WDB_BINUNIF_UCHAR,
  WDB_BINUNIF_SHORT, WDB_BINUNIF_USHORT, WDB_BINUNIF_INT, WDB_BINUNIF_UINT,
  WDB_BINUNIF_LONG, WDB_BINUNIF_ULONG, WDB_BINUNIF_LONGLONG, WDB_BINUNIF_ULONGLONG,
  WDB_BINUNIF_INT8, WDB_BINUNIF_UINT8, WDB_BINUNIF_INT16, WDB_BINUNIF_UINT16,
  WDB_BINUNIF_INT32, WDB_BINUNIF_UINT32, WDB_BINUNIF_INT64, WDB_BINUNIF_UINT64,
  WDB_BINUNIF_FILE_FLOAT, WDB_BINUNIF_FILE_DOUBLE, WDB_BINUNIF_FILE_CHAR, WDB_BINUNIF_FILE_UCHAR,
  WDB_BINUNIF_FILE_SHORT, WDB_BINUNIF_FILE_USHORT, WDB_BINUNIF_FILE_INT, WDB_BINUNIF_FILE_UINT,
  WDB_BINUNIF_FILE_LONG, WDB_BINUNIF_FILE_ULONG, WDB_BINUNIF_FILE_LONGLONG, WDB_BINUNIF_FILE_ULONGLONG,
  WDB_BINUNIF_FILE_INT8, WDB_BINUNIF_FILE_UINT8, WDB_BINUNIF_FILE_INT16, WDB_BINUNIF_FILE_UINT16,
  WDB_BINUNIF_FILE_INT32, WDB_BINUNIF_FILE_UINT32, WDB_BINUNIF_FILE_INT64, WDB_BINUNIF_FILE_UINT64
}
 

Functions

struct rt_wdbwdb_fopen (const char *filename)
 
struct rt_wdbwdb_fopen_v (const char *filename, int version)
 
struct rt_wdbwdb_dbopen (struct db_i *dbip, int mode)
 
int wdb_import (struct rt_wdb *wdbp, struct rt_db_internal *internp, const char *name, const mat_t mat)
 
int wdb_export_external (struct rt_wdb *wdbp, struct bu_external *ep, const char *name, int flags, unsigned char minor_type)
 
int wdb_put_internal (struct rt_wdb *wdbp, const char *name, struct rt_db_internal *ip, double local2mm)
 
int wdb_export (struct rt_wdb *wdbp, const char *name, void *gp, int id, double local2mm)
 
void wdb_init (struct rt_wdb *wdbp, struct db_i *dbip, int mode)
 
void wdb_close (struct rt_wdb *wdbp)
 
int wdb_import_from_path (struct bu_vls *logstr, struct rt_db_internal *ip, const char *path, struct rt_wdb *wdb)
 
int wdb_import_from_path2 (struct bu_vls *logstr, struct rt_db_internal *ip, const char *path, struct rt_wdb *wdb, matp_t matp)
 
int mk_id (struct rt_wdb *fp, const char *title)
 
int mk_id_units (struct rt_wdb *fp, const char *title, const char *units)
 
int mk_id_editunits (struct rt_wdb *fp, const char *title, double local2mm)
 
int mk_half (struct rt_wdb *fp, const char *name, const vect_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 *fp, const char *name, const point_t min, const point_t max)
 
int mk_wedge (struct rt_wdb *fp, const char *name, const point_t vert, const vect_t xdirv, const vect_t zdirv, fastf_t xlen, fastf_t ylen, fastf_t zlen, fastf_t x_top_len)
 
int mk_arb4 (struct rt_wdb *fp, const char *name, const fastf_t *pts4)
 
int mk_arb5 (struct rt_wdb *fp, const char *name, const fastf_t *pts5)
 
int mk_arb6 (struct rt_wdb *fp, const char *name, const fastf_t *pts6)
 
int mk_arb7 (struct rt_wdb *fp, const char *name, const fastf_t *pts7)
 
int mk_arb8 (struct rt_wdb *fp, const char *name, const fastf_t *pts8)
 
int mk_sph (struct rt_wdb *fp, const char *name, const point_t center, fastf_t radius)
 
int mk_ell (struct rt_wdb *fp, const char *name, const point_t center, const vect_t a, const vect_t b, const vect_t c)
 
int mk_tor (struct rt_wdb *fp, const char *name, const point_t center, const vect_t inorm, double r1, double r2)
 
int mk_rcc (struct rt_wdb *fp, const char *name, const point_t base, const vect_t height, fastf_t radius)
 
int mk_tgc (struct rt_wdb *fp, const char *name, const point_t base, const vect_t height, const vect_t a, const vect_t b, const vect_t c, const vect_t d)
 
int mk_cone (struct rt_wdb *fp, const char *name, const point_t base, const vect_t dirv, fastf_t height, fastf_t rad1, fastf_t rad2)
 
int mk_trc_h (struct rt_wdb *fp, const char *name, const point_t base, const vect_t height, fastf_t radbase, fastf_t radtop)
 
int mk_trc_top (struct rt_wdb *fp, const char *name, const point_t ibase, const point_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_hyp (struct rt_wdb *wdbp, const char *name, const point_t vert, const vect_t height_vector, const vect_t vectA, fastf_t magB, fastf_t base_neck_ratio)
 
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_arbn (struct rt_wdb *fp, const char *name, size_t neqn, const plane_t *eqn)
 
int mk_ars (struct rt_wdb *fp, const char *name, size_t ncurves, size_t pts_per_curve, fastf_t *curves[])
 
int mk_constraint (struct rt_wdb *wdbp, const char *name, const char *expr)
 
int mk_binunif (struct rt_wdb *fp, const char *name, const void *data, wdb_binunif data_type, long count)
 
int mk_bot (struct rt_wdb *fp, const char *name, unsigned char mode, unsigned char orientation, unsigned char error_mode, size_t num_vertices, size_t num_faces, fastf_t *vertices, int *faces, fastf_t *thickness, struct bu_bitv *face_mode)
 
int mk_bot_w_normals (struct rt_wdb *fp, const char *name, unsigned char mode, unsigned char orientation, unsigned char flags, size_t num_vertices, size_t num_faces, const fastf_t *vertices, const int *faces, const fastf_t *thickness, struct bu_bitv *face_mode, size_t num_normals, fastf_t *normals, int *face_normals)
 
int mk_brep (struct rt_wdb *wdbp, const char *name, ON_Brep *brep)
 
int mk_bspline (struct rt_wdb *wdbp, const char *name, struct face_g_snurb **surfs)
 
int mk_nmg (struct rt_wdb *filep, const char *name, struct model *m)
 
int mk_bot_from_nmg (struct rt_wdb *ofp, const char *name, struct shell *s)
 
int mk_sketch (struct rt_wdb *fp, const char *name, const struct rt_sketch_internal *skt)
 
int mk_extrusion (struct rt_wdb *fp, const char *name, const char *sketch_name, const point_t V, const vect_t h, const vect_t u_vec, const vect_t v_vec, int keypoint)
 
int mk_cline (struct rt_wdb *fp, const char *name, const point_t V, const vect_t height, fastf_t radius, fastf_t thickness)
 
int mk_particle (struct rt_wdb *fp, const char *name, point_t vertex, vect_t height, double vradius, double hradius)
 
int mk_pipe (struct rt_wdb *fp, const char *name, struct bu_list *headp)
 
void mk_pipe_free (struct bu_list *headp)
 
void mk_add_pipe_pt (struct bu_list *headp, const point_t coord, double od, double id, double bendradius)
 
void mk_pipe_init (struct bu_list *headp)
 
int mk_dsp (struct rt_wdb *fp, const char *name, const char *file, size_t xdim, size_t ydim, const matp_t mat)
 
int mk_ebm (struct rt_wdb *fp, const char *name, const char *file, size_t xdim, size_t ydim, fastf_t tallness, const matp_t mat)
 
int mk_hrt (struct rt_wdb *fp, 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_vol (struct rt_wdb *fp, const char *name, const char *file, size_t xdim, size_t ydim, size_t zdim, size_t lo, size_t hi, const vect_t cellsize, const matp_t mat)
 
int mk_submodel (struct rt_wdb *fp, const char *name, const char *file, const char *treetop, int meth)
 
int mk_write_color_table (struct rt_wdb *ofp)
 
struct wmembermk_addmember (const char *name, struct bu_list *headp, mat_t mat, int op)
 
int mk_comb (struct rt_wdb *wdbp, const char *combname, struct bu_list *headp, int region_kind, const char *shadername, const char *shaderargs, const unsigned char *rgb, int id, int air, int material, int los, int inherit, int append_ok, int gift_semantics)
 
int mk_comb1 (struct rt_wdb *fp, const char *combname, const char *membname, int regflag)
 
int mk_region1 (struct rt_wdb *fp, const char *combname, const char *membname, const char *shadername, const char *shaderargs, const unsigned char *rgb)
 
int mk_conversion (char *units_string)
 
int mk_set_conversion (double val)
 
void mk_freemembers (struct bu_list *headp)
 
int make_hole (struct rt_wdb *wdbp, point_t hole_start, vect_t hole_depth, fastf_t hole_radius, int num_objs, struct directory **dp)
 
int make_hole_in_prepped_regions (struct rt_wdb *wdbp, struct rt_i *rtip, point_t hole_start, vect_t hole_depth, fastf_t radius, struct bu_ptbl *regions)
 

Variables

double mk_conv2mm
 Conversion factor to mm. More...
 
int mk_version
 Which version database to write. More...
 

Detailed Description

Macro Definition Documentation

#define WMEMBER_INIT_ZERO   { BU_LIST_INIT_ZERO, 0, MAT_INIT_IDN, NULL }

Definition at line 71 of file wdb.h.

#define WMEMBER_INIT (   x)    { BU_LIST_INIT(&((x)->l)); (x)->wm_op = 0; MAT_IDN((x)->wm_mat); (x)->wm_name = NULL; }

Definition at line 72 of file wdb.h.

#define WMEMBER_NULL   ((struct wmember *)0)

Definition at line 73 of file wdb.h.

Referenced by mk_addmember(), mk_comb1(), and mk_region1().

#define WDB_CK_WMEMBER (   _p)    BU_CKMAG(_p, WMEMBER_MAGIC, "wmember" );

Definition at line 74 of file wdb.h.

Referenced by mk_freemembers(), mk_tree_gift(), and mk_tree_pure().

#define mk_lcomb (   _fp,
  _name,
  _headp,
  _rf,
  _shadername,
  _shaderargs,
  _rgb,
  _inh 
)
Value:
mk_comb(_fp, _name, &((_headp)->l), _rf, _shadername, _shaderargs, \
_rgb, 0, 0, 0, 0, _inh, 0, 0)
int mk_comb(struct rt_wdb *wdbp, const char *combname, struct bu_list *headp, int region_kind, const char *shadername, const char *shaderargs, const unsigned char *rgb, int id, int air, int material, int los, int inherit, int append_ok, int gift_semantics)
Definition: reg.c:230

Definition at line 820 of file wdb.h.

Referenced by gcv_stl_read(), ged_human(), ged_tire(), and make_coil().

#define mk_lrcomb (   fp,
  name,
  _headp,
  region_flag,
  shadername,
  shaderargs,
  rgb,
  id,
  air,
  material,
  los,
  inherit_flag 
)
Value:
mk_comb( fp, name, &((_headp)->l), region_flag, shadername, shaderargs, \
rgb, id, air, material, los, inherit_flag, 0, 0 )
Definition: clone.c:90
int mk_comb(struct rt_wdb *wdbp, const char *combname, struct bu_list *headp, int region_kind, const char *shadername, const char *shaderargs, const unsigned char *rgb, int id, int air, int material, int los, int inherit, int append_ok, int gift_semantics)
Definition: reg.c:230

Definition at line 826 of file wdb.h.

#define WMOP_INTERSECT   DB_OP_INTERSECT

Definition at line 885 of file wdb.h.

Referenced by ged_track2(), mk_addmember(), mk_tree_gift(), and mk_tree_pure().

#define WMOP_SUBTRACT   DB_OP_SUBTRACT

Definition at line 886 of file wdb.h.

Referenced by ged_human(), ged_track2(), make_coil(), mk_addmember(), mk_tree_gift(), and mk_tree_pure().

#define mk_lfcomb (   fp,
  name,
  headp,
  region 
)
Value:
mk_lcomb( fp, name, headp, \
region, (char *)0, (char *)0, (unsigned char *)0, 0 );
Definition: clone.c:90
#define mk_lcomb(_fp, _name, _headp, _rf, _shadername, _shaderargs, _rgb, _inh)
Definition: wdb.h:820

Definition at line 890 of file wdb.h.

#define mk_export_fwrite (   wdbp,
  name,
  gp,
  id 
)    wdb_export(wdbp, name, gp, id, mk_conv2mm)

Definition at line 937 of file wdb.h.

Enumeration Type Documentation

Enumerator
WDB_BINUNIF_FLOAT 
WDB_BINUNIF_DOUBLE 
WDB_BINUNIF_CHAR 
WDB_BINUNIF_UCHAR 
WDB_BINUNIF_SHORT 
WDB_BINUNIF_USHORT 
WDB_BINUNIF_INT 
WDB_BINUNIF_UINT 
WDB_BINUNIF_LONG 
WDB_BINUNIF_ULONG 
WDB_BINUNIF_LONGLONG 
WDB_BINUNIF_ULONGLONG 
WDB_BINUNIF_INT8 
WDB_BINUNIF_UINT8 
WDB_BINUNIF_INT16 
WDB_BINUNIF_UINT16 
WDB_BINUNIF_INT32 
WDB_BINUNIF_UINT32 
WDB_BINUNIF_INT64 
WDB_BINUNIF_UINT64 
WDB_BINUNIF_FILE_FLOAT 
WDB_BINUNIF_FILE_DOUBLE 
WDB_BINUNIF_FILE_CHAR 
WDB_BINUNIF_FILE_UCHAR 
WDB_BINUNIF_FILE_SHORT 
WDB_BINUNIF_FILE_USHORT 
WDB_BINUNIF_FILE_INT 
WDB_BINUNIF_FILE_UINT 
WDB_BINUNIF_FILE_LONG 
WDB_BINUNIF_FILE_ULONG 
WDB_BINUNIF_FILE_LONGLONG 
WDB_BINUNIF_FILE_ULONGLONG 
WDB_BINUNIF_FILE_INT8 
WDB_BINUNIF_FILE_UINT8 
WDB_BINUNIF_FILE_INT16 
WDB_BINUNIF_FILE_UINT16 
WDB_BINUNIF_FILE_INT32 
WDB_BINUNIF_FILE_UINT32 
WDB_BINUNIF_FILE_INT64 
WDB_BINUNIF_FILE_UINT64 

Definition at line 412 of file wdb.h.

Function Documentation

struct rt_wdb* wdb_fopen ( const char *  filename)

Definition at line 56 of file wdb.c.

References RT_WDB_NULL, and wdb_fopen_v().

Referenced by gcv_brlcad_write(), ged_dump(), ged_open(), and nmg_stash_model_to_file().

Here is the call graph for this function:

struct rt_wdb* wdb_fopen_v ( const char *  filename,
int  version 
)

Create a libwdb output stream destined for a disk file. This will destroy any existing file by this name, and start fresh. The file is then opened in the normal "update" mode and an in-memory directory is built along the way, allowing retrievals and object replacements as needed.

Users can change the database title by calling: ???

Definition at line 38 of file wdb.c.

References db_create(), DBI_NULL, resource::re_magic, RESOURCE_MAGIC, rt_init_resource(), rt_uniresource, RT_WDB_NULL, RT_WDB_TYPE_DB_DISK, and wdb_dbopen().

Referenced by ged_keep(), and wdb_fopen().

Here is the call graph for this function:

struct rt_wdb* wdb_dbopen ( struct db_i dbip,
int  mode 
)

Create a libwdb output stream destined for an existing BRL-CAD database, already opened via a db_open() call.

RT_WDB_TYPE_DB_DISK Add to on-disk database RT_WDB_TYPE_DB_DISK_APPEND_ONLY Add to on-disk database, don't clobber existing names, use prefix RT_WDB_TYPE_DB_INMEM Add to in-memory database only RT_WDB_TYPE_DB_INMEM_APPEND_ONLY Ditto, but give errors if name in use.

Definition at line 64 of file wdb.c.

References BU_ALLOC, bu_log(), db_i::dbi_filename, resource::re_magic, RESOURCE_MAGIC, RT_CK_DBI, rt_init_resource(), rt_uniresource, RT_WDB_NULL, RT_WDB_TYPE_DB_DISK, RT_WDB_TYPE_DB_DISK_APPEND_ONLY, RT_WDB_TYPE_DB_INMEM, RT_WDB_TYPE_DB_INMEM_APPEND_ONLY, and wdb_init().

Referenced by db_open_inmem(), ged_keep(), ged_open(), main(), and wdb_fopen_v().

Here is the call graph for this function:

int wdb_import ( struct rt_wdb wdbp,
struct rt_db_internal internp,
const char *  name,
const mat_t  mat 
)

Returns - 0 and modified *internp; -1 ft_import failure (from rt_db_get_internal) -2 db_get_external failure (from rt_db_get_internal) -3 Attempt to import from write-only (stream) file. -4 Name not found in database TOC.

NON-PARALLEL because of rt_uniresource

Definition at line 92 of file wdb.c.

References db_lookup(), rt_wdb::dbip, LOOKUP_QUIET, rt_db_get_internal(), RT_DIR_NULL, and rt_uniresource.

Referenced by mk_comb(), rt_tcl_import_from_path(), and wdb_import_from_path2().

Here is the call graph for this function:

int wdb_export_external ( struct rt_wdb wdbp,
struct bu_external ep,
const char *  name,
int  flags,
unsigned char  minor_type 
)
int wdb_put_internal ( struct rt_wdb wdbp,
const char *  name,
struct rt_db_internal ip,
double  local2mm 
)

Convert the internal representation of a solid to the external one, and write it into the database.

The internal representation is always freed. This is the analog of rt_db_put_internal() for rt_wdb objects.

Use this routine in preference to wdb_export() whenever the caller already has an rt_db_internal structure handy.

NON-PARALLEL because of rt_uniresource

Returns - 0 OK <0 error

Definition at line 218 of file wdb.c.

References BU_CK_EXTERNAL, BU_EXTERNAL_INIT, bu_free_external(), bu_log(), db_flags_internal(), db_version(), db_wrap_v4_external(), rt_wdb::dbip, rt_functab::ft_export4, rt_db_internal::idb_major_type, rt_db_internal::idb_meth, out, RT_CK_DB_INTERNAL, RT_CK_WDB, rt_db_cvt_to_external5(), rt_db_free_internal(), rt_uniresource, and wdb_export_external().

Referenced by comb_tree_clear(), ged_adjust(), ged_bot_decimate(), ged_put(), make_hole(), mk_comb(), mk_constraint(), node_write(), and wdb_export().

Here is the call graph for this function:

int wdb_export ( struct rt_wdb wdbp,
const char *  name,
void *  gp,
int  id,
double  local2mm 
)

Export an in-memory representation of an object, as described in the file h/rtgeom.h, into the indicated database.

The internal representation (gp) is always freed.

WARNING: The caller must be careful not to double-free gp, particularly if it's been extracted from an rt_db_internal, e.g. by passing intern.idb_ptr for gp.

If the caller has an rt_db_internal structure handy already, they should call wdb_put_internal() directly – this is a convenience routine intended primarily for internal use in LIBWDB.

Returns - 0 OK <0 error

Definition at line 265 of file wdb.c.

References bu_log(), ID_COMBINATION, ID_MAX_SOLID, rt_db_internal::idb_major_type, rt_db_internal::idb_meth, rt_db_internal::idb_ptr, OBJ, RT_CK_WDB, RT_DB_INTERNAL_INIT, and wdb_put_internal().

Referenced by brep_conversion_comb(), brep_conversion_tree(), mk_arb8(), mk_arbn(), mk_ars(), mk_binunif(), mk_bot_from_nmg(), mk_bot_w_normals(), mk_brep(), mk_bspline(), mk_cline(), mk_dsp(), mk_ebm(), mk_ehy(), mk_ell(), mk_epa(), mk_eto(), mk_extrusion(), mk_grip(), mk_half(), mk_hrt(), mk_hyp(), mk_metaball(), mk_nmg(), mk_particle(), mk_pipe(), mk_rhc(), mk_rpc(), mk_sketch(), mk_sph(), mk_submodel(), mk_tgc(), mk_tor(), and mk_vol().

Here is the call graph for this function:

void wdb_close ( struct rt_wdb wdbp)

Release from associated database "file", destroy dynamic data structure.

Definition at line 333 of file wdb.c.

References bu_free(), BU_LIST_DEQUEUE, BU_LIST_MAGIC_SET, bu_vls_free(), db_close(), rt_wdb::dbip, rt_wdb::l, RT_CK_WDB, rt_wdb::type, rt_wdb::wdb_interp, rt_wdb::wdb_name, rt_wdb::wdb_prestr, and rt_wdb::wdb_resp.

Referenced by gcv_brlcad_write(), ged_close(), ged_dump(), ged_keep(), main(), and nmg_stash_model_to_file().

Here is the call graph for this function:

int wdb_import_from_path ( struct bu_vls logstr,
struct rt_db_internal ip,
const char *  path,
struct rt_wdb wdb 
)

Given the name of a database object or a full path to a leaf object, obtain the internal form of that leaf. Packaged separately mainly to make available nice Tcl error handling.

Returns - BRLCAD_OK BRLCAD_ERROR

Definition at line 431 of file wdb.c.

References wdb_import_from_path2().

Referenced by ged_get(), ged_get_type(), and ged_import_polygon().

Here is the call graph for this function:

int wdb_import_from_path2 ( struct bu_vls logstr,
struct rt_db_internal ip,
const char *  path,
struct rt_wdb wdb,
matp_t  matp 
)

Given the name of a database object or a full path to a leaf object, obtain the internal form of that leaf. Packaged separately mainly to make available nice Tcl error handling. Additionally, copies ts.ts_mat to matp.

Returns - BRLCAD_OK BRLCAD_ERROR

Definition at line 364 of file wdb.c.

References BRLCAD_ERROR, BRLCAD_OK, bu_vls_printf(), directory::d_namep, db_follow_path(), db_free_full_path(), DB_FULL_PATH_CUR_DIR, db_full_path_init(), db_init_db_tree_state(), db_string_to_path(), rt_wdb::dbip, LOOKUP_NOISY, RT_CK_DBI, RT_CK_WDB, rt_uniresource, strchr(), db_tree_state::ts_mat, and wdb_import().

Referenced by _ged_append_pipept_common(), ged_add_metaballpt(), ged_bot_edge_split(), ged_bot_face_split(), ged_find_arb_edge_nearest_pt(), ged_find_bot_edge_nearest_pt(), ged_find_botpt_nearest_pt(), ged_find_metaballpt_nearest_pt(), ged_find_pipept_nearest_pt(), ged_get_bot_edges(), ged_move_arb_edge(), ged_move_arb_face(), ged_move_botpt(), ged_move_botpts(), ged_move_metaballpt(), ged_move_pipept(), ged_rotate_arb_face(), ged_rselect(), ged_select(), to_mouse_move_botpt(), and wdb_import_from_path().

Here is the call graph for this function:

int mk_id ( struct rt_wdb fp,
const char *  title 
)

Make a database header (ID) record.

Definition at line 43 of file id.c.

References mk_id_editunits().

Referenced by ged_tire().

Here is the call graph for this function:

int mk_id_units ( struct rt_wdb fp,
const char *  title,
const char *  units 
)

Make a database header (ID) record, and note the user's preferred editing units (specified as a string).

Returns - <0 error 0 success

Definition at line 50 of file id.c.

References bu_units_conversion(), and mk_id_editunits().

Referenced by gcv_fastgen4_read(), and ged_human().

Here is the call graph for this function:

int mk_id_editunits ( struct rt_wdb fp,
const char *  title,
double  local2mm 
)

Make a database header (ID) record, and note the user's preferred editing units (specified as a conversion factor).

Note that the v4 database format offers only a limited number of choices for the preferred editing units. If the user is editing in unusual units (like 2.5feet), don't fail to create the database header.

In the v5 database, the conversion factor will be stored intact.

Note that the database-layer header record will have already been written by db_create(). All we have to do here is update it.

Returns - <0 error 0 success

Definition at line 57 of file id.c.

References db_update_ident(), rt_wdb::dbip, and RT_CK_WDB.

Referenced by mk_id(), and mk_id_units().

Here is the call graph for this function:

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

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.

Make a halfspace. Specified by distance from origin, and outward pointing normal vector.

int mk_grip ( struct rt_wdb wdbp,
const char *  name,
const point_t  center,
const vect_t  normal,
const fastf_t  magnitude 
)

Make a grip pseudo solid. Specified by a center, normal vector, and magnitude.

Definition at line 67 of file wdb.c.

References BU_ALLOC, ID_GRIP, mk_conv2mm, RT_GRIP_INTERNAL_MAGIC, and wdb_export().

Here is the call graph for this function:

int mk_rpp ( struct rt_wdb fp,
const char *  name,
const point_t  min,
const point_t  max 
)

Make a right parallelepiped. Specified by minXYZ, maxXYZ.

Referenced by create_boxes().

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

Makes a right angular wedge given a starting vertex located in the, lower left corner, an x and a z direction vector, x, y, and z lengths, and an x length for the top. The y direction vector is x cross z.

int mk_arb4 ( struct rt_wdb fp,
const char *  name,
const fastf_t pts4 
)

Definition at line 150 of file wdb.c.

References mk_arb8(), and X.

Here is the call graph for this function:

int mk_arb5 ( struct rt_wdb fp,
const char *  name,
const fastf_t pts5 
)

Definition at line 172 of file wdb.c.

References mk_arb8(), and X.

Here is the call graph for this function:

int mk_arb6 ( struct rt_wdb fp,
const char *  name,
const fastf_t pts6 
)

Definition at line 193 of file wdb.c.

References mk_arb8(), and X.

Here is the call graph for this function:

int mk_arb7 ( struct rt_wdb fp,
const char *  name,
const fastf_t pts7 
)

Definition at line 213 of file wdb.c.

References mk_arb8(), and X.

Here is the call graph for this function:

int mk_arb8 ( struct rt_wdb fp,
const char *  name,
const fastf_t pts8 
)

All plates with 4 points must be co-planar. If there are degeneracies (i.e., all 8 vertices are not distinct), then certain requirements must be met. If we think of the ARB8 as having a top and a bottom plate, the first four points listed must lie on one plate, and the second four points listed must lie on the other plate.

Definition at line 233 of file wdb.c.

References BU_ALLOC, ID_ARB8, mk_conv2mm, RT_ARB_INTERNAL_MAGIC, and wdb_export().

Referenced by boundingBox(), boundingRectangle(), mk_arb4(), mk_arb5(), mk_arb6(), mk_arb7(), mk_rpp(), and mk_wedge().

Here is the call graph for this function:

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

Make a sphere with the given center point and radius.

Referenced by makeAnkle(), makeHand(), makeHead(), makeKnee(), makeShoulderJoint(), makeThighJoint(), and makeWrist().

int mk_ell ( struct rt_wdb fp,
const char *  name,
const point_t  center,
const vect_t  a,
const vect_t  b,
const vect_t  c 
)

Make an ellipsoid at the given center point with 3 perp. radius vectors. The eccentricity of the ellipsoid is controlled by the relative lengths of the three radius vectors.

Referenced by makeElbow().

int mk_tor ( struct rt_wdb fp,
const char *  name,
const point_t  center,
const vect_t  inorm,
double  r1,
double  r2 
)

Make a torus. Specify center, normal, r1: distance from center point to center of solid part, r2: radius of solid part.

int mk_rcc ( struct rt_wdb fp,
const char *  name,
const point_t  base,
const vect_t  height,
fastf_t  radius 
)

Make a Right Circular Cylinder (special case of the TGC).

Referenced by cap_ground(), cap_squared_ground(), make_hole(), make_hole_in_prepped_regions(), makeNeck(), and subbrep_to_csg_cylinder().

int mk_tgc ( struct rt_wdb fp,
const char *  name,
const point_t  base,
const vect_t  height,
const vect_t  a,
const vect_t  b,
const vect_t  c,
const vect_t  d 
)

Make a Truncated General Cylinder.

Referenced by makeLowerTorso(), and makeUpperTorso().

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

Makes a right circular cone given the center point of the base circle, a direction vector, a scalar height, and the radii at each end of the cone.

Referenced by subbrep_to_csg_conic().

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

Make a truncated right cylinder, with base and height. Not just called mk_trc() to avoid conflict with a previous routine of that name with different calling sequence.

Referenced by boundingBox(), makeCalf(), makeLowerArm(), makeThigh(), and makeUpperArm().

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

Convenience wrapper for mk_trc_h().

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 
)

Makes a right parabolic cylinder given the origin, or main vertex, a height vector, a breadth vector (B . H must be 0), and a scalar rectangular half-width (for the top of the rpc).

Definition at line 454 of file wdb.c.

References BU_ALLOC, ID_RPC, mk_conv2mm, RT_RPC_INTERNAL_MAGIC, and wdb_export().

Here is the call graph for this function:

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 
)

Makes a right hyperbolic cylinder given the origin, or main vertex, a height vector, a breadth vector (B . H must be 0), a scalar rectangular half-width (for the top of the rpc), and the scalar distance from the tip of the hyperbola to the intersection of the asymptotes.

Definition at line 477 of file wdb.c.

References BU_ALLOC, ID_RHC, mk_conv2mm, RT_RHC_INTERNAL_MAGIC, and wdb_export().

Here is the call graph for this function:

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 
)

Makes an elliptical paraboloid given the origin, a height vector H, a unit vector A along the semi-major axis (A . H must equal 0), and the scalar lengths, r1 and r2, of the semi-major and -minor axes.

Definition at line 502 of file wdb.c.

References BU_ALLOC, ID_EPA, mk_conv2mm, RT_EPA_INTERNAL_MAGIC, and wdb_export().

Here is the call graph for this function:

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 
)

Makes an elliptical hyperboloid given the origin, a height vector H, a unit vector A along the semi-major axis (A . H must equal 0), the scalar lengths, r1 and r2, of the semi-major and -minor axes, and the distance c between the tip of the hyperboloid and the vertex of the asymptotic cone.

Definition at line 527 of file wdb.c.

References BU_ALLOC, ID_EHY, mk_conv2mm, RT_EHY_INTERNAL_MAGIC, and wdb_export().

Here is the call graph for this function:

int mk_hyp ( struct rt_wdb wdbp,
const char *  name,
const point_t  vert,
const vect_t  height_vector,
const vect_t  vectA,
fastf_t  magB,
fastf_t  base_neck_ratio 
)

Make a hyperboloid at the given center point with a vertex, height vector, A vector, magnitude of the B vector, and neck to base ratio.

Definition at line 284 of file wdb.c.

References BU_ALLOC, bu_log(), ID_HYP, mk_conv2mm, NEAR_ZERO, RT_DOT_TOL, RT_HYP_INTERNAL_MAGIC, RT_LEN_TOL, SQRT_SMALL_FASTF, and wdb_export().

Referenced by ged_make().

Here is the call graph for this function:

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 
)

Makes an elliptical torus given the origin, a plane normal vector N, a vector C along the semi-major axis of the elliptical cross-section, the scalar lengths r and rd, of the radius of revolution and length of semi-minor axis of the elliptical cross section.

Definition at line 571 of file wdb.c.

References BU_ALLOC, ID_ETO, mk_conv2mm, RT_ETO_INTERNAL_MAGIC, and wdb_export().

Here is the call graph for this function:

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] 
)

Definition at line 596 of file wdb.c.

References BU_ALLOC, bu_bomb(), BU_LIST_INIT, bu_log(), ID_METABALL, mk_conv2mm, rt_metaball_add_point(), RT_METABALL_INTERNAL_MAGIC, and wdb_export().

Here is the call graph for this function:

int mk_arbn ( struct rt_wdb fp,
const char *  name,
size_t  neqn,
const plane_t *  eqn 
)

Caller is responsible for freeing eqn[]

Returns: <0 ERROR 0 OK

Definition at line 40 of file arbn.c.

References BU_ALLOC, bu_malloc(), ID_ARBN, mk_conv2mm, RT_ARBN_INTERNAL_MAGIC, and wdb_export().

Here is the call graph for this function:

int mk_ars ( struct rt_wdb fp,
const char *  name,
size_t  ncurves,
size_t  pts_per_curve,
fastf_t curves[] 
)
int mk_constraint ( struct rt_wdb wdbp,
const char *  name,
const char *  expr 
)

Given the appropriate parameters, makes the non-geometric constraint object and writes it to the database using wdb_put_internal. Only supported on database version 5 or above

Definition at line 37 of file constraint.c.

References BU_ALLOC, BU_VLS_INIT, rt_constraint_internal::expression, rt_constraint_internal::id, ID_CONSTRAINT, rt_db_internal::idb_major_type, rt_db_internal::idb_meth, rt_db_internal::idb_ptr, rt_constraint_internal::magic, mk_conv2mm, OBJ, RT_CK_WDB, RT_CONSTRAINT_MAGIC, RT_DB_INTERNAL_INIT, rt_constraint_internal::type, and wdb_put_internal().

Here is the call graph for this function:

int mk_binunif ( struct rt_wdb fp,
const char *  name,
const void *  data,
wdb_binunif  data_type,
long  count 
)

Make a uniform binary data object from an array or a data file. Read 'count' values from 'data'. If 'data_type' is a file, 'count' may be used to only read a subset of a file's contents. If 'data' is already an in-memory buffer of memory, 'count' values will be copied (which is count * sizeof(data_type) bytes).

Files can use a non-positive 'count' to mean "read the whole file", pre-loaded data, however, must provide a positive 'count' otherwise an empty binunif will be created.

Definition at line 625 of file wdb.c.

References BU_ALLOC, bu_log(), rt_binunif_internal::count, db5_type_sizeof_h_binu(), ID_BINUNIF, rt_binunif_internal::int8, rt_binunif_internal::magic, mk_conv2mm, RT_BINUNIF_INTERNAL_MAGIC, rt_mk_binunif(), rt_binunif_internal::type, rt_binunif_internal::u, WDB_BINUNIF_CHAR, WDB_BINUNIF_DOUBLE, WDB_BINUNIF_FILE_CHAR, WDB_BINUNIF_FILE_DOUBLE, WDB_BINUNIF_FILE_FLOAT, WDB_BINUNIF_FILE_INT, WDB_BINUNIF_FILE_INT16, WDB_BINUNIF_FILE_INT32, WDB_BINUNIF_FILE_INT64, WDB_BINUNIF_FILE_INT8, WDB_BINUNIF_FILE_LONG, WDB_BINUNIF_FILE_LONGLONG, WDB_BINUNIF_FILE_SHORT, WDB_BINUNIF_FILE_UCHAR, WDB_BINUNIF_FILE_UINT, WDB_BINUNIF_FILE_UINT16, WDB_BINUNIF_FILE_UINT32, WDB_BINUNIF_FILE_UINT64, WDB_BINUNIF_FILE_UINT8, WDB_BINUNIF_FILE_ULONG, WDB_BINUNIF_FILE_ULONGLONG, WDB_BINUNIF_FILE_USHORT, WDB_BINUNIF_FLOAT, WDB_BINUNIF_INT, WDB_BINUNIF_INT16, WDB_BINUNIF_INT32, WDB_BINUNIF_INT64, WDB_BINUNIF_INT8, WDB_BINUNIF_LONG, WDB_BINUNIF_LONGLONG, WDB_BINUNIF_SHORT, WDB_BINUNIF_UCHAR, WDB_BINUNIF_UINT, WDB_BINUNIF_UINT16, WDB_BINUNIF_UINT32, WDB_BINUNIF_UINT64, WDB_BINUNIF_UINT8, WDB_BINUNIF_ULONG, WDB_BINUNIF_ULONGLONG, WDB_BINUNIF_USHORT, and wdb_export().

Here is the call graph for this function:

int mk_bot ( struct rt_wdb fp,
const char *  name,
unsigned char  mode,
unsigned char  orientation,
unsigned char  error_mode,
size_t  num_vertices,
size_t  num_faces,
fastf_t vertices,
int *  faces,
fastf_t thickness,
struct bu_bitv face_mode 
)

Support for BOT solid (Bag O'Triangles)

Parameters
fpdatabase file pointer to write to
namename of bot object to write out
modebot mode
orientationbot orientation
error_modemay be used to indicate error handling (ignored for now)
num_verticesnumber of vertices
num_facesnumber of faces
verticesarray of floats for vertices [num_vertices*3]
facesarray of ints for faces [num_faces*3]
thicknessarray of plate mode thicknesses (corresponds to array of faces) NULL for modes RT_BOT_SURFACE and RT_BOT_SOLID.
face_modea flag for each face indicating thickness is appended to hit point, otherwise thickness is centered about hit point

Definition at line 121 of file bot.c.

References mk_bot_w_normals().

Referenced by ged_bot(), and main().

Here is the call graph for this function:

int mk_bot_w_normals ( struct rt_wdb fp,
const char *  name,
unsigned char  mode,
unsigned char  orientation,
unsigned char  flags,
size_t  num_vertices,
size_t  num_faces,
const fastf_t vertices,
const int *  faces,
const fastf_t thickness,
struct bu_bitv face_mode,
size_t  num_normals,
fastf_t normals,
int *  face_normals 
)
Parameters
fpdatabase file pointer to write to
namename of bot object to write out
modebot mode
orientationbot orientation
flagsadditional bot flags
num_verticesnumber of bot vertices
num_facesnumber of bot faces
verticesarray of floats for vertices [num_vertices*3]
facesarray of ints for faces [num_faces*3]
thicknessarray of plate mode thicknesses (corresponds to array of faces) NULL for modes RT_BOT_SURFACE and RT_BOT_SOLID.
face_modea flag for each face indicating thickness is appended to hit point, otherwise thickness is centered about hit point
num_normalsnumber of unit normals in normals array
normalsarray of floats for normals [num_normals*3]
face_normalsarray of ints (indices into normals array), must have 3*num_faces entries

Definition at line 43 of file bot.c.

References BU_ALLOC, bu_bitv_dup(), bu_calloc(), bu_log(), db_version(), rt_wdb::dbip, ID_BOT, if(), mk_conv2mm, orientation, RT_BOT_INTERNAL_MAGIC, and wdb_export().

Referenced by mk_bot().

Here is the call graph for this function:

int mk_brep ( struct rt_wdb wdbp,
const char *  name,
ON_Brep brep 
)

Library for writing BREP objects into MGED databases from arbitrary procedures.

Create a brep in the geometry file.

Definition at line 42 of file brep.cpp.

References BU_ALLOC, BU_ASSERT, bu_log(), ID_BREP, mk_conv2mm, RT_BREP_INTERNAL_MAGIC, and wdb_export().

Referenced by ged_brep(), main(), and make_shape().

Here is the call graph for this function:

int mk_bspline ( struct rt_wdb wdbp,
const char *  name,
struct face_g_snurb **  surfs 
)

Library for writing NURB objects into MGED databases from arbitrary procedures.

Output an array of B-spline (NURBS) surfaces which comprise a solid. The surface is freed when it is written.

Definition at line 44 of file nurb.c.

References BU_ALLOC, ID_BSPLINE, mk_conv2mm, RT_NURB_INTERNAL_MAGIC, and wdb_export().

Here is the call graph for this function:

int mk_nmg ( struct rt_wdb filep,
const char *  name,
struct model *  m 
)

libwdb support for writing an NMG to disk.

The NMG is freed after being written.

Returns - <0 error 0 OK

Definition at line 41 of file nmg.c.

References ID_NMG, mk_conv2mm, and wdb_export().

Referenced by brep_to_nmg().

Here is the call graph for this function:

int mk_bot_from_nmg ( struct rt_wdb ofp,
const char *  name,
struct shell *  s 
)

For ray-tracing speed, many database conversion routines like to offer the option of converting NMG objects to bags of triangles (BoT). Here is a convenience routine to replace the old routine write_shell_as_polysolid. (obsolete since BRL-CAD 6.0)

Definition at line 55 of file nmg.c.

References ID_BOT, mk_conv2mm, nmg_bot(), wdb_export(), and rt_wdb::wdb_tol.

Here is the call graph for this function:

int mk_sketch ( struct rt_wdb fp,
const char *  name,
const struct rt_sketch_internal *  skt 
)

Support for sketches

Definition at line 35 of file sketch.c.

References ID_SKETCH, mk_conv2mm, rt_copy_sketch(), and wdb_export().

Here is the call graph for this function:

int mk_extrusion ( struct rt_wdb fp,
const char *  name,
const char *  sketch_name,
const point_t  V,
const vect_t  h,
const vect_t  u_vec,
const vect_t  v_vec,
int  keypoint 
)

Support for extrusion solids

Definition at line 41 of file extrude.c.

References BU_ALLOC, bu_strdup, ID_EXTRUDE, mk_conv2mm, RT_EXTRUDE_INTERNAL_MAGIC, and wdb_export().

Here is the call graph for this function:

int mk_cline ( struct rt_wdb fp,
const char *  name,
const point_t  V,
const vect_t  height,
fastf_t  radius,
fastf_t  thickness 
)

Support for cline solids (kludges from FASTGEN)

Definition at line 40 of file cline.c.

References BU_ALLOC, ID_CLINE, mk_conv2mm, RT_CLINE_INTERNAL_MAGIC, and wdb_export().

Here is the call graph for this function:

int mk_particle ( struct rt_wdb fp,
const char *  name,
point_t  vertex,
vect_t  height,
double  vradius,
double  hradius 
)

Support for particles and pipes. Library for writing geometry databases from arbitrary procedures.

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.

Returns - 0 OK <0 failure

Referenced by makeFoot().

int mk_pipe ( struct rt_wdb fp,
const char *  name,
struct bu_list headp 
)

Note that the linked list of pipe segments headed by 'headp' must be freed by the caller. mk_pipe_free() can be used.

Returns - 0 OK <0 failure

Definition at line 66 of file pipe.c.

References BU_ALLOC, BU_LIST_APPEND_LIST, BU_LIST_INIT, bu_log(), ID_PIPE, mk_conv2mm, rt_pipe_ck(), RT_PIPE_INTERNAL_MAGIC, and wdb_export().

Referenced by make_coil().

Here is the call graph for this function:

void mk_pipe_free ( struct bu_list headp)

Release the storage from a list of pipe segments. The head is left in initialized state (i.e., forward & back point to head).

Definition at line 86 of file pipe.c.

References bu_free(), BU_LIST_DEQUEUE, and BU_LIST_WHILE.

Referenced by make_coil().

Here is the call graph for this function:

void mk_add_pipe_pt ( struct bu_list headp,
const point_t  coord,
double  od,
double  id,
double  bendradius 
)

Add another pipe segment to the linked list of pipe segments.

Definition at line 98 of file pipe.c.

References BU_ALLOC, BU_CKMAG, BU_LIST_INSERT, and WDB_PIPESEG_MAGIC.

Referenced by cap_ground(), cap_squared(), cap_squared_ground(), helical_coil_plain(), and make_coil().

void mk_pipe_init ( struct bu_list headp)

initialize a linked list of pipe segments with the first segment

Definition at line 120 of file pipe.c.

References BU_LIST_INIT, bu_list::magic, and WDB_PIPESEG_MAGIC.

Referenced by make_coil().

int mk_dsp ( struct rt_wdb fp,
const char *  name,
const char *  file,
size_t  xdim,
size_t  ydim,
const matp_t  mat 
)

Definition at line 36 of file dsp.c.

References BU_ALLOC, bu_vls_init(), bu_vls_strcat(), ID_DSP, mk_conv2mm, RT_DSP_INTERNAL_MAGIC, and wdb_export().

Here is the call graph for this function:

int mk_ebm ( struct rt_wdb fp,
const char *  name,
const char *  file,
size_t  xdim,
size_t  ydim,
fastf_t  tallness,
const matp_t  mat 
)

Definition at line 38 of file ebm.c.

References BU_ALLOC, bu_strlcpy, ID_EBM, mk_conv2mm, RT_EBM_INTERNAL_MAGIC, and wdb_export().

Here is the call graph for this function:

int mk_hrt ( struct rt_wdb fp,
const char *  name,
const point_t  center,
const vect_t  x,
const vect_t  y,
const vect_t  z,
const fastf_t  dist 
)

Definition at line 553 of file wdb.c.

References BU_ALLOC, ID_HRT, mk_conv2mm, RT_HRT_INTERNAL_MAGIC, and wdb_export().

Here is the call graph for this function:

int mk_vol ( struct rt_wdb fp,
const char *  name,
const char *  file,
size_t  xdim,
size_t  ydim,
size_t  zdim,
size_t  lo,
size_t  hi,
const vect_t  cellsize,
const matp_t  mat 
)
int mk_submodel ( struct rt_wdb fp,
const char *  name,
const char *  file,
const char *  treetop,
int  meth 
)

Create a submodel solid. If file is NULL or "", the treetop refers to the current database. Treetop is the name of a single database object in 'file'. meth is 0 (RT_PART_NUBSPT) or 1 (RT_PART_NUGRID). method 0 is what is normally used.

Definition at line 34 of file submodel.c.

References BU_ALLOC, bu_vls_init(), bu_vls_strcpy(), ID_SUBMODEL, mk_conv2mm, RT_SUBMODEL_INTERNAL_MAGIC, and wdb_export().

Here is the call graph for this function:

int mk_write_color_table ( struct rt_wdb ofp)

Interface for writing region-id-based color tables to the database.

Given that the color table has been built up by successive calls to rt_color_addrec(), write it into the database.

Definition at line 42 of file mater.c.

References BU_ASSERT_LONG, bu_log(), db5_put_color_table(), db_version(), rt_wdb::dbip, mk_version, and RT_CK_WDB.

Here is the call graph for this function:

struct wmember* mk_addmember ( const char *  name,
struct bu_list headp,
mat_t  mat,
int  op 
)

Obtain dynamic storage for a new wmember structure, fill in the name, default the operation and matrix, and add to doubly linked list. In typical use, a one-line call is sufficient. To change the defaults, catch the pointer that is returned, and adjust the structure to taste.

The caller is responsible for initializing the header structures forward and backward links.

Definition at line 181 of file reg.c.

References BU_ALLOC, BU_LIST_INSERT, bu_log(), bu_strdup, wmember::l, bu_list::magic, wmember::wm_mat, wmember::wm_name, wmember::wm_op, WMEMBER_MAGIC, WMEMBER_NULL, WMOP_INTERSECT, WMOP_SUBTRACT, and WMOP_UNION.

Referenced by cap_ground(), cap_squared_ground(), create_boxes(), ged_human(), ged_tire(), make_coil(), mk_comb1(), and mk_region1().

Here is the call graph for this function:

int mk_comb ( struct rt_wdb wdbp,
const char *  combname,
struct bu_list headp,
int  region_kind,
const char *  shadername,
const char *  shaderargs,
const unsigned char *  rgb,
int  id,
int  air,
int  material,
int  los,
int  inherit,
int  append_ok,
int  gift_semantics 
)

Make a combination, where the members are described by a linked list of wmember structs.

The linked list is freed when it has been output.

Has many operating modes.

Returns - -1 ERROR 0 OK0 = pure, 1 = gift

Parameters
wdbpdatabase to write to
combnamename of the combination
headpMade by mk_addmember()
region_kind1 => region. 'P' and 'V' for FASTGEN
shadernameshader name, or NULL
shaderargsshader args, or NULL
rgbNULL => no color
idregion_id
airaircode
materialGIFTmater
losline-of-sight thickness equivalence
inheritwhether objects below inherit from this comb
append_ok0 = obj must not exit

Definition at line 230 of file reg.c.

References rt_comb_internal::aircode, BU_ALLOC, bu_log(), bu_shader_to_list(), bu_vls_addr(), bu_vls_free(), BU_VLS_INIT_ZERO, bu_vls_strcat(), bu_vls_vlscatzap(), rt_comb_internal::GIFTmater, ID_COMBINATION, rt_db_internal::idb_major_type, rt_db_internal::idb_meth, rt_db_internal::idb_ptr, rt_comb_internal::inherit, rt_comb_internal::is_fastgen, rt_comb_internal::los, mk_conv2mm, mk_freemembers(), mk_tree_gift(), mk_tree_pure(), OBJ, REGION_FASTGEN_PLATE, REGION_FASTGEN_VOLUME, rt_comb_internal::region_flag, rt_comb_internal::region_id, rt_comb_internal::rgb, rt_comb_internal::rgb_valid, RT_CK_COMB, RT_CK_WDB, RT_COMB_INTERNAL_INIT, RT_DB_INTERNAL_INIT, rt_comb_internal::shader, strchr(), wdb_import(), and wdb_put_internal().

Referenced by ged_voxelize(), mk_comb1(), and mk_region1().

Here is the call graph for this function:

int mk_comb1 ( struct rt_wdb fp,
const char *  combname,
const char *  membname,
int  regflag 
)

Convenience routines for quickly making combinations

Convenience interface to make a combination with a single member.

Definition at line 340 of file reg.c.

References BU_LIST_INIT, mk_addmember(), mk_comb(), WMEMBER_NULL, and WMOP_UNION.

Here is the call graph for this function:

int mk_region1 ( struct rt_wdb fp,
const char *  combname,
const char *  membname,
const char *  shadername,
const char *  shaderargs,
const unsigned char *  rgb 
)

Convenience routine to make a region with shader and rgb possibly set.

Definition at line 357 of file reg.c.

References BU_LIST_INIT, mk_addmember(), mk_comb(), WMEMBER_NULL, and WMOP_UNION.

Here is the call graph for this function:

int mk_conversion ( char *  units_string)

Given a string conversion value, find the appropriate factor, and establish it.

Returns - -1 error 0 OK

Definition at line 41 of file units.c.

References bu_units_conversion(), and mk_set_conversion().

Here is the call graph for this function:

int mk_set_conversion ( double  val)

Establish a new conversion factor for LIBWDB routines.

Returns - -1 error 0 OK

Definition at line 51 of file units.c.

References mk_conv2mm, and cvt_tab::val.

Referenced by mk_conversion().

void mk_freemembers ( struct bu_list headp)

Definition at line 216 of file reg.c.

References bu_free(), BU_LIST_DEQUEUE, BU_LIST_WHILE, wmember::l, WDB_CK_WMEMBER, and wmember::wm_name.

Referenced by ged_voxelize(), and mk_comb().

Here is the call graph for this function:

int make_hole ( struct rt_wdb wdbp,
point_t  hole_start,
vect_t  hole_depth,
fastf_t  hole_radius,
int  num_objs,
struct directory **  dp 
)

This routine is intended to be used to make a hole in some geometry. The hole is described using the same parameters as an RCC, and the hole is represented as an RCC. The objects to be "holed" are passed in as a list of "struct directory" pointers. The objects pointed at by this list must be combinations. The "struct rt_wdb" pointer passed in indicates what model this hole should appear in.

The end state after this routine runs is a modified model with a new RCC primitive having a name of the form "make_hole_X" (where X is some integer). The combinations specified in the list will be modified as follows:

   before                          after
     |                              /\
     u                             u  -

orig_comb_tree orig_comb_tree make_hole_X

The modified combination is written to the struct rt_wdb. Note that to do dynamic geometry a "wdb_dbopen" would normally be called on an already existing (and possibly prepped) model. Using the RT_WDB_TYPE_DB_INMEM parameter in this call will result in geometry changes that only exist in memory and will not be permanently stored in the original database.

This routine should be preceded by a call to "rt_unprep" and followed by a call to "rt_reprep".

Definition at line 68 of file dynamic_geometry.c.

References BU_ALLOC, bu_log(), bu_strdup, bu_vls_addr(), bu_vls_free(), BU_VLS_INIT_ZERO, bu_vls_printf(), bu_vls_strcat(), bu_vls_strlen(), bu_vls_trunc(), db_lookup(), rt_wdb::dbip, rt_db_internal::idb_ptr, LOOKUP_QUIET, mk_rcc(), OP_DB_LEAF, OP_SUBTRACT, RT_CHECK_WDB, RT_CK_DIR, rt_db_get_internal(), RT_DIR_COMB, RT_DIR_NULL, RT_TREE_INIT, tree::tree_node::tb_left, tree::tree_node::tb_op, tree::tree_node::tb_right, tree::tree_db_leaf::tl_mat, tree::tree_db_leaf::tl_name, tree::tree_db_leaf::tl_op, tree::tr_b, tree::tr_l, rt_comb_internal::tree, wdb_put_internal(), and rt_wdb::wdb_resp.

Here is the call graph for this function:

int make_hole_in_prepped_regions ( struct rt_wdb wdbp,
struct rt_i rtip,
point_t  hole_start,
vect_t  hole_depth,
fastf_t  radius,
struct bu_ptbl regions 
)

This routine provides a quick approach to simply adding a hole to existing prepped geometry. The geometry must already be prepped prior to calling this routine. After calling this routine, the geometry is ready for raytracing (no other routine need to be called).

A new RCC primitive is created and written to the database (wdbp). Note that this will be temporary if the wdbp pointer was created by a call to wdb_dbopen with the RT_WDB_TYPE_DB_INMEM flag.

The "regions" parameter is a list of "struct region" pointers (prepped regions) to get holed. The regions structures are modified, but the on disk region records are never modified, so the actual holes will never be permanent regardless of how "wdbp" was opened.

There is no need to call "rt_unprep" nor "rt_reprep" with this routine.

Definition at line 159 of file dynamic_geometry.c.

References BU_ALLOC, bu_bomb(), bu_log(), BU_PTBL_GET, bu_ptbl_init(), bu_ptbl_ins(), BU_PTBL_LEN, bu_realloc(), bu_vls_addr(), bu_vls_free(), BU_VLS_INIT_ZERO, bu_vls_printf(), bu_vls_strcat(), bu_vls_strlen(), bu_vls_trunc(), db_lookup(), rt_wdb::dbip, rt_functab::ft_prep, rt_db_internal::idb_meth, insert_in_bsp(), soltab::l, soltab::l2, LOOKUP_QUIET, bu_list::magic, mk_rcc(), rt_i::nsolids, OP_SOLID, OP_SUBTRACT, region::reg_all_unions, region::reg_treetop, RT_CHECK_WDB, RT_CK_REGION, rt_db_get_internal(), RT_DIR_NULL, RT_SOLTAB2_MAGIC, RT_SOLTAB_MAGIC, RT_TREE_INIT, rt_i::rti_CutHead, rt_i::rti_Solids, soltab::st_bit, soltab::st_dp, soltab::st_regions, soltab::st_uses, tree::tree_node::tb_left, tree::tree_node::tb_op, tree::tree_node::tb_regionp, tree::tree_node::tb_right, tree::tr_a, tree::tr_b, tree::tree_leaf::tu_op, tree::tree_leaf::tu_regionp, tree::tree_leaf::tu_stp, and rt_wdb::wdb_resp.

Here is the call graph for this function:

Variable Documentation

int mk_version

Which version database to write.

Set this variable to either 4 or 5, depending on which version of the database you wish to write.

Definition at line 38 of file export.c.

Referenced by mk_write_color_table().