BRL-CAD
|
Interface structures and routines for libwdb. More...
Files | |
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 |
must track db.h More... | |
#define | WMOP_SUBTRACT DB_OP_SUBTRACT |
must track db.h More... | |
#define | WMOP_UNION DB_OP_UNION |
must track db.h More... | |
#define | mk_lfcomb(fp, name, headp, region) mk_lcomb(fp, name, headp, region, (char *)0, (char *)0, (unsigned char *)0, 0); |
#define | mk_export_fwrite(wdbp, name, gp, id) wdb_export(wdbp, name, gp, id, mk_conv2mm) |
Functions | |
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 base_radius, fastf_t nose_radius) |
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_material (struct rt_wdb *wdbp, const char *db_name, const char *name, const char *parent, const char *source, struct bu_attribute_value_set *physicalProperties, struct bu_attribute_value_set *mechanicalProperties, struct bu_attribute_value_set *opticalProperties, struct bu_attribute_value_set *thermalProperties) |
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_bot_w_normals_and_uvs (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, size_t num_uvs, fastf_t *uvs, int *face_uvs) |
int | mk_brep (struct rt_wdb *wdbp, const char *name, void *vbrep) |
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_annot (struct rt_wdb *fp, const char *name, const struct rt_annot_internal *ann) |
int | mk_script (struct rt_wdb *fp, const char *name, const struct rt_script_internal *scr) |
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_pnt (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, char datasrc, 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 wmember * | mk_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) |
Combination (region and group) construction: first you build a list of nodes with mk_addmember, then you output the combination. More... | |
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) |
This routine is intended to be used to make a hole in some geometry. More... | |
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. More... | |
Variables | |
double | mk_conv2mm |
Conversion factor to mm. More... | |
int | mk_version |
Which version database to write. More... | |
Interface structures and routines for libwdb.
Library for writing MGED database objects 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.
Note - Rather than using a stdio (FILE *), we now use a (struct rt_wdb *) parameter. Rather than calling fopen(), call wdb_fopen();
#define WMEMBER_INIT_ZERO { BU_LIST_INIT_ZERO, 0, MAT_INIT_IDN, NULL } |
#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_export_fwrite | ( | wdbp, | |
name, | |||
gp, | |||
id | |||
) | wdb_export(wdbp, name, gp, id, mk_conv2mm) |
enum wdb_binunif |
int mk_id | ( | struct rt_wdb * | fp, |
const char * | title | ||
) |
Make a database header (ID) record.
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).
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.
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.
Make a right parallelepiped. Specified by minXYZ, maxXYZ.
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.
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.
Make a sphere with the given center point and 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 | ||
) |
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.
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).
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.
int mk_cone | ( | struct rt_wdb * | fp, |
const char * | name, | ||
const point_t | base, | ||
const vect_t | dirv, | ||
fastf_t | height, | ||
fastf_t | base_radius, | ||
fastf_t | nose_radius | ||
) |
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.
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.
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).
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.
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.
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.
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.
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.
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] | ||
) |
Makes a metaball.
Caller is responsible for freeing 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 | ||
) |
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
int mk_material | ( | struct rt_wdb * | wdbp, |
const char * | db_name, | ||
const char * | name, | ||
const char * | parent, | ||
const char * | source, | ||
struct bu_attribute_value_set * | physicalProperties, | ||
struct bu_attribute_value_set * | mechanicalProperties, | ||
struct bu_attribute_value_set * | opticalProperties, | ||
struct bu_attribute_value_set * | thermalProperties | ||
) |
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.
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 | ||
) |
Create a BOT (Bag O'Triangles) solid
fp | database file pointer to write to |
name | name of bot object to write out |
mode | bot mode |
orientation | bot orientation |
error_mode | may be used to indicate error handling (ignored for now) |
num_vertices | number of vertices |
num_faces | number of faces |
vertices | array of floats for vertices [num_vertices*3] |
faces | array of ints for faces [num_faces*3] |
thickness | array of plate mode thicknesses (corresponds to array of faces) NULL for modes RT_BOT_SURFACE and RT_BOT_SOLID. |
face_mode | a flag for each face indicating thickness is appended to hit point, otherwise thickness is centered about hit point |
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 | ||
) |
Create a BOT (Bag O'Triangles) solid with face normals
fp | database file pointer to write to |
name | name of bot object to write out |
mode | bot mode |
orientation | bot orientation |
flags | additional bot flags |
num_vertices | number of bot vertices |
num_faces | number of bot faces |
vertices | array of floats for vertices [num_vertices*3] |
faces | array of ints for faces [num_faces*3] |
thickness | array of plate mode thicknesses (corresponds to array of faces) NULL for modes RT_BOT_SURFACE and RT_BOT_SOLID. |
face_mode | a flag for each face indicating thickness is appended to hit point, otherwise thickness is centered about hit point |
num_normals | number of unit normals in normals array |
normals | array of floats for normals [num_normals*3] |
face_normals | array of ints (indices into normals array), must have 3*num_faces entries |
int mk_bot_w_normals_and_uvs | ( | 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, | ||
size_t | num_uvs, | ||
fastf_t * | uvs, | ||
int * | face_uvs | ||
) |
Create a BOT (Bag O'Triangles) solid with face normals and uv texture coordinates
fp | database file pointer to write to |
name | name of bot object to write out |
mode | bot mode |
orientation | bot orientation |
flags | additional bot flags |
num_vertices | number of bot vertices |
num_faces | number of bot faces |
vertices | array of floats for vertices [num_vertices*3] |
faces | array of ints for faces [num_faces*3] |
thickness | array of plate mode thicknesses (corresponds to array of faces) NULL for modes RT_BOT_SURFACE and RT_BOT_SOLID. |
face_mode | a flag for each face indicating thickness is appended to hit point, otherwise thickness is centered about hit point |
num_normals | number of unit normals in normals array |
normals | array of floats for normals [num_normals*3] |
face_normals | array of ints (indices into normals array), must have 3*num_faces entries |
num_uvs | number of uv texture coordinates in uvs array |
uvs | array of floats for uv texture coordinates [num_uvs*3] |
face_uvs | array of ints (indices into uvs array), must have 3*num_faces entries |
int mk_brep | ( | struct rt_wdb * | wdbp, |
const char * | name, | ||
void * | vbrep | ||
) |
Create a brep in the geometry file. vbrep must be a void cast pointer to an ON_Brep shape.
int mk_bspline | ( | struct rt_wdb * | wdbp, |
const char * | name, | ||
struct face_g_snurb ** | surfs | ||
) |
Output an array of B-spline (NURBS) surfaces which comprise a solid. The surface is freed when it is written.
Note: unless there is a specific need to work with the older BRL-CAD NURBS objects, mk_brep should be used instead of this routine.
The NMG is freed after being written.
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)
int mk_sketch | ( | struct rt_wdb * | fp, |
const char * | name, | ||
const struct rt_sketch_internal * | skt | ||
) |
Make a sketch
int mk_annot | ( | struct rt_wdb * | fp, |
const char * | name, | ||
const struct rt_annot_internal * | ann | ||
) |
Make a annotation
int mk_script | ( | struct rt_wdb * | fp, |
const char * | name, | ||
const struct rt_script_internal * | scr | ||
) |
Make a script
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 | ||
) |
Make an extrusion solid
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)
Note: cline should not be used in .g models unless specifically needed for FASTGEN compatibility.
int mk_particle | ( | struct rt_wdb * | fp, |
const char * | name, | ||
point_t | vertex, | ||
vect_t | height, | ||
double | vradius, | ||
double | hradius | ||
) |
Make a particle primitive.
Make a pipe primitive.
Note that the linked list of pipe segments headed by 'headp' must be freed by the caller. mk_pipe_free() can be used.
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).
void mk_add_pipe_pnt | ( | 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.
void mk_pipe_init | ( | struct bu_list * | headp | ) |
initialize a linked list of pipe segments with the first segment
int mk_dsp | ( | struct rt_wdb * | fp, |
const char * | name, | ||
const char * | file, | ||
size_t | xdim, | ||
size_t | ydim, | ||
const matp_t | mat | ||
) |
Displacement map primitive.
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 | ||
) |
Extruded bitmap primitive.
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 | ||
) |
Heart primitive.
int mk_vol | ( | struct rt_wdb * | fp, |
const char * | name, | ||
char | datasrc, | ||
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 | ||
) |
3-D Volume primitive.
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 normally 0 (RT_PART_NUBSPT) and unused.
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.
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 name must be a non-zero length string.
The caller is responsible for initializing the header structures forward and backward links.
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 | ||
) |
Combination (region and group) construction: first you build a list of nodes with mk_addmember, then you output the combination.
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.
wdbp | database to write to |
combname | name of the combination |
headp | Made by mk_addmember() |
region_kind | 1 => region. 'P' and 'V' for FASTGEN |
shadername | shader name, or NULL |
shaderargs | shader args, or NULL |
rgb | NULL => no color |
id | region_id |
air | aircode |
material | GIFTmater |
los | line-of-sight thickness equivalence |
inherit | whether objects below inherit from this comb |
append_ok | 0 = obj must not exit |
gift_semantics | 0 = pure, 1 = gift |
int mk_comb1 | ( | struct rt_wdb * | fp, |
const char * | combname, | ||
const char * | membname, | ||
int | regflag | ||
) |
Convenience interface to make a combination with a single member.
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.
int mk_conversion | ( | char * | units_string | ) |
Given a string conversion value, find the appropriate factor, and establish it.
int mk_set_conversion | ( | double | val | ) |
Establish a new conversion factor for LIBWDB routines.
void mk_freemembers | ( | struct bu_list * | headp | ) |
TODO - document this...
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".
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.
|
extern |
Conversion factor to mm.
This internal variable should not be directly modified; call mk_conversion() or mk_set_conversion() instead.
|
extern |
Which version database to write.
Set this variable to either 4 or 5, depending on which version of the database you wish to write.