本文整理汇总了C++中BU_LIST_INIT函数的典型用法代码示例。如果您正苦于以下问题:C++ BU_LIST_INIT函数的具体用法?C++ BU_LIST_INIT怎么用?C++ BU_LIST_INIT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BU_LIST_INIT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: bn_vlblock_init
struct bn_vlblock *
bn_vlblock_init(struct bu_list *free_vlist_hd, /**< where to get/put free vlists */
int max_ent /**< maximum number of entities to get/put */)
{
struct bn_vlblock *vbp;
size_t i;
if (!BU_LIST_IS_INITIALIZED(free_vlist_hd))
BU_LIST_INIT(free_vlist_hd);
BU_ALLOC(vbp, struct bn_vlblock);
vbp->magic = BN_VLBLOCK_MAGIC;
vbp->free_vlist_hd = free_vlist_hd;
vbp->max = max_ent;
vbp->head = (struct bu_list *)bu_calloc(vbp->max,
sizeof(struct bu_list), "head[]");
vbp->rgb = (long *)bu_calloc(vbp->max,
sizeof(long), "rgb[]");
for (i=0; i < vbp->max; i++) {
vbp->rgb[i] = 0;
BU_LIST_INIT(&(vbp->head[i]));
}
vbp->rgb[0] = 0xFFFF00L; /* Yellow, default */
vbp->rgb[1] = 0xFFFFFFL; /* White */
vbp->nused = 2;
return vbp;
}
开发者ID:cogitokat,项目名称:brlcad,代码行数:30,代码来源:vlist.c
示例2: BU_LIST_INIT
void RegionList::create(rt_wdb* wdbp)
{
wmember allRegions;
BU_LIST_INIT(&allRegions.l);
for (std::map<std::string, Bot>::iterator it = m_list.begin();
it != m_list.end();
++it) {
it->second.write(wdbp);
wmember regionContent;
BU_LIST_INIT(®ionContent.l);
mk_addmember(it->second.name().c_str(), ®ionContent.l, 0, WMOP_UNION);
int id = (int)toValue(it->first.c_str());
mk_lrcomb(wdbp,
it->first.c_str(),
®ionContent,
1,
"plastic",
"sh=4 sp=0.5 di=0.5 re=0.1",
0,
id,
0,
0,
100,
0);
mk_addmember(it->first.c_str(), &allRegions.l, 0, WMOP_UNION);
mk_freemembers(®ionContent.l);
}
mk_lfcomb(wdbp, "all.g", &allRegions, 0);
mk_freemembers(&allRegions.l);
}
开发者ID:cogitokat,项目名称:brlcad,代码行数:35,代码来源:RegionList.cpp
示例3: facetize_region_end
static union tree *
facetize_region_end(struct db_tree_state *tsp,
const struct db_full_path *pathp,
union tree *curtree,
void *client_data)
{
struct bu_list vhead;
union tree **facetize_tree;
if (tsp) RT_CK_DBTS(tsp);
if (pathp) RT_CK_FULL_PATH(pathp);
facetize_tree = (union tree **)client_data;
BU_LIST_INIT(&vhead);
if (curtree->tr_op == OP_NOP) return curtree;
if (*facetize_tree) {
union tree *tr;
BU_ALLOC(tr, union tree);
RT_TREE_INIT(tr);
tr->tr_op = OP_UNION;
tr->tr_b.tb_regionp = REGION_NULL;
tr->tr_b.tb_left = *facetize_tree;
tr->tr_b.tb_right = curtree;
*facetize_tree = tr;
} else {
*facetize_tree = curtree;
}
/* Tree has been saved, and will be freed later */
return TREE_NULL;
}
开发者ID:behollis,项目名称:brlcad-svn-rev65072-gsoc2015,代码行数:33,代码来源:facetize.c
示例4: rt_nurb_bezier
/*
* R T _ N U R B _ B E Z I E R
*
* Given a single snurb, if it is in Bezier form,
* duplicate the snurb, and enqueue it on the bezier_hd list.
* If the original snurb is NOT in Bezier form,
* subdivide it a set of snurbs which are,
* each of which are enqueued on the bezier_hd list.
*
* In either case, the original surface remains untouched.
*
* Returns -
* 0 Surface splitting was done.
* 1 Original surface was Bezier, only a copy was done.
*/
int
rt_nurb_bezier(struct bu_list *bezier_hd, const struct face_g_snurb *orig_surf, struct resource *res)
{
struct face_g_snurb *s;
int dir;
struct bu_list todo;
NMG_CK_SNURB(orig_surf);
if ( (dir = rt_bez_check( orig_surf )) == -1) {
s = rt_nurb_scopy( orig_surf, res );
BU_LIST_APPEND( bezier_hd, &s->l );
return 1; /* Was already Bezier, nothing done */
}
BU_LIST_INIT( &todo );
rt_nurb_s_split( &todo, orig_surf, dir, res );
while ( BU_LIST_WHILE( s, face_g_snurb, &todo ) ) {
if ( (dir = rt_bez_check(s)) == -1) {
/* This snurb is now a Bezier */
BU_LIST_DEQUEUE( &s->l );
BU_LIST_APPEND( bezier_hd, &s->l );
} else {
/* Split, and keep going */
BU_LIST_DEQUEUE( &s->l );
rt_nurb_s_split( &todo, s, dir, res );
rt_nurb_free_snurb(s, res);
}
}
return 0; /* Bezier snurbs on bezier_hd list */
}
开发者ID:cciechad,项目名称:brlcad,代码行数:47,代码来源:nurb_bezier.c
示例5: cho_open
HIDDEN struct bu_cmdhist_obj *
cho_open(ClientData UNUSED(clientData), Tcl_Interp *interp, const char *name)
{
struct bu_cmdhist_obj *chop;
/* check to see if command history object exists */
for (BU_LIST_FOR(chop, bu_cmdhist_obj, &HeadCmdHistObj.l)) {
if (BU_STR_EQUAL(name, bu_vls_addr(&chop->cho_name))) {
Tcl_AppendResult(interp, "ch_open: ", name,
" exists.\n", (char *)NULL);
return BU_CMDHIST_OBJ_NULL;
}
}
BU_GET(chop, struct bu_cmdhist_obj);
bu_vls_init(&chop->cho_name);
bu_vls_strcpy(&chop->cho_name, name);
BU_LIST_INIT(&chop->cho_head.l);
bu_vls_init(&chop->cho_head.h_command);
chop->cho_head.h_start.tv_sec = chop->cho_head.h_start.tv_usec =
chop->cho_head.h_finish.tv_sec = chop->cho_head.h_finish.tv_usec = 0L;
chop->cho_head.h_status = TCL_OK;
chop->cho_curr = &chop->cho_head;
BU_LIST_APPEND(&HeadCmdHistObj.l, &chop->l);
return chop;
}
开发者ID:cogitokat,项目名称:brlcad,代码行数:27,代码来源:cmdhist_obj.c
示例6: nmg_construct_edge_g_cnurb
static struct edge_g_cnurb *
nmg_construct_edge_g_cnurb(const struct edge_g_cnurb *original, void **structArray)
{
struct edge_g_cnurb *ret;
NMG_GETSTRUCT(ret, edge_g_cnurb);
ret->l.magic = NMG_EDGE_G_CNURB_MAGIC;
BU_LIST_INIT(&ret->eu_hd2);
ret->order = original->order;
ret->k.magic = NMG_KNOT_VECTOR_MAGIC;
ret->k.k_size = original->k.k_size;
ret->k.knots = (fastf_t *)bu_malloc(ret->k.k_size * sizeof(fastf_t), "nmg_construct_edge_g_cnurb(): k.knots");
memcpy(ret->k.knots, original->k.knots, ret->k.k_size * sizeof(fastf_t));
ret->c_size = original->c_size;
ret->pt_type = original->pt_type;
ret->ctl_points = (fastf_t *)bu_malloc(ret->c_size * RT_NURB_EXTRACT_COORDS(ret->pt_type) * sizeof(fastf_t),
"nmg_construct_edge_g_cnurb(): ctl_points");
memcpy(ret->ctl_points, original->ctl_points, ret->c_size * RT_NURB_EXTRACT_COORDS(ret->pt_type) * sizeof(fastf_t));
ret->index = original->index;
structArray[ret->index] = ret;
return ret;
}
开发者ID:kanzure,项目名称:brlcad,代码行数:29,代码来源:nmg_copy.c
示例7: nmg_construct_region
static struct nmgregion *
nmg_construct_region(struct model *parent, const struct nmgregion *original, void **structArray)
{
struct nmgregion *ret;
NMG_GETSTRUCT(ret, nmgregion);
ret->l.magic = NMG_REGION_MAGIC;
ret->m_p = parent;
ret->ra_p = (struct nmgregion_a *)NULL;
BU_LIST_INIT(&ret->s_hd);
ret->index = original->index;
structArray[ret->index] = ret;
if (original->ra_p != NULL) {
const struct nmgregion_a *originalAttributes = original->ra_p;
struct nmgregion_a *newAttributes
= (struct nmgregion_a *)structArray[originalAttributes->index];
if (newAttributes == NULL)
newAttributes = nmg_construct_region_a(originalAttributes, structArray);
ret->ra_p = newAttributes;
}
return ret;
}
开发者ID:kanzure,项目名称:brlcad,代码行数:29,代码来源:nmg_copy.c
示例8: crregion
void
crregion(char *region, char *op, int *members, int number, char *solidname, int maxlen)
{
int i;
struct bu_list head;
if (dbip == DBI_NULL)
return;
BU_LIST_INIT(&head);
for (i=0; i<number; i++) {
solidname[8] = '\0';
crname(solidname, members[i], maxlen);
if ( db_lookup( dbip, solidname, LOOKUP_QUIET) == DIR_NULL ) {
Tcl_AppendResult(interp, "region: ", region, " will skip member: ",
solidname, "\n", (char *)NULL);
continue;
}
mk_addmember( solidname, &head, NULL, op[i] );
}
(void)mk_comb( wdbp, region, &head,
1, NULL, NULL, NULL,
500+Trackpos+i, 0, mat_default, los_default,
0, 1, 1 );
}
开发者ID:cciechad,项目名称:brlcad,代码行数:26,代码来源:track.c
示例9: bev_facetize_region_end
static union tree *
bev_facetize_region_end(struct db_tree_state *UNUSED(tsp), const struct db_full_path *pathp, union tree *curtree, genptr_t client_data)
{
struct bu_list vhead;
struct ged *gedp = (struct ged *)client_data;
BU_LIST_INIT(&vhead);
if (RT_G_DEBUG&DEBUG_TREEWALK) {
char *sofar = db_path_to_string(pathp);
bu_vls_printf(gedp->ged_result_str, "bev_facetize_region_end() path='%s'\n", sofar);
bu_free((genptr_t)sofar, "path string");
}
if (curtree->tr_op == OP_NOP) return curtree;
bu_semaphore_acquire(RT_SEM_MODEL);
if (bev_facetize_tree) {
union tree *tr;
BU_ALLOC(tr, union tree);
RT_TREE_INIT(tr);
tr->tr_op = OP_UNION;
tr->tr_b.tb_regionp = REGION_NULL;
tr->tr_b.tb_left = bev_facetize_tree;
tr->tr_b.tb_right = curtree;
bev_facetize_tree = tr;
} else {
bev_facetize_tree = curtree;
}
bu_semaphore_release(RT_SEM_MODEL);
/* Tree has been saved, and will be freed later */
return TREE_NULL;
}
开发者ID:cogitokat,项目名称:brlcad,代码行数:35,代码来源:bev.c
示例10: bu_hook_list_init
void
bu_hook_list_init(struct bu_hook_list *hlp)
{
BU_LIST_INIT(&hlp->l);
hlp->hookfunc = BU_HOOK_NULL;
hlp->clientdata = GENPTR_NULL;
}
开发者ID:cciechad,项目名称:brlcad,代码行数:7,代码来源:hook.c
示例11: _bu_add_to_list
static void
_bu_add_to_list(const char *fn, int fd)
{
struct _bu_tf_list *newtf;
_bu_temp_files++;
if (_bu_temp_files == 1) {
/* schedule files for closure on exit */
atexit(_bu_close_files);
BU_GETSTRUCT(_bu_tf, _bu_tf_list);
BU_LIST_INIT(&(_bu_tf->l));
bu_vls_init(&_bu_tf->fn);
bu_vls_strcpy(&_bu_tf->fn, fn);
_bu_tf->fd = fd;
return;
}
BU_GETSTRUCT(newtf, _bu_tf_list);
bu_vls_init(&_bu_tf->fn);
bu_vls_strcpy(&_bu_tf->fn, fn);
newtf->fd = fd;
BU_LIST_PUSH(&(_bu_tf->l), &(newtf->l));
return;
}
开发者ID:cciechad,项目名称:brlcad,代码行数:31,代码来源:temp.c
示例12: vshot_stub
/**
* Stub function which will "simulate" a call to a vector shot routine
*/
HIDDEN void
vshot_stub(struct soltab **stp, struct xray **rp, struct seg *segp, int n, struct application *ap)
/* An array of solid pointers */
/* An array of ray pointers */
/* array of segs (results returned) */
/* Number of ray/object pairs */
/* pointer to an application */
{
register int i;
register struct seg *tmp_seg;
struct seg seghead;
int ret;
BU_LIST_INIT(&(seghead.l));
/* go through each ray/solid pair and call a scalar function */
for (i = 0; i < n; i++) {
if (stp[i] != 0) {
/* skip call if solid table pointer is NULL */
/* do scalar call, place results in segp array */
ret = -1;
if (OBJ[stp[i]->st_id].ft_shot) {
ret = OBJ[stp[i]->st_id].ft_shot(stp[i], rp[i], ap, &seghead);
}
if (ret <= 0) {
segp[i].seg_stp=(struct soltab *) 0;
} else {
tmp_seg = BU_LIST_FIRST(seg, &(seghead.l));
BU_LIST_DEQUEUE(&(tmp_seg->l));
segp[i] = *tmp_seg; /* structure copy */
RT_FREE_SEG(tmp_seg, ap->a_resource);
}
}
}
}
开发者ID:kanzure,项目名称:brlcad,代码行数:38,代码来源:vshoot.c
示例13: Fbo_Init
int
Fbo_Init(Tcl_Interp *interp)
{
BU_LIST_INIT(&HeadFBObj.l);
(void)Tcl_CreateCommand(interp, "fb_open", (Tcl_CmdProc *)fbo_open_tcl,
(ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
return TCL_OK;
}
开发者ID:cciechad,项目名称:brlcad,代码行数:9,代码来源:fb_obj.c
示例14: rt_process_casec
int
rt_process_casec(struct edge_g_cnurb *trim, fastf_t u, fastf_t v)
{
struct edge_g_cnurb * clip;
int jordan_hit;
struct bu_list plist;
int trim_flag = 0;
int caset;
/* determine if the the u, v values are on the curve */
if ( rt_nurb_uv_dist(trim, u, v) == TRIM_ON) return TRIM_IN;
jordan_hit = 0;
BU_LIST_INIT(&plist);
if ( nurb_crv_is_bezier( trim ) )
rt_clip_cnurb(&plist, trim, u, v);
else
nurb_c_to_bezier( &plist, trim );
while ( BU_LIST_WHILE( clip, edge_g_cnurb, &plist ) )
{
BU_LIST_DEQUEUE( &clip->l );
caset = rt_trim_case(clip, u, v);
trim_flag = 0;
if ( caset == CASE_B)
trim_flag = rt_process_caseb(clip, u, v);
if ( caset == CASE_C)
trim_flag = rt_process_casec(clip, u, v);
rt_nurb_free_cnurb( clip );
if ( trim_flag == TRIM_IN) jordan_hit++;
if ( trim_flag == TRIM_ON) break;
}
while ( BU_LIST_WHILE( clip, edge_g_cnurb, &plist) )
{
BU_LIST_DEQUEUE( &clip->l );
rt_nurb_free_cnurb( clip );
}
if ( trim_flag == TRIM_ON)
return TRIM_ON;
else if ( jordan_hit & 01 )
return TRIM_IN;
else
return TRIM_OUT;
}
开发者ID:cciechad,项目名称:brlcad,代码行数:56,代码来源:nurb_trim.c
示例15: rt_metaball_adjust
/**
* used for db put/asc2g
*/
int
rt_metaball_adjust(struct bu_vls *logstr, struct rt_db_internal *intern, int argc, const char **argv)
{
struct rt_metaball_internal *mb;
const char *pts;
const char *pend;
double thresh;
if (argc != 3) {
bu_vls_printf(logstr, "Invalid number of arguments: %d\n", argc);
return BRLCAD_ERROR;
}
RT_CK_DB_INTERNAL(intern);
mb = (struct rt_metaball_internal *)intern->idb_ptr;
RT_METABALL_CK_MAGIC(mb);
if ( strlen(*argv) != 1 || (**argv < '0' || **argv > '2') ) {
bu_vls_printf(logstr, "Invalid method type, must be one of 0, 1, or 2.");
return BRLCAD_ERROR;
}
mb->method = *argv[0] - '0';
sscanf(argv[1], "%lG", &thresh);
mb->threshold = thresh;
BU_LIST_INIT(&mb->metaball_ctrl_head);
pts = argv[2];
pend = pts + strlen(pts);
while (1) {
int len;
double xyz[3];
double fldstr, goo;
point_t loc;
const point_t *locp = (const point_t *)&loc;
while ( pts < pend && *pts != '{' ) ++pts;
if (pts >= pend) break;
len = sscanf(pts, "{%lG %lG %lG %lG %lG}", &xyz[0], &xyz[1], &xyz[2], &fldstr, &goo);
VMOVE(loc, xyz);
if (len == EOF) break;
if (len != 5) {
bu_vls_printf(logstr, "Failed to parse point information: \"%s\"", pts);
return BRLCAD_ERROR;
}
pts++;
if (rt_metaball_add_point (mb, locp, fldstr, goo)) {
bu_vls_printf(logstr, "Failure adding point: {%f %f %f %f %f}", V3ARGS(loc), fldstr, goo);
return BRLCAD_ERROR;
}
}
return BRLCAD_OK;
}
开发者ID:behollis,项目名称:brlcad-svn-rev65072-gsoc2015,代码行数:58,代码来源:metaball.c
示例16: bu_ptbl_init
/**
* B U _ P T B L _ I N I T
*
* Initialize struct & get storage for table.
* Recommend 8 or 64 for initial len.
*/
void
bu_ptbl_init(struct bu_ptbl *b, int len, const char *str)
{
if (bu_debug & BU_DEBUG_PTBL)
bu_log("bu_ptbl_init(%8x, len=%d, %s)\n", b, len, str);
BU_LIST_INIT(&b->l);
b->l.magic = BU_PTBL_MAGIC;
if ( len <= 0 ) len = 64;
b->blen = len;
b->buffer = (long **)bu_calloc(b->blen, sizeof(long *), str);
b->end = 0;
}
开发者ID:cciechad,项目名称:brlcad,代码行数:18,代码来源:ptbl.c
示例17: make_bond
int
make_bond(int sp1, int sp2)
{
struct sphere * s1, *s2, *s_ptr;
point_t base;
vect_t height;
char nm[128], nm1[128];
unsigned char rgb[3];
struct wmember reg_head;
s1 = s2 = (struct sphere *) 0;
for (s_ptr = s_head; s_ptr != (struct sphere *)0; s_ptr = s_ptr->next) {
if (s_ptr->s_id == sp1)
s1 = s_ptr;
if (s_ptr->s_id == sp2)
s2 = s_ptr;
}
if (s1 == (struct sphere *) 0 || s2 == (struct sphere *)0)
return -1; /* error */
VMOVE(base, s1->s_center);
VSUB2(height, s2->s_center, s1->s_center);
sprintf(nm, "bond.%d.%d", sp1, sp2);
rgb[0] = 191;
rgb[1] = 142;
rgb[2] = 57;
#if 1
/* Use this for mol-cube.dat */
mk_rcc(outfp, nm, base, height, s1->s_rad * 0.15);
#else
/* Use this for chemical molecules */
mk_rcc(outfp, nm, base, height, s1->s_rad * 0.5);
#endif
BU_LIST_INIT(®_head.l);
(void)mk_addmember(nm, ®_head.l, NULL, WMOP_UNION);
(void)mk_addmember(s1->s_name, ®_head.l, NULL, WMOP_SUBTRACT);
(void)mk_addmember(s2->s_name, ®_head.l, NULL, WMOP_SUBTRACT);
sprintf(nm1, "BOND.%d.%d", sp1, sp2);
mk_lcomb(outfp, nm1, ®_head, 1, matname, matparm, rgb, 0);
(void)mk_addmember(nm1, &head.l, NULL, WMOP_UNION);
return 0; /* OK */
}
开发者ID:cogitokat,项目名称:brlcad,代码行数:50,代码来源:molecule.c
示例18: Cho_Init
int
Cho_Init(Tcl_Interp *interp)
{
memset(&HeadCmdHistObj, 0, sizeof(struct bu_cmdhist_obj));
BU_LIST_INIT(&HeadCmdHistObj.l);
BU_VLS_INIT(&HeadCmdHistObj.cho_name);
/* cho_head already zero'd */
HeadCmdHistObj.cho_curr = NULL;
(void)Tcl_CreateCommand(interp, "ch_open", (Tcl_CmdProc *)cho_open_tcl,
(ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
return TCL_OK;
}
开发者ID:cogitokat,项目名称:brlcad,代码行数:14,代码来源:cmdhist_obj.c
示例19: historyInit
HIDDEN void
historyInit(void)
{
BU_LIST_INIT(&(histHead.l));
bu_vls_init(&(histHead.h_command));
histHead.h_start.tv_sec = histHead.h_start.tv_usec =
histHead.h_finish.tv_sec = histHead.h_finish.tv_usec = 0L;
histHead.h_status = TCL_OK;
currHist = &histHead;
#if 0
journalfp = NULL;
#endif
historyInitialized=1;
}
开发者ID:cciechad,项目名称:brlcad,代码行数:14,代码来源:cmd.c
示例20: rt_htbl_init
/*
* R T _ H T B L _ I N I T
*/
void
rt_htbl_init(struct rt_htbl *b, int len, const char *str)
/* initial len. */
{
if (bu_debug & BU_DEBUG_PTBL)
bu_log("rt_htbl_init(%8x, len=%d, %s)\n", b, len, str);
BU_LIST_INIT(&b->l);
b->l.magic = RT_HTBL_MAGIC;
if ( len <= 0 ) len = 64;
b->blen = len;
b->hits = (struct hit *)bu_calloc(b->blen, sizeof(struct hit), str);
b->end = 0;
}
开发者ID:cciechad,项目名称:brlcad,代码行数:18,代码来源:htbl.c
注:本文中的BU_LIST_INIT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论