BRL-CAD
pr.c
Go to the documentation of this file.
1 /* P R . C
2  * BRL-CAD
3  *
4  * Copyright (c) 1993-2014 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 /** @addtogroup librt */
21 /** @{ */
22 /** @file librt/pr.c
23  *
24  * Routines to print LIBRT data structures using bu_log().
25  *
26  */
27 /** @} */
28 
29 #include "common.h"
30 
31 #include <math.h>
32 #include <string.h>
33 #include "bio.h"
34 
35 #include "vmath.h"
36 
37 #include "raytrace.h"
38 
39 
40 void
41 rt_pr_soltab(register const struct soltab *stp)
42 {
43  register int id = stp->st_id;
44 
45  if (id <= 0 || id > ID_MAX_SOLID) {
46  bu_log("stp=%p, id=%d.\n", (void *)stp, id);
47  bu_bomb("rt_pr_soltab: bad id");
48  }
49  bu_log("------------ %s (bit %ld) %s ------------\n",
50  stp->st_dp->d_namep, stp->st_bit,
51  OBJ[id].ft_name);
52  VPRINT("Bound Sph CENTER", stp->st_center);
53  bu_log("Approx Sph Radius = %g\n", INTCLAMP(stp->st_aradius));
54  bu_log("Bounding Sph Radius = %g\n", INTCLAMP(stp->st_bradius));
55  VPRINT("Bound RPP min", stp->st_min);
56  VPRINT("Bound RPP max", stp->st_max);
57  bu_pr_ptbl("st_regions", &stp->st_regions, 1);
58  if (OBJ[id].ft_print)
59  OBJ[id].ft_print(stp);
60 }
61 
62 
63 void
64 rt_pr_region(register const struct region *rp)
65 {
66  struct bu_vls v = BU_VLS_INIT_ZERO;
67 
68  RT_CK_REGION(rp);
69 
70  bu_log("REGION %s (bit %d)\n", rp->reg_name, rp->reg_bit);
71  bu_log("instnum=%ld, id=%d, air=%d, gift_material=%d, los=%d\n",
72  rp->reg_instnum,
73  rp->reg_regionid, rp->reg_aircode,
74  rp->reg_gmater, rp->reg_los);
76  bu_log("reg_is_fastgen = %s mode\n",
78  "plate" : "volume");
79  }
80  if (rp->reg_mater.ma_color_valid)
81  bu_log("Color %d %d %d\n",
82  (int)rp->reg_mater.ma_color[0]*255,
83  (int)rp->reg_mater.ma_color[1]*255,
84  (int)rp->reg_mater.ma_color[2]*255);
85  if (rp->reg_mater.ma_temperature > 0)
86  bu_log("Temperature %g degrees K\n", INTCLAMP(rp->reg_mater.ma_temperature));
87  if (rp->reg_mater.ma_shader && rp->reg_mater.ma_shader[0] != '\0')
88  bu_log("Shader '%s'\n", rp->reg_mater.ma_shader);
89 
90  rt_pr_tree_vls(&v, rp->reg_treetop);
91  bu_log("%s %ld %s\n", rp->reg_name,
92  rp->reg_instnum, bu_vls_addr(&v));
93  bu_vls_free(&v);
94 }
95 
96 
97 void
98 rt_pr_partitions(const struct rt_i *rtip, register const struct partition *phead, const char *title)
99 {
100  register const struct partition *pp;
101  struct bu_vls v = BU_VLS_INIT_ZERO;
102 
103  RT_CHECK_RTI(rtip);
104 
105  bu_log_indent_vls(&v);
106  bu_vls_strcat(&v, "------");
107  bu_vls_strcat(&v, title);
108  bu_vls_strcat(&v, "\n");
110 
111  for (pp = phead->pt_forw; pp != phead; pp = pp->pt_forw) {
112  RT_CHECK_PT(pp);
113  rt_pr_pt_vls(&v, rtip, pp);
114  }
116  bu_log_indent_vls(&v);
117  bu_vls_strcat(&v, "------\n");
118 
119  bu_log("%s", bu_vls_addr(&v));
120  bu_vls_free(&v);
121 }
122 
123 
124 void
125 rt_pr_pt_vls(struct bu_vls *v, const struct rt_i *rtip, register const struct partition *pp)
126 {
127  register const struct soltab *stp;
128  register struct seg **segpp;
129 
130  RT_CHECK_RTI(rtip);
131  RT_CHECK_PT(pp);
132  BU_CK_VLS(v);
133 
135  bu_vls_printf(v, "%p: PT ", (void *)pp);
136 
137  stp = pp->pt_inseg->seg_stp;
138  bu_vls_printf(v, "%s (%s#%ld) ",
139  stp->st_dp->d_namep,
140  OBJ[stp->st_id].ft_name+3,
141  stp->st_bit);
142 
143  stp = pp->pt_outseg->seg_stp;
144  bu_vls_printf(v, "%s (%s#%ld) ",
145  stp->st_dp->d_namep,
146  OBJ[stp->st_id].ft_name+3,
147  stp->st_bit);
148 
149  bu_vls_printf(v, "(%g, %g)",
150  pp->pt_inhit->hit_dist, pp->pt_outhit->hit_dist);
151  if (pp->pt_inflip) bu_vls_strcat(v, " Iflip");
152  if (pp->pt_outflip) bu_vls_strcat(v, " Oflip");
153  bu_vls_strcat(v, "\n");
154 
155  rt_pr_hit_vls(v, " In", pp->pt_inhit);
156  rt_pr_hit_vls(v, " Out", pp->pt_outhit);
158  bu_vls_strcat(v, " Primitives: ");
159  for (BU_PTBL_FOR(segpp, (struct seg **), &pp->pt_seglist)) {
160  stp = (*segpp)->seg_stp;
161  RT_CK_SOLTAB(stp);
162  bu_vls_strcat(v, stp->st_dp->d_namep);
163  bu_vls_strcat(v, ", ");
164  }
165  bu_vls_strcat(v, "\n");
166 
168  bu_vls_strcat(v, " Untrimmed Segments spanning this interval:\n");
170  for (BU_PTBL_FOR(segpp, (struct seg **), &pp->pt_seglist)) {
171  RT_CK_SEG(*segpp);
172  rt_pr_seg_vls(v, *segpp);
173  }
175 
176  if (pp->pt_regionp) {
179  bu_vls_printf(v, " Region: %s\n", pp->pt_regionp->reg_name);
180  }
181 }
182 
183 
184 void
185 rt_pr_pt(const struct rt_i *rtip, register const struct partition *pp)
186 {
187  struct bu_vls v = BU_VLS_INIT_ZERO;
188 
189  RT_CHECK_RTI(rtip);
190  RT_CHECK_PT(pp);
191  rt_pr_pt_vls(&v, rtip, pp);
192  bu_log("%s", bu_vls_addr(&v));
193  bu_vls_free(&v);
194 }
195 
196 
197 void
198 rt_pr_seg_vls(struct bu_vls *v, register const struct seg *segp)
199 {
200  BU_CK_VLS(v);
201  RT_CK_SEG(segp);
202 
204  bu_vls_printf(v,
205  "%p: SEG %s (%g, %g) st_bit=%ld xray#=%d\n",
206  (void *)segp,
207  segp->seg_stp->st_dp->d_namep,
208  segp->seg_in.hit_dist,
209  segp->seg_out.hit_dist,
210  segp->seg_stp->st_bit,
211  segp->seg_in.hit_rayp->index);
212 }
213 
214 
215 void
216 rt_pr_seg(register const struct seg *segp)
217 {
218  struct bu_vls v = BU_VLS_INIT_ZERO;
219 
220  RT_CK_SEG(segp);
221 
222  rt_pr_seg_vls(&v, segp);
223  bu_log("%s", bu_vls_addr(&v));
224  bu_vls_free(&v);
225 }
226 
227 
228 void
229 rt_pr_hit(const char *str, register const struct hit *hitp)
230 {
231  struct bu_vls v = BU_VLS_INIT_ZERO;
232 
233  RT_CK_HIT(hitp);
234 
235  rt_pr_hit_vls(&v, str, hitp);
236  bu_log("%s", bu_vls_addr(&v));
237  bu_vls_free(&v);
238 }
239 
240 
241 void
242 rt_pr_hit_vls(struct bu_vls *v, const char *str, register const struct hit *hitp)
243 {
244  BU_CK_VLS(v);
245  RT_CK_HIT(hitp);
246 
248  bu_vls_strcat(v, str);
249 
250  bu_vls_printf(v, "HIT dist=%g (surf %d)\n",
251  hitp->hit_dist, hitp->hit_surfno);
252 }
253 
254 
255 void
256 rt_pr_hitarray_vls(struct bu_vls *v, const char *str, register const struct hit *hitp, int count)
257 {
258  int i;
259 
260  BU_CK_VLS(v);
261  RT_CK_HIT(hitp);
262 
264  bu_vls_strcat(v, str);
265 
266  for (i=0; i<count; i++, hitp++) {
267  bu_vls_printf(v, "HIT%d dist=%g (surf %d)\n", i,
268  hitp->hit_dist, hitp->hit_surfno);
269  }
270 }
271 
272 
273 /**
274  * Warning: This function uses recursion rather than iteration and a
275  * stack, to preserve simplicity. On machines with limited stack
276  * space, such as the Gould, this subroutine may overwhelm the stack
277  * on complex expressions.
278  */
279 void
280 rt_pr_tree(register const union tree *tp, int lvl)
281 
282 /* recursion level */
283 {
284  register int i;
285 
286  RT_CK_TREE(tp);
287 
288  bu_log("%p ", (void *)tp);
289  for (i=lvl; i>0; i--)
290  bu_log(" ");
291 
292  if (tp == TREE_NULL) {
293  bu_log("Null???\n");
294  return;
295  }
296 
297  switch (tp->tr_op) {
298 
299  case OP_NOP:
300  bu_log("NOP\n");
301  return;
302 
303  case OP_SOLID:
304  bu_log("SOLID %s (bit %ld)\n",
305  tp->tr_a.tu_stp->st_dp->d_namep,
306  tp->tr_a.tu_stp->st_bit);
307  return;
308 
309  case OP_REGION:
310  bu_log("REGION ctsp=%p\n", (void *)tp->tr_c.tc_ctsp);
312  return;
313 
314  case OP_DB_LEAF:
315  bu_log("DB_LEAF %s%s\n",
316  tp->tr_l.tl_name,
317  tp->tr_l.tl_mat ? " (matrix)" : "");
318  return;
319 
320  default:
321  bu_log("Unknown op=x%x\n", tp->tr_op);
322  return;
323 
324  case OP_UNION:
325  bu_log("UNION\n");
326  break;
327  case OP_INTERSECT:
328  bu_log("INTERSECT\n");
329  break;
330  case OP_SUBTRACT:
331  bu_log("MINUS\n");
332  break;
333  case OP_XOR:
334  bu_log("XOR\n");
335  break;
336  case OP_NOT:
337  bu_log("NOT\n");
338  break;
339  }
340 
341  switch (tp->tr_op) {
342  case OP_UNION:
343  case OP_INTERSECT:
344  case OP_SUBTRACT:
345  case OP_XOR:
346  /* BINARY type */
347  rt_pr_tree(tp->tr_b.tb_left, lvl+1);
348  rt_pr_tree(tp->tr_b.tb_right, lvl+1);
349  break;
350  case OP_NOT:
351  case OP_GUARD:
352  case OP_XNOP:
353  /* UNARY tree */
354  rt_pr_tree(tp->tr_b.tb_left, lvl+1);
355  break;
356  }
357 }
358 
359 
360 /**
361  * Produce a compact representation of this tree. The destination vls
362  * must be initialized by the caller.
363  *
364  * Operations are responsible for generating white space.
365  */
366 void
367 rt_pr_tree_vls(struct bu_vls *vls, register const union tree *tp)
368 {
369  char *str;
370 
371  if (tp == TREE_NULL) {
372  bu_vls_strcat(vls, "??NULL_tree??");
373  return;
374  }
375 
376  switch (tp->tr_op) {
377 
378  case OP_NOP:
379  bu_vls_strcat(vls, "NOP");
380  return;
381 
382  case OP_SOLID:
383  bu_vls_strcat(vls, tp->tr_a.tu_stp->st_dp->d_namep);
384  return;
385 
386  case OP_REGION:
387  str = db_path_to_string(&(tp->tr_c.tc_ctsp->cts_p));
388  bu_vls_strcat(vls, str);
389  bu_free(str, "path string");
390  return;
391 
392  case OP_DB_LEAF:
393  bu_vls_strcat(vls, tp->tr_l.tl_name);
394  return;
395 
396  default:
397  bu_log("rt_pr_tree_vls() Unknown op=x%x\n", tp->tr_op);
398  return;
399 
400  case OP_UNION:
401  /* BINARY type */
402  bu_vls_strcat(vls, " (");
403  rt_pr_tree_vls(vls, tp->tr_b.tb_left);
404  bu_vls_printf(vls, ") %c (", DB_OP_UNION);
405  rt_pr_tree_vls(vls, tp->tr_b.tb_right);
406  bu_vls_strcat(vls, ") ");
407  break;
408  case OP_INTERSECT:
409  /* BINARY type */
410  bu_vls_strcat(vls, " (");
411  rt_pr_tree_vls(vls, tp->tr_b.tb_left);
412  bu_vls_printf(vls, ") %c (", DB_OP_INTERSECT);
413  rt_pr_tree_vls(vls, tp->tr_b.tb_right);
414  bu_vls_strcat(vls, ") ");
415  break;
416  case OP_SUBTRACT:
417  /* BINARY type */
418  bu_vls_strcat(vls, " (");
419  rt_pr_tree_vls(vls, tp->tr_b.tb_left);
420  bu_vls_printf(vls, ") %c (", DB_OP_SUBTRACT);
421  rt_pr_tree_vls(vls, tp->tr_b.tb_right);
422  bu_vls_strcat(vls, ") ");
423  break;
424  case OP_XOR:
425  /* BINARY type */
426  bu_vls_strcat(vls, " (");
427  rt_pr_tree_vls(vls, tp->tr_b.tb_left);
428  bu_vls_strcat(vls, ") ^ (");
429  rt_pr_tree_vls(vls, tp->tr_b.tb_right);
430  bu_vls_strcat(vls, ") ");
431  break;
432  case OP_NOT:
433  /* UNARY tree */
434  bu_vls_strcat(vls, " !(");
435  rt_pr_tree_vls(vls, tp->tr_b.tb_left);
436  bu_vls_strcat(vls, ") ");
437  break;
438  case OP_GUARD:
439  /* UNARY tree */
440  bu_vls_strcat(vls, " guard(");
441  rt_pr_tree_vls(vls, tp->tr_b.tb_left);
442  bu_vls_strcat(vls, ") ");
443  break;
444  case OP_XNOP:
445  /* UNARY tree */
446  bu_vls_strcat(vls, " xnop(");
447  rt_pr_tree_vls(vls, tp->tr_b.tb_left);
448  bu_vls_strcat(vls, ") ");
449  break;
450  }
451 }
452 
453 
454 /**
455  * JRA's tree pretty-printer. Formats the tree compactly into a
456  * dynamically allocated string. Uses recursion and lots of
457  * malloc/free activity.
458  */
459 char *
460 rt_pr_tree_str(const union tree *tree)
461 {
462  char *left, *right;
463  char *return_str;
464  char op = OP_GUARD;
465  size_t return_length;
466 
467  if (tree == NULL)
468  return bu_strdup("NULL_ptr");
469  RT_CK_TREE(tree);
470  if (tree->tr_op == OP_UNION || tree->tr_op == OP_SUBTRACT || tree->tr_op == OP_INTERSECT) {
471  char *blankl, *blankr;
472 
473  left = rt_pr_tree_str(tree->tr_b.tb_left);
474  right = rt_pr_tree_str(tree->tr_b.tb_right);
475  switch (tree->tr_op) {
476  case OP_UNION:
477  op = DB_OP_UNION;
478  break;
479  case OP_SUBTRACT:
480  op = DB_OP_SUBTRACT;
481  break;
482  case OP_INTERSECT:
483  op = DB_OP_INTERSECT;
484  break;
485  }
486  return_length = strlen(left) + strlen(right) + 8;
487  return_str = (char *)bu_malloc(return_length, "rt_pr_tree_str: return string");
488 
489  blankl = strchr(left, ' ');
490  blankr = strchr(right, ' ');
491  if (blankl && blankr)
492  snprintf(return_str, return_length, "(%s) %c (%s)", left, op, right);
493  else if (blankl && !blankr)
494  snprintf(return_str, return_length, "(%s) %c %s", left, op, right);
495  else if (!blankl && blankr)
496  snprintf(return_str, return_length, "%s %c (%s)", left, op, right);
497  else
498  snprintf(return_str, return_length, "%s %c %s", left, op, right);
499 
500  if (tree->tr_b.tb_left->tr_op != OP_DB_LEAF)
501  bu_free((void *)left, "rt_pr_tree_str: left string");
502  if (tree->tr_b.tb_right->tr_op != OP_DB_LEAF)
503  bu_free((void *)right, "rt_pr_tree_str: right string");
504  return return_str;
505  } else if (tree->tr_op == OP_DB_LEAF)
506  return bu_strdup(tree->tr_l.tl_name);
507  else if (tree->tr_op == OP_REGION)
508  return db_path_to_string(&tree->tr_c.tc_ctsp->cts_p);
509  else if (tree->tr_op == OP_SOLID) {
510  RT_CK_SOLTAB(tree->tr_a.tu_stp);
511  return bu_strdup(tree->tr_a.tu_stp->st_dp->d_namep);
512  }
513 
514 
515  return bu_strdup("Unknown:tr_op");
516 }
517 
518 
519 /**
520  * Print the actual values of the terms in a boolean expression.
521  *
522  * The values for pr_name determine the printing action:
523  * 0 bit value
524  * 1 name
525  * 2 bit number
526  */
527 void
528 rt_pr_tree_val(register const union tree *tp, const struct partition *partp, int pr_name, int lvl)
529 /* Tree to print */
530 /* Partition to evaluate */
531 /* 1=print name, 0=print value */
532 /* Recursion level */
533 {
534 
535  if (lvl == 0) {
536  switch (pr_name) {
537  default:
538  bu_log("tree val: ");
539  break;
540  case 1:
541  bu_log("tree primitives: ");
542  break;
543  case 2:
544  bu_log("tree primitive bits: ");
545  break;
546  }
547  }
548 
549  if (tp == TREE_NULL) {
550  bu_log("Null???\n");
551  return;
552  }
553 
554  switch (tp->tr_op) {
555  default:
556  bu_log("Unknown_op=x%x", tp->tr_op);
557  break;
558 
559  case OP_SOLID:
560  switch (pr_name) {
561  case 0:
562  {
563  register struct soltab *seek_stp = tp->tr_a.tu_stp;
564  register struct seg **segpp;
565  for (BU_PTBL_FOR(segpp, (struct seg **), &partp->pt_seglist)) {
566  if ((*segpp)->seg_stp == seek_stp) {
567  bu_log("1");
568  goto out;
569  }
570  }
571  bu_log("0");
572  }
573  break;
574  case 1:
575  bu_log("%s", tp->tr_a.tu_stp->st_dp->d_namep);
576  break;
577  case 2:
578  bu_log("%ld", tp->tr_a.tu_stp->st_bit);
579  break;
580  }
581  break;
582 
583 
584  case OP_UNION:
585  bu_log("(");
586  rt_pr_tree_val(tp->tr_b.tb_left, partp, pr_name, lvl+1);
587  bu_log(" %c ", DB_OP_UNION);
588  rt_pr_tree_val(tp->tr_b.tb_right, partp, pr_name, lvl+1);
589  bu_log(")");
590  break;
591  case OP_INTERSECT:
592  bu_log("(");
593  rt_pr_tree_val(tp->tr_b.tb_left, partp, pr_name, lvl+1);
594  bu_log(" %c ", DB_OP_INTERSECT);
595  rt_pr_tree_val(tp->tr_b.tb_right, partp, pr_name, lvl+1);
596  bu_log(")");
597  break;
598  case OP_SUBTRACT:
599  bu_log("(");
600  rt_pr_tree_val(tp->tr_b.tb_left, partp, pr_name, lvl+1);
601  bu_log(" %c ", DB_OP_SUBTRACT);
602  rt_pr_tree_val(tp->tr_b.tb_right, partp, pr_name, lvl+1);
603  bu_log(")");
604  break;
605  case OP_XOR:
606  bu_log("(");
607  rt_pr_tree_val(tp->tr_b.tb_left, partp, pr_name, lvl+1);
608  bu_log(" XOR ");
609  rt_pr_tree_val(tp->tr_b.tb_right, partp, pr_name, lvl+1);
610  bu_log(")");
611  break;
612 
613  case OP_NOT:
614  bu_log(" !");
615  rt_pr_tree_val(tp->tr_b.tb_left, partp, pr_name, lvl+1);
616  break;
617  case OP_GUARD:
618  bu_log(" GUARD ");
619  rt_pr_tree_val(tp->tr_b.tb_left, partp, pr_name, lvl+1);
620  break;
621  }
622 
623 out:
624  if (lvl == 0) bu_log("\n");
625 }
626 
627 
628 void
629 rt_pr_fallback_angle(struct bu_vls *str, const char *prefix, const double *angles)
630 {
631  BU_CK_VLS(str);
632 
633  bu_vls_printf(str, "%s direction cosines=(%1.f, %1.f, %1.f)\n",
634  prefix, INTCLAMP(angles[0]), INTCLAMP(angles[1]), INTCLAMP(angles[2]));
635 
636  bu_vls_printf(str, "%s rotation angle=%1.f, fallback angle=%1.f\n",
637  prefix, INTCLAMP(angles[3]), INTCLAMP(angles[4]));
638 }
639 
640 
641 /**
642  * In degrees.
643  */
644 void
645 rt_find_fallback_angle(double *angles, const fastf_t *vec)
646 {
647  register double f;
648  double asinZ;
649 
650  /* convert direction cosines into axis angles */
651  if (vec[X] <= -1.0) {
652  angles[X] = 180.0;
653  } else if (vec[X] >= 1.0) {
654  angles[X] = 0.0;
655  } else {
656  angles[X] = acos(vec[X]) * RAD2DEG;
657  }
658 
659  if (vec[Y] <= -1.0) {
660  angles[Y] = 180.0;
661  } else if (vec[Y] >= 1.0) {
662  angles[Y] = 0.0;
663  } else {
664  angles[Y] = acos(vec[Y]) * RAD2DEG;
665  }
666 
667  if (vec[Z] <= -1.0) {
668  angles[Z] = 180.0;
669  } else if (vec[Z] >= 1.0) {
670  angles[Z] = 0.0;
671  } else {
672  angles[Z] = acos(vec[Z]) * RAD2DEG;
673  }
674 
675  /* fallback angle */
676  if (vec[Z] <= -1.0) {
677  /* 270 degrees: 3/2 pi */
678  asinZ = M_PI_2 * 3;
679  } else if (vec[Z] >= 1.0) {
680  /* +90 degrees: 1/2 pi */
681  asinZ = M_PI_2;
682  } else {
683  asinZ = asin(vec[Z]);
684  }
685  angles[4] = asinZ * RAD2DEG;
686 
687  /* rotation angle */
688  /* For the tolerance below, on an SGI 4D/70, cos(asin(1.0)) != 0.0
689  * with an epsilon of +/- 1.0e-17, so the tolerance below was
690  * substituted for the original +/- 1.0e-20.
691  */
692  if ((f = cos(asinZ)) > 1.0e-16 || f < -1.0e-16) {
693  f = vec[X]/f;
694  if (f <= -1.0) {
695  angles[3] = 180;
696  } else if (f >= 1.0) {
697  angles[3] = 0;
698  } else {
699  angles[3] = RAD2DEG * acos(f);
700  }
701  } else {
702  angles[3] = 0.0;
703  }
704  if (vec[Y] < 0) {
705  angles[3] = 360.0 - angles[3];
706  }
707 }
708 
709 
710 /**
711  * Print a tolerance structure.
712  */
713 void
714 rt_pr_tol(const struct bn_tol *tol)
715 {
716  BN_CK_TOL(tol);
717 
718  bu_log("%p TOL %e (sq=%e) perp=%e, para=%e\n",
719  (void *)tol, tol->dist, tol->dist_sq,
720  tol->perp, tol->para);
721 }
722 
723 
724 void
725 rt_pr_uvcoord(const struct uvcoord *uvp)
726 {
727  bu_log("u, v=(%g, %g), du, dv=(%g, %g)\n",
728  INTCLAMP(uvp->uv_u), INTCLAMP(uvp->uv_v),
729  INTCLAMP(uvp->uv_du), INTCLAMP(uvp->uv_dv));
730 }
731 
732 
733 /*
734  * Local Variables:
735  * mode: C
736  * tab-width: 8
737  * indent-tabs-mode: t
738  * c-file-style: "stroustrup"
739  * End:
740  * ex: shiftwidth=4 tabstop=8
741  */
void rt_pr_hitarray_vls(struct bu_vls *v, const char *str, register const struct hit *hitp, int count)
Definition: pr.c:256
void rt_pr_region(register const struct region *rp)
Definition: pr.c:64
char * d_namep
pointer to name string
Definition: raytrace.h:859
int reg_bit
constant index into Regions[]
Definition: raytrace.h:541
void rt_pr_partitions(const struct rt_i *rtip, register const struct partition *phead, const char *title)
Definition: pr.c:98
void bu_log(const char *,...) _BU_ATTR_PRINTF12
Definition: log.c:176
struct region * pt_regionp
ptr to containing region
Definition: raytrace.h:580
struct hit * pt_outhit
OUT hit ptr.
Definition: raytrace.h:579
void rt_pr_seg_vls(struct bu_vls *v, register const struct seg *segp)
Definition: pr.c:198
struct hit seg_in
IN information.
Definition: raytrace.h:370
void rt_pr_uvcoord(const struct uvcoord *uvp)
Definition: pr.c:725
struct tree::tree_cts tr_c
const struct directory * st_dp
Directory entry of solid.
Definition: raytrace.h:436
#define REGION_FASTGEN_PLATE
Definition: raytrace.h:554
void rt_pr_tree_vls(struct bu_vls *vls, register const union tree *tp)
Definition: pr.c:367
#define OP_NOP
Leaf with no effect.
Definition: raytrace.h:1132
float ma_temperature
positive ==> degrees Kelvin
Definition: raytrace.h:523
double dist
>= 0
Definition: tol.h:73
fastf_t uv_u
Range 0..1.
Definition: raytrace.h:341
#define BU_PTBL_FOR(ip, cast, ptbl)
Definition: ptbl.h:125
struct soltab * seg_stp
pointer back to soltab
Definition: raytrace.h:372
void bu_vls_strcat(struct bu_vls *vp, const char *s)
Definition: vls.c:368
#define OP_XOR
Binary: L xor R, not both.
Definition: raytrace.h:1130
#define RT_CK_SEG(_p)
Definition: raytrace.h:377
void rt_pr_hit(const char *str, register const struct hit *hitp)
Definition: pr.c:229
double dist_sq
dist * dist
Definition: tol.h:74
Definition: raytrace.h:368
void rt_pr_fallback_angle(struct bu_vls *str, const char *prefix, const double *angles)
Definition: pr.c:629
Definition: raytrace.h:248
struct combined_tree_state * tc_ctsp
Definition: raytrace.h:1162
fastf_t st_aradius
Radius of APPROXIMATING sphere.
Definition: raytrace.h:433
void bu_log_indent_vls(struct bu_vls *v)
Definition: log.c:62
char pt_inflip
flip inhit->hit_normal
Definition: raytrace.h:581
Header file for the BRL-CAD common definitions.
#define OP_XNOP
Unary: L, mark region.
Definition: raytrace.h:1136
struct seg * pt_outseg
OUT seg pointer.
Definition: raytrace.h:578
const char * reg_name
Identifying string.
Definition: raytrace.h:539
char ma_color_valid
non-0 ==> ma_color is non-default
Definition: raytrace.h:524
char pt_outflip
flip outhit->hit_normal
Definition: raytrace.h:582
struct db_full_path cts_p
Definition: raytrace.h:1117
int index
Which ray of a bundle.
Definition: raytrace.h:217
void bu_log_indent_delta(int delta)
Definition: log.c:54
#define RT_CK_REGION(_p)
Definition: raytrace.h:559
struct hit * pt_inhit
IN hit pointer.
Definition: raytrace.h:577
void rt_pr_seg(register const struct seg *segp)
Definition: pr.c:216
void rt_pr_tol(const struct bn_tol *tol)
Definition: pr.c:714
union tree * tb_left
Definition: raytrace.h:1149
struct soltab * tu_stp
Definition: raytrace.h:1156
void * bu_malloc(size_t siz, const char *str)
Definition: malloc.c:314
void rt_pr_hit_vls(struct bu_vls *v, const char *str, register const struct hit *hitp)
Definition: pr.c:242
long st_bit
solids bit vector index (const)
Definition: raytrace.h:439
char * strchr(const char *sp, int c)
void bu_vls_free(struct bu_vls *vp)
Definition: vls.c:248
#define OP_SUBTRACT
Binary: L subtract R.
Definition: raytrace.h:1129
Definition: color.c:49
struct bu_ptbl pt_seglist
all segs in this partition
Definition: raytrace.h:584
#define BU_CK_VLS(_vp)
Definition: vls.h:69
short reg_is_fastgen
FASTGEN-compatibility mode?
Definition: raytrace.h:552
#define OP_INTERSECT
Binary: L intersect R.
Definition: raytrace.h:1128
void bu_pr_ptbl(const char *title, const struct bu_ptbl *tbl, int verbose)
Definition: ptbl.c:241
int reg_los
approximate line-of-sight thickness equivalence
Definition: raytrace.h:545
#define OP_DB_LEAF
Leaf of combination, db fmt.
Definition: raytrace.h:1139
fastf_t st_bradius
Radius of BOUNDING sphere.
Definition: raytrace.h:434
#define RT_CK_HIT(_p)
Definition: raytrace.h:259
int reg_regionid
Region ID code. If <=0, use reg_aircode.
Definition: raytrace.h:542
#define RT_CHECK_RTI(_p)
Definition: raytrace.h:1832
fastf_t uv_dv
delta in v
Definition: raytrace.h:344
#define TREE_NULL
Definition: raytrace.h:1181
struct seg * pt_inseg
IN seg ptr (gives stp)
Definition: raytrace.h:576
point_t st_max
max X, Y, Z of bounding RPP
Definition: raytrace.h:438
struct hit seg_out
OUT information.
Definition: raytrace.h:371
matp_t tl_mat
xform matp, NULL ==> identity
Definition: raytrace.h:1173
int reg_gmater
GIFT Material code.
Definition: raytrace.h:544
char * ma_shader
shader name & parms
Definition: raytrace.h:527
struct xray * hit_rayp
pointer to defining ray
Definition: raytrace.h:256
char * tl_name
Name of this leaf (bu_strdup'ed)
Definition: raytrace.h:1174
#define OP_REGION
Leaf: tr_stp -> combined_tree_state.
Definition: raytrace.h:1131
struct tree::tree_node tr_b
char ft_name[17]
Definition: raytrace.h:2043
#define OP_GUARD
Unary: not L, or else!
Definition: raytrace.h:1135
goto out
Definition: nmg_mod.c:3846
Support for uniform tolerances.
Definition: tol.h:71
#define BN_CK_TOL(_p)
Definition: tol.h:82
char * db_path_to_string(const struct db_full_path *pp)
Definition: db_fullpath.c:191
char * bu_vls_addr(const struct bu_vls *vp)
Definition: vls.c:111
void rt_pr_pt(const struct rt_i *rtip, register const struct partition *pp)
Definition: pr.c:185
struct bu_ptbl st_regions
ptrs to regions using this solid (const)
Definition: raytrace.h:440
float ma_color[3]
explicit color: 0..1
Definition: raytrace.h:522
double perp
nearly 0
Definition: tol.h:75
struct tree::tree_db_leaf tr_l
struct mater_info reg_mater
Real material information.
Definition: raytrace.h:546
union tree * tb_right
Definition: raytrace.h:1150
point_t st_min
min X, Y, Z of bounding RPP
Definition: raytrace.h:437
#define REGION_NON_FASTGEN
Definition: raytrace.h:553
long reg_instnum
instance number, from d_uses
Definition: raytrace.h:550
int reg_aircode
Region ID AIR code.
Definition: raytrace.h:543
void rt_pr_tree_val(register const union tree *tp, const struct partition *partp, int pr_name, int lvl)
Definition: pr.c:528
const struct rt_functab OBJ[]
Definition: table.c:159
Definition: op.h:35
void(* ft_print)(const struct soltab *stp)
Definition: raytrace.h:2058
#define RT_CK_SOLTAB(_p)
Definition: raytrace.h:453
void bu_vls_printf(struct bu_vls *vls, const char *fmt,...) _BU_ATTR_PRINTF23
Definition: vls.c:694
fastf_t uv_du
delta in u
Definition: raytrace.h:343
char * rt_pr_tree_str(const union tree *tree)
Definition: pr.c:460
union tree * reg_treetop
Pointer to boolean tree.
Definition: raytrace.h:540
Definition: color.c:51
int hit_surfno
solid-specific surface indicator
Definition: raytrace.h:255
void bu_free(void *ptr, const char *str)
Definition: malloc.c:328
#define RT_CK_TREE(_p)
Definition: raytrace.h:1182
void rt_find_fallback_angle(double *angles, const fastf_t *vec)
Definition: pr.c:645
#define OP_SOLID
Leaf: tr_stp -> solid.
Definition: raytrace.h:1126
void rt_pr_soltab(register const struct soltab *stp)
Definition: pr.c:41
#define BU_VLS_INIT_ZERO
Definition: vls.h:84
int st_id
Solid ident.
Definition: raytrace.h:431
struct partition * pt_forw
forwards link
Definition: raytrace.h:574
#define RT_CHECK_PT(_p)
compat
Definition: raytrace.h:588
#define ID_MAX_SOLID
Maximum defined ID_xxx for solids.
Definition: raytrace.h:494
fastf_t hit_dist
dist from r_pt to hit_point
Definition: raytrace.h:250
Definition: vls.h:56
void bu_bomb(const char *str) _BU_ATTR_NORETURN
Definition: bomb.c:91
double fastf_t
Definition: defines.h:300
#define OP_UNION
Binary: L union R.
Definition: raytrace.h:1127
#define VPRINT(a, b)
Definition: raytrace.h:1881
#define OP_NOT
Unary: not L.
Definition: raytrace.h:1134
struct tree::tree_leaf tr_a
double para
nearly 1
Definition: tol.h:76
void db_pr_combined_tree_state(const struct combined_tree_state *ctsp)
Definition: db_tree.c:186
void rt_pr_tree(register const union tree *tp, int lvl)
Definition: pr.c:280
Definition: color.c:50
fastf_t uv_v
Range 0..1.
Definition: raytrace.h:342
#define bu_strdup(s)
Definition: str.h:71
point_t st_center
Centroid of solid.
Definition: raytrace.h:432
void rt_pr_pt_vls(struct bu_vls *v, const struct rt_i *rtip, register const struct partition *pp)
Definition: pr.c:125