/** * Make human-readable formatted presentation of this solid. * First line describes type of solid. * Additional lines are indented one tab, and give parameter values. */ int rt_arbn_describe(struct bu_vls *str, const struct rt_db_internal *ip, int verbose, double mm2local) { struct rt_arbn_internal *aip = (struct rt_arbn_internal *)ip->idb_ptr; char buf[256]; size_t i; RT_ARBN_CK_MAGIC(aip); sprintf(buf, "arbn bounded by %lu planes\n", (long unsigned)aip->neqn); bu_vls_strcat(str, buf); if (!verbose) return 0; for (i = 0; i < aip->neqn; i++) { sprintf(buf, "\t%lu: (%g, %g, %g) %g\n", (long unsigned)i, INTCLAMP(aip->eqn[i][X]), /* should have unit length */ INTCLAMP(aip->eqn[i][Y]), INTCLAMP(aip->eqn[i][Z]), INTCLAMP(aip->eqn[i][W] * mm2local)); bu_vls_strcat(str, buf); } return 0; }
void rt_pr_uvcoord(const struct uvcoord *uvp) { bu_log("u, v=(%g, %g), du, dv=(%g, %g)\n", INTCLAMP(uvp->uv_u), INTCLAMP(uvp->uv_v), INTCLAMP(uvp->uv_du), INTCLAMP(uvp->uv_dv)); }
void rt_pr_fallback_angle(struct bu_vls *str, const char *prefix, const double *angles) { BU_CK_VLS(str); bu_vls_printf(str, "%s direction cosines=(%1.f, %1.f, %1.f)\n", prefix, INTCLAMP(angles[0]), INTCLAMP(angles[1]), INTCLAMP(angles[2])); bu_vls_printf(str, "%s rotation angle=%1.f, fallback angle=%1.f\n", prefix, INTCLAMP(angles[3]), INTCLAMP(angles[4])); }
void rt_pr_region(register const struct region *rp) { struct bu_vls v = BU_VLS_INIT_ZERO; RT_CK_REGION(rp); bu_log("REGION %s (bit %d)\n", rp->reg_name, rp->reg_bit); bu_log("instnum=%ld, id=%d, air=%d, gift_material=%d, los=%d\n", rp->reg_instnum, rp->reg_regionid, rp->reg_aircode, rp->reg_gmater, rp->reg_los); if (rp->reg_is_fastgen != REGION_NON_FASTGEN) { bu_log("reg_is_fastgen = %s mode\n", rp->reg_is_fastgen == REGION_FASTGEN_PLATE ? "plate" : "volume"); } if (rp->reg_mater.ma_color_valid) bu_log("Color %d %d %d\n", (int)rp->reg_mater.ma_color[0]*255, (int)rp->reg_mater.ma_color[1]*255, (int)rp->reg_mater.ma_color[2]*255); if (rp->reg_mater.ma_temperature > 0) bu_log("Temperature %g degrees K\n", INTCLAMP(rp->reg_mater.ma_temperature)); if (rp->reg_mater.ma_shader && rp->reg_mater.ma_shader[0] != '\0') bu_log("Shader '%s'\n", rp->reg_mater.ma_shader); rt_pr_tree_vls(&v, rp->reg_treetop); bu_log("%s %ld %s\n", rp->reg_name, rp->reg_instnum, bu_vls_addr(&v)); bu_vls_free(&v); }
/** * R T _ P G _ D E S C R I B E * * Make human-readable formatted presentation of this solid. * First line describes type of solid. * Additional lines are indented one tab, and give parameter values. */ int rt_pg_describe(struct bu_vls *str, const struct rt_db_internal *ip, int verbose, double mm2local) { size_t i, j; struct rt_pg_internal *pgp = (struct rt_pg_internal *)ip->idb_ptr; char buf[256] = {0}; RT_PG_CK_MAGIC(pgp); bu_vls_strcat(str, "polygon solid with no topology (POLY)\n"); sprintf(buf, "\t%ld polygons (faces)\n", (long int)pgp->npoly); bu_vls_strcat(str, buf); sprintf(buf, "\tMost complex face has %lu vertices\n", (long unsigned)pgp->max_npts); bu_vls_strcat(str, buf); if (pgp->npoly) { sprintf(buf, "\tFirst vertex (%g, %g, %g)\n", INTCLAMP(pgp->poly[0].verts[X] * mm2local), INTCLAMP(pgp->poly[0].verts[Y] * mm2local), INTCLAMP(pgp->poly[0].verts[Z] * mm2local)); bu_vls_strcat(str, buf); } if (!verbose) return 0; /* Print out all the vertices of all the faces */ for (i=0; i < pgp->npoly; i++) { fastf_t *v = pgp->poly[i].verts; fastf_t *n = pgp->poly[i].norms; sprintf(buf, "\tPolygon %lu: (%lu pts)\n", (long unsigned)i, (long unsigned)pgp->poly[i].npts); bu_vls_strcat(str, buf); for (j=0; j < pgp->poly[i].npts; j++) { sprintf(buf, "\t\tV (%g, %g, %g)\n\t\t N (%g, %g, %g)\n", INTCLAMP(v[X] * mm2local), INTCLAMP(v[Y] * mm2local), INTCLAMP(v[Z] * mm2local), INTCLAMP(n[X] * mm2local), INTCLAMP(n[Y] * mm2local), INTCLAMP(n[Z] * mm2local)); bu_vls_strcat(str, buf); v += ELEMENTS_PER_VECT; n += ELEMENTS_PER_VECT; } } return 0; }
void rt_arbn_print(const struct soltab *stp) { size_t i; struct rt_arbn_internal *arbp = (struct rt_arbn_internal *)stp->st_specific; RT_ARBN_CK_MAGIC(arbp); bu_log("arbn bounded by %zu planes\n", arbp->neqn); for (i = 0; i < arbp->neqn; i++) { bu_log("\t%zu: (%g, %g, %g) %g\n", i, INTCLAMP(arbp->eqn[i][X]), /* should have unit length */ INTCLAMP(arbp->eqn[i][Y]), INTCLAMP(arbp->eqn[i][Z]), INTCLAMP(arbp->eqn[i][W])); } }
void rt_pr_soltab(register const struct soltab *stp) { register int id = stp->st_id; if (id <= 0 || id > ID_MAX_SOLID) { bu_log("stp=%p, id=%d.\n", (void *)stp, id); bu_bomb("rt_pr_soltab: bad id"); } bu_log("------------ %s (bit %ld) %s ------------\n", stp->st_dp->d_namep, stp->st_bit, OBJ[id].ft_name); VPRINT("Bound Sph CENTER", stp->st_center); bu_log("Approx Sph Radius = %g\n", INTCLAMP(stp->st_aradius)); bu_log("Bounding Sph Radius = %g\n", INTCLAMP(stp->st_bradius)); VPRINT("Bound RPP min", stp->st_min); VPRINT("Bound RPP max", stp->st_max); bu_pr_ptbl("st_regions", &stp->st_regions, 1); if (OBJ[id].ft_print) OBJ[id].ft_print(stp); }
/** * Make human-readable formatted presentation of this solid. First * line describes type of solid. Additional lines are indented one * tab, and give parameter values. */ int rt_xxx_describe(struct bu_vls *str, const struct rt_db_internal *ip, int verbose, double mm2local) { struct rt_xxx_internal *xxx_ip = (struct rt_xxx_internal *)ip->idb_ptr; char buf[256]; RT_XXX_CK_MAGIC(xxx_ip); bu_vls_strcat(str, "truncated general xxx (XXX)\n"); if (!verbose) return 0; sprintf(buf, "\tV (%g, %g, %g)\n", INTCLAMP(xxx_ip->v[X] * mm2local), INTCLAMP(xxx_ip->v[Y] * mm2local), INTCLAMP(xxx_ip->v[Z] * mm2local)); bu_vls_strcat(str, buf); return 0; }
/** * Make human-readable formatted presentation of this solid. First * line describes type of solid. Additional lines are indented one * tab, and give parameter values. */ int rt_revolve_describe(struct bu_vls *str, const struct rt_db_internal *ip, int verbose, double mm2local) { struct rt_revolve_internal *rip = (struct rt_revolve_internal *)ip->idb_ptr; char buf[256]; RT_REVOLVE_CK_MAGIC(rip); bu_vls_strcat(str, "truncated general revolve (REVOLVE)\n"); if (!verbose) return 0; sprintf(buf, "\tV (%g, %g, %g)\n", INTCLAMP(rip->v3d[X] * mm2local), INTCLAMP(rip->v3d[Y] * mm2local), INTCLAMP(rip->v3d[Z] * mm2local)); bu_vls_strcat(str, buf); sprintf(buf, "\tAxis (%g, %g, %g)\n", INTCLAMP(rip->axis3d[X] * mm2local), INTCLAMP(rip->axis3d[Y] * mm2local), INTCLAMP(rip->axis3d[Z] * mm2local)); bu_vls_strcat(str, buf); sprintf(buf, "\tR (%g, %g, %g)\n", INTCLAMP(rip->r[X] * mm2local), INTCLAMP(rip->r[Y] * mm2local), INTCLAMP(rip->r[Z] * mm2local)); bu_vls_strcat(str, buf); sprintf(buf, "\tAngle=%g\n", INTCLAMP(rip->ang * RAD2DEG)); bu_vls_strcat(str, buf); sprintf(buf, "\tsketch name: "); bu_vls_strcat(str, buf); bu_vls_vlscat(str, &rip->sketch_name); return 0; }
/** * Make human-readable formatted presentation of this solid. First * line describes type of solid. Additional lines are indented one * tab, and give parameter values. */ int rt_superell_describe(struct bu_vls *str, const struct rt_db_internal *ip, int verbose, double mm2local) { struct rt_superell_internal *tip = (struct rt_superell_internal *)ip->idb_ptr; fastf_t mag_a, mag_b, mag_c; char buf[256]; double angles[5]; vect_t unitv; RT_SUPERELL_CK_MAGIC(tip); bu_vls_strcat(str, "superellipsoid (SUPERELL)\n"); sprintf(buf, "\tV (%g, %g, %g)\n", INTCLAMP(tip->v[X] * mm2local), INTCLAMP(tip->v[Y] * mm2local), INTCLAMP(tip->v[Z] * mm2local)); bu_vls_strcat(str, buf); mag_a = MAGNITUDE(tip->a); mag_b = MAGNITUDE(tip->b); mag_c = MAGNITUDE(tip->c); sprintf(buf, "\tA (%g, %g, %g) mag=%g\n", INTCLAMP(tip->a[X] * mm2local), INTCLAMP(tip->a[Y] * mm2local), INTCLAMP(tip->a[Z] * mm2local), INTCLAMP(mag_a * mm2local)); bu_vls_strcat(str, buf); sprintf(buf, "\tB (%g, %g, %g) mag=%g\n", INTCLAMP(tip->b[X] * mm2local), INTCLAMP(tip->b[Y] * mm2local), INTCLAMP(tip->b[Z] * mm2local), INTCLAMP(mag_b * mm2local)); bu_vls_strcat(str, buf); sprintf(buf, "\tC (%g, %g, %g) mag=%g\n", INTCLAMP(tip->c[X] * mm2local), INTCLAMP(tip->c[Y] * mm2local), INTCLAMP(tip->c[Z] * mm2local), INTCLAMP(mag_c * mm2local)); bu_vls_strcat(str, buf); sprintf(buf, "\t<n, e> (%g, %g)\n", INTCLAMP(tip->n), INTCLAMP(tip->e)); bu_vls_strcat(str, buf); if (!verbose) return 0; VSCALE(unitv, tip->a, 1/mag_a); rt_find_fallback_angle(angles, unitv); rt_pr_fallback_angle(str, "\tA", angles); VSCALE(unitv, tip->b, 1/mag_b); rt_find_fallback_angle(angles, unitv); rt_pr_fallback_angle(str, "\tB", angles); VSCALE(unitv, tip->c, 1/mag_c); rt_find_fallback_angle(angles, unitv); rt_pr_fallback_angle(str, "\tC", angles); return 0; }