Revision: 70731
          http://sourceforge.net/p/brlcad/code/70731
Author:   starseeker
Date:     2018-02-23 19:41:15 +0000 (Fri, 23 Feb 2018)
Log Message:
-----------
For diff cataloging, the one-shot nirt output container is inadequate.  Start 
breaking it down into components.

Modified Paths:
--------------
    brlcad/trunk/src/libanalyze/nirt.cxx

Modified: brlcad/trunk/src/libanalyze/nirt.cxx
===================================================================
--- brlcad/trunk/src/libanalyze/nirt.cxx        2018-02-22 20:56:03 UTC (rev 
70730)
+++ brlcad/trunk/src/libanalyze/nirt.cxx        2018-02-23 19:41:15 UTC (rev 
70731)
@@ -154,17 +154,7 @@
 };
 #define NIRT_OVERLAP_NULL ((struct nirt_overlap *)0)
 
-/* This record structure doesn't have to correspond exactly to the above list
- * of available values, but it needs to retain sufficient information to
- * support the ability to generate all of them upon request. */
-struct nirt_output_record {
-    point_t orig;
-    fastf_t h;
-    fastf_t v;
-    fastf_t d_orig;
-    vect_t dir;
-    fastf_t a;
-    fastf_t e;
+struct nirt_seg {
     point_t in;
     fastf_t d_in;
     point_t out;
@@ -203,11 +193,81 @@
     struct bu_vls *attributes;
     point_t gap_in;
     fastf_t gap_los;
+};
+
+void
+_nirt_seg_init(struct nirt_seg **s)
+{
+    if (!s) return;
+
+    BU_GET(*s, struct nirt_seg);
+    BU_GET((*s)->path_name, struct bu_vls);
+    BU_GET((*s)->reg_name, struct bu_vls);
+    BU_GET((*s)->ov_reg1_name, struct bu_vls);
+    BU_GET((*s)->ov_reg2_name, struct bu_vls);
+    BU_GET((*s)->ov_sol_in, struct bu_vls);
+    BU_GET((*s)->ov_sol_out, struct bu_vls);
+    BU_GET((*s)->claimant_list, struct bu_vls);
+    BU_GET((*s)->claimant_listn, struct bu_vls);
+    BU_GET((*s)->attributes, struct bu_vls);
+    bu_vls_init((*s)->path_name);
+    bu_vls_init((*s)->reg_name);
+    bu_vls_init((*s)->ov_reg1_name);
+    bu_vls_init((*s)->ov_reg2_name);
+    bu_vls_init((*s)->ov_sol_in);
+    bu_vls_init((*s)->ov_sol_out);
+    bu_vls_init((*s)->claimant_list);
+    bu_vls_init((*s)->claimant_listn);
+    bu_vls_init((*s)->attributes);
+}
+
+void
+_nirt_seg_free(struct nirt_seg *s)
+{
+    bu_vls_free(s->path_name);
+    bu_vls_free(s->reg_name);
+    bu_vls_free(s->ov_reg1_name);
+    bu_vls_free(s->ov_reg2_name);
+    bu_vls_free(s->ov_sol_in);
+    bu_vls_free(s->ov_sol_out);
+    bu_vls_free(s->claimant_list);
+    bu_vls_free(s->claimant_listn);
+    bu_vls_free(s->attributes);
+
+    BU_PUT(s->path_name, struct bu_vls);
+    BU_PUT(s->reg_name, struct bu_vls);
+    BU_PUT(s->ov_reg1_name, struct bu_vls);
+    BU_PUT(s->ov_reg2_name, struct bu_vls);
+    BU_PUT(s->ov_sol_in, struct bu_vls);
+    BU_PUT(s->ov_sol_out, struct bu_vls);
+    BU_PUT(s->claimant_list, struct bu_vls);
+    BU_PUT(s->claimant_listn, struct bu_vls);
+    BU_PUT(s->attributes, struct bu_vls);
+    BU_PUT(s, struct nirt_seg);
+}
+
+
+/* This record structure doesn't have to correspond exactly to the above list
+ * of available values, but it needs to retain sufficient information to
+ * support the ability to generate all of them upon request. */
+struct nirt_output_record {
+    point_t orig;
+    fastf_t h;
+    fastf_t v;
+    fastf_t d_orig;
+    vect_t dir;
+    fastf_t a;
+    fastf_t e;
     struct nirt_overlap ovlp_list;
+    struct nirt_seg *seg;
 };
 
+struct nirt_diff {
+    point_t orig;
+    vect_t dir;
+    std::vector<struct nirt_seg *> segs;
+};
 
-
 struct nirt_state_impl {
     /* Output options */
     struct bu_color *hit_odd_color;
@@ -1054,58 +1114,58 @@
     nirt_print_key("z_dir", r->dir[Z]);
     nirt_print_key("a", r->a);
     nirt_print_key("e", r->e);
-    nirt_print_key("x_in", r->in[X] * base2local);
-    nirt_print_key("y_in", r->in[Y] * base2local);
-    nirt_print_key("z_in", r->in[Z] * base2local);
-    nirt_print_key("d_in", r->d_in * base2local);
-    nirt_print_key("x_out", r->out[X] * base2local);
-    nirt_print_key("y_out", r->out[Y] * base2local);
-    nirt_print_key("z_out", r->out[Z] * base2local);
-    nirt_print_key("d_out", r->d_out * base2local);
-    nirt_print_key("los", r->los * base2local);
-    nirt_print_key("scaled_los", r->scaled_los * base2local);
-    nirt_print_key("path_name", bu_vls_addr(r->path_name));
-    nirt_print_key("reg_name", bu_vls_addr(r->reg_name));
-    nirt_print_key("reg_id", r->reg_id);
-    nirt_print_key("obliq_in", r->obliq_in);
-    nirt_print_key("obliq_out", r->obliq_out);
-    nirt_print_key("nm_x_in", r->nm_in[X]);
-    nirt_print_key("nm_y_in", r->nm_in[Y]);
-    nirt_print_key("nm_z_in", r->nm_in[Z]);
-    nirt_print_key("nm_d_in", r->nm_d_in);
-    nirt_print_key("nm_h_in", r->nm_h_in);
-    nirt_print_key("nm_v_in", r->nm_v_in);
-    nirt_print_key("nm_x_out", r->nm_out[X]);
-    nirt_print_key("nm_y_out", r->nm_out[Y]);
-    nirt_print_key("nm_z_out", r->nm_out[Z]);
-    nirt_print_key("nm_d_out", r->nm_d_out);
-    nirt_print_key("nm_h_out", r->nm_h_out);
-    nirt_print_key("nm_v_out", r->nm_v_out);
-    nirt_print_key("ov_reg1_name", bu_vls_addr(r->ov_reg1_name));
-    nirt_print_key("ov_reg1_id", r->ov_reg1_id);
-    nirt_print_key("ov_reg2_name", bu_vls_addr(r->ov_reg2_name));
-    nirt_print_key("ov_reg2_id", r->ov_reg2_id);
-    nirt_print_key("ov_sol_in", bu_vls_addr(r->ov_sol_in));
-    nirt_print_key("ov_sol_out", bu_vls_addr(r->ov_sol_out));
-    nirt_print_key("ov_los", r->ov_los * base2local);
-    nirt_print_key("ov_x_in", r->ov_in[X] * base2local);
-    nirt_print_key("ov_y_in", r->ov_in[Y] * base2local);
-    nirt_print_key("ov_z_in", r->ov_in[Z] * base2local);
-    nirt_print_key("ov_d_in", r->ov_d_in * base2local);
-    nirt_print_key("ov_x_out", r->ov_out[X] * base2local);
-    nirt_print_key("ov_y_out", r->ov_out[Y] * base2local);
-    nirt_print_key("ov_z_out", r->ov_out[Z] * base2local);
-    nirt_print_key("ov_d_out", r->ov_d_out * base2local);
-    nirt_print_key("surf_num_in", r->surf_num_in);
-    nirt_print_key("surf_num_out", r->surf_num_out);
-    nirt_print_key("claimant_count", r->claimant_count);
-    nirt_print_key("claimant_list", bu_vls_addr(r->claimant_list));
-    nirt_print_key("claimant_listn", bu_vls_addr(r->claimant_listn));
-    nirt_print_key("attributes", bu_vls_addr(r->attributes));
-    nirt_print_key("x_gap_in", r->gap_in[X] * base2local);
-    nirt_print_key("y_gap_in", r->gap_in[Y] * base2local);
-    nirt_print_key("z_gap_in", r->gap_in[Z] * base2local);
-    nirt_print_key("gap_los", r->gap_los * base2local);
+    nirt_print_key("x_in", r->seg->in[X] * base2local);
+    nirt_print_key("y_in", r->seg->in[Y] * base2local);
+    nirt_print_key("z_in", r->seg->in[Z] * base2local);
+    nirt_print_key("d_in", r->seg->d_in * base2local);
+    nirt_print_key("x_out", r->seg->out[X] * base2local);
+    nirt_print_key("y_out", r->seg->out[Y] * base2local);
+    nirt_print_key("z_out", r->seg->out[Z] * base2local);
+    nirt_print_key("d_out", r->seg->d_out * base2local);
+    nirt_print_key("los", r->seg->los * base2local);
+    nirt_print_key("scaled_los", r->seg->scaled_los * base2local);
+    nirt_print_key("path_name", bu_vls_addr(r->seg->path_name));
+    nirt_print_key("reg_name", bu_vls_addr(r->seg->reg_name));
+    nirt_print_key("reg_id", r->seg->reg_id);
+    nirt_print_key("obliq_in", r->seg->obliq_in);
+    nirt_print_key("obliq_out", r->seg->obliq_out);
+    nirt_print_key("nm_x_in", r->seg->nm_in[X]);
+    nirt_print_key("nm_y_in", r->seg->nm_in[Y]);
+    nirt_print_key("nm_z_in", r->seg->nm_in[Z]);
+    nirt_print_key("nm_d_in", r->seg->nm_d_in);
+    nirt_print_key("nm_h_in", r->seg->nm_h_in);
+    nirt_print_key("nm_v_in", r->seg->nm_v_in);
+    nirt_print_key("nm_x_out", r->seg->nm_out[X]);
+    nirt_print_key("nm_y_out", r->seg->nm_out[Y]);
+    nirt_print_key("nm_z_out", r->seg->nm_out[Z]);
+    nirt_print_key("nm_d_out", r->seg->nm_d_out);
+    nirt_print_key("nm_h_out", r->seg->nm_h_out);
+    nirt_print_key("nm_v_out", r->seg->nm_v_out);
+    nirt_print_key("ov_reg1_name", bu_vls_addr(r->seg->ov_reg1_name));
+    nirt_print_key("ov_reg1_id", r->seg->ov_reg1_id);
+    nirt_print_key("ov_reg2_name", bu_vls_addr(r->seg->ov_reg2_name));
+    nirt_print_key("ov_reg2_id", r->seg->ov_reg2_id);
+    nirt_print_key("ov_sol_in", bu_vls_addr(r->seg->ov_sol_in));
+    nirt_print_key("ov_sol_out", bu_vls_addr(r->seg->ov_sol_out));
+    nirt_print_key("ov_los", r->seg->ov_los * base2local);
+    nirt_print_key("ov_x_in", r->seg->ov_in[X] * base2local);
+    nirt_print_key("ov_y_in", r->seg->ov_in[Y] * base2local);
+    nirt_print_key("ov_z_in", r->seg->ov_in[Z] * base2local);
+    nirt_print_key("ov_d_in", r->seg->ov_d_in * base2local);
+    nirt_print_key("ov_x_out", r->seg->ov_out[X] * base2local);
+    nirt_print_key("ov_y_out", r->seg->ov_out[Y] * base2local);
+    nirt_print_key("ov_z_out", r->seg->ov_out[Z] * base2local);
+    nirt_print_key("ov_d_out", r->seg->ov_d_out * base2local);
+    nirt_print_key("surf_num_in", r->seg->surf_num_in);
+    nirt_print_key("surf_num_out", r->seg->surf_num_out);
+    nirt_print_key("claimant_count", r->seg->claimant_count);
+    nirt_print_key("claimant_list", bu_vls_addr(r->seg->claimant_list));
+    nirt_print_key("claimant_listn", bu_vls_addr(r->seg->claimant_listn));
+    nirt_print_key("attributes", bu_vls_addr(r->seg->attributes));
+    nirt_print_key("x_gap_in", r->seg->gap_in[X] * base2local);
+    nirt_print_key("y_gap_in", r->seg->gap_in[Y] * base2local);
+    nirt_print_key("z_gap_in", r->seg->gap_in[Z] * base2local);
+    nirt_print_key("gap_los", r->seg->gap_los * base2local);
 }
 
 /* Generate the full report string defined by the array of fmt,key pairs
@@ -1202,6 +1262,7 @@
     point_t onormal;
     struct partition *part;
     int ev_odd = 1; /* first partition is colored as "odd" */
+    double d_out_old = 0.0; 
 
     _nirt_report(nss, 'r', vals);
     _nirt_report(nss, 'h', vals);
@@ -1213,6 +1274,10 @@
     }
 
     for (part = part_head->pt_forw; part != part_head; part = part->pt_forw) {
+       struct nirt_seg *s;
+       _nirt_seg_init(&s);
+       vals->seg = s;
+
        ++part_nm;
 
        RT_HIT_NORMAL(inormal, part->pt_inhit, part->pt_inseg->seg_stp,
@@ -1221,95 +1286,90 @@
                &ap->a_ray, part->pt_outflip);
 
        /* Update the output values */
-       if (part_nm > 1) {
-           VMOVE(vals->gap_in, vals->out);
-           // Stash the previous d_out value for use after we calculate the 
new d_in
-           vals->gap_los = vals->d_out;
-       }
+       if (part_nm > 1) VMOVE(s->gap_in, s->out);
+       VMOVE(s->in, part->pt_inhit->hit_point);
+       VMOVE(s->out, part->pt_outhit->hit_point);
+       VMOVE(s->nm_in, inormal);
+       VMOVE(s->nm_out, onormal);
 
-       VMOVE(vals->in, part->pt_inhit->hit_point);
-       VMOVE(vals->out, part->pt_outhit->hit_point);
-       VMOVE(vals->nm_in, inormal);
-       VMOVE(vals->nm_out, onormal);
-
        ndbg(nss, NIRT_DEBUG_HITS, "Partition %d entry: (%g, %g, %g) exit: (%g, 
%g, %g)\n",
-               part_nm, V3ARGS(vals->in), V3ARGS(vals->out));
+               part_nm, V3ARGS(s->in), V3ARGS(s->out));
 
-       vals->d_in = vals->in[X] * cos(er) * cos(ar) + vals->in[Y] * cos(er) * 
sin(ar) + vals->in[Z] * sin(er);
-       vals->d_out = vals->out[X] * cos(er) * cos(ar) + vals->out[Y] * cos(er) 
* sin(ar) + vals->out[Z] * sin(er);
+       s->d_in = s->in[X] * cos(er) * cos(ar) + s->in[Y] * cos(er) * sin(ar) + 
s->in[Z] * sin(er);
+       s->d_out = s->out[X] * cos(er) * cos(ar) + s->out[Y] * cos(er) * 
sin(ar) + s->out[Z] * sin(er);
+       d_out_old = s->d_out; // Stash the d_out value for gap_los calculation 
in the next partition
+       s->nm_d_in = s->nm_in[X] * cos(er) * cos(ar) + s->nm_in[Y] * cos(er) * 
sin(ar) + s->nm_in[Z] * sin(er);
+       s->nm_h_in = s->nm_in[X] * (-sin(ar)) + s->nm_in[Y] * cos(ar);
+       s->nm_v_in = s->nm_in[X] * (-sin(er)) * cos(ar) + s->nm_in[Y] * 
(-sin(er)) * sin(ar) + s->nm_in[Z] * cos(er);
 
-       vals->nm_d_in = vals->nm_in[X] * cos(er) * cos(ar) + vals->nm_in[Y] * 
cos(er) * sin(ar) + vals->nm_in[Z] * sin(er);
-       vals->nm_h_in = vals->nm_in[X] * (-sin(ar)) + vals->nm_in[Y] * cos(ar);
-       vals->nm_v_in = vals->nm_in[X] * (-sin(er)) * cos(ar) + vals->nm_in[Y] 
* (-sin(er)) * sin(ar) + vals->nm_in[Z] * cos(er);
+       s->nm_d_out = s->nm_out[X] * cos(er) * cos(ar) + s->nm_out[Y] * cos(er) 
* sin(ar) + s->nm_out[Z] * sin(er);
+       s->nm_h_out = s->nm_out[X] * (-sin(ar)) + s->nm_out[Y] * cos(ar);
+       s->nm_v_out = s->nm_out[X] * (-sin(er)) * cos(ar) + s->nm_out[Y] * 
(-sin(er)) * sin(ar) + s->nm_out[Z] * cos(er);
 
-       vals->nm_d_out = vals->nm_out[X] * cos(er) * cos(ar) + vals->nm_out[Y] 
* cos(er) * sin(ar) + vals->nm_out[Z] * sin(er);
-       vals->nm_h_out = vals->nm_out[X] * (-sin(ar)) + vals->nm_out[Y] * 
cos(ar);
-       vals->nm_v_out = vals->nm_out[X] * (-sin(er)) * cos(ar) + 
vals->nm_out[Y] * (-sin(er)) * sin(ar) + vals->nm_out[Z] * cos(er);
+       s->los = s->d_in - s->d_out;
+       s->scaled_los = 0.01 * s->los * part->pt_regionp->reg_los;
 
-       vals->los = vals->d_in - vals->d_out;
-       vals->scaled_los = 0.01 * vals->los * part->pt_regionp->reg_los;
-
        if (part_nm > 1) {
            /* old d_out - new d_in */
-           vals->gap_los = vals->gap_los - vals->d_in;
+           s->gap_los = d_out_old - s->d_in;
 
-           if (vals->gap_los > 0) {
+           if (s->gap_los > 0) {
                _nirt_report(nss, 'g', vals);
                /* vlist segment for gap */
                vhead = bn_vlblock_find(nss->i->segs, 
nss->i->void_color->buc_rgb[RED], nss->i->void_color->buc_rgb[GRN], 
nss->i->void_color->buc_rgb[BLU]);
-               BN_ADD_VLIST(nss->i->segs->free_vlist_hd, vhead, vals->gap_in, 
BN_VLIST_LINE_MOVE);
-               BN_ADD_VLIST(nss->i->segs->free_vlist_hd, vhead, vals->in, 
BN_VLIST_LINE_DRAW);
+               BN_ADD_VLIST(nss->i->segs->free_vlist_hd, vhead, s->gap_in, 
BN_VLIST_LINE_MOVE);
+               BN_ADD_VLIST(nss->i->segs->free_vlist_hd, vhead, s->in, 
BN_VLIST_LINE_DRAW);
                nss->i->b_segs = true;
            }
        }
 
-       bu_vls_sprintf(vals->path_name, "%s", part->pt_regionp->reg_name);
+       bu_vls_sprintf(s->path_name, "%s", part->pt_regionp->reg_name);
        {
-           char *tmp_regname = (char 
*)bu_calloc(bu_vls_strlen(vals->path_name) + 1, sizeof(char), "tmp reg_name");
+           char *tmp_regname = (char *)bu_calloc(bu_vls_strlen(s->path_name) + 
1, sizeof(char), "tmp reg_name");
            bu_basename(part->pt_regionp->reg_name, tmp_regname);
-           bu_vls_sprintf(vals->reg_name, "%s", tmp_regname);
+           bu_vls_sprintf(s->reg_name, "%s", tmp_regname);
            bu_free(tmp_regname, "tmp reg_name");
        }
 
-       vals->reg_id = part->pt_regionp->reg_regionid;
-       vals->surf_num_in = part->pt_inhit->hit_surfno;
-       vals->surf_num_out = part->pt_outhit->hit_surfno;
-       vals->obliq_in = _nirt_get_obliq(ap->a_ray.r_dir, inormal);
-       vals->obliq_out = _nirt_get_obliq(ap->a_ray.r_dir, onormal);
+       s->reg_id = part->pt_regionp->reg_regionid;
+       s->surf_num_in = part->pt_inhit->hit_surfno;
+       s->surf_num_out = part->pt_outhit->hit_surfno;
+       s->obliq_in = _nirt_get_obliq(ap->a_ray.r_dir, inormal);
+       s->obliq_out = _nirt_get_obliq(ap->a_ray.r_dir, onormal);
 
-       bu_vls_trunc(vals->claimant_list, 0);
-       bu_vls_trunc(vals->claimant_listn, 0);
+       bu_vls_trunc(s->claimant_list, 0);
+       bu_vls_trunc(s->claimant_listn, 0);
        if (part->pt_overlap_reg == 0) {
-           vals->claimant_count = 1;
+           s->claimant_count = 1;
        } else {
            struct region **rpp;
            struct bu_vls tmpcp = BU_VLS_INIT_ZERO;
-           vals->claimant_count = 0;
+           s->claimant_count = 0;
            for (rpp = part->pt_overlap_reg; *rpp != REGION_NULL; ++rpp) {
                char *base = NULL;
-               if (vals->claimant_count) bu_vls_strcat(vals->claimant_list, " 
");
-               vals->claimant_count++;
+               if (s->claimant_count) bu_vls_strcat(s->claimant_list, " ");
+               s->claimant_count++;
                bu_vls_sprintf(&tmpcp, "%s", (*rpp)->reg_name);
                base = bu_basename(bu_vls_addr(&tmpcp), NULL);
-               bu_vls_strcat(vals->claimant_list, base);
+               bu_vls_strcat(s->claimant_list, base);
                bu_free(base, "bu_basename");
            }
            bu_vls_free(&tmpcp);
 
            /* insert newlines instead of spaces for listn */
-           bu_vls_sprintf(vals->claimant_listn, "%s", 
bu_vls_addr(vals->claimant_list));
-           for (char *cp = bu_vls_addr(vals->claimant_listn); *cp != '\0'; 
++cp) {
+           bu_vls_sprintf(s->claimant_listn, "%s", 
bu_vls_addr(s->claimant_list));
+           for (char *cp = bu_vls_addr(s->claimant_listn); *cp != '\0'; ++cp) {
                if (*cp == ' ') *cp = '\n';
            }
        }
 
-       bu_vls_trunc(vals->attributes, 0);
+       bu_vls_trunc(s->attributes, 0);
        std::set<std::string>::iterator a_it;
        for (a_it = nss->i->attrs.begin(); a_it != nss->i->attrs.end(); a_it++) 
{
            const char *key = (*a_it).c_str();
            const char *val = bu_avs_get(&part->pt_regionp->attr_values, key);
            if (val != NULL) {
-               bu_vls_printf(vals->attributes, "%s=%s ", key, val);
+               bu_vls_printf(s->attributes, "%s=%s ", key, val);
            }
        }
 
@@ -1321,8 +1381,8 @@
        } else {
            vhead = bn_vlblock_find(nss->i->segs, 
nss->i->hit_even_color->buc_rgb[RED], nss->i->hit_even_color->buc_rgb[GRN], 
nss->i->hit_even_color->buc_rgb[BLU]);
        }
-       BN_ADD_VLIST(nss->i->segs->free_vlist_hd, vhead, vals->in, 
BN_VLIST_LINE_MOVE);
-       BN_ADD_VLIST(nss->i->segs->free_vlist_hd, vhead, vals->out, 
BN_VLIST_LINE_DRAW);
+       BN_ADD_VLIST(nss->i->segs->free_vlist_hd, vhead, s->in, 
BN_VLIST_LINE_MOVE);
+       BN_ADD_VLIST(nss->i->segs->free_vlist_hd, vhead, s->out, 
BN_VLIST_LINE_DRAW);
        nss->i->b_segs = true;
 
        while ((ovp = _nirt_find_ovlp(nss, part)) != NIRT_OVERLAP_NULL) {
@@ -1332,26 +1392,26 @@
            char *copy_ovlp_reg2 = bu_strdup(ovp->reg2->reg_name);
            char *t1 = (char *)bu_calloc(strlen(copy_ovlp_reg1), sizeof(char), 
"if_hit sval2");
            bu_basename(copy_ovlp_reg1, t1);
-           bu_vls_sprintf(vals->ov_reg1_name, "%s", t1);
+           bu_vls_sprintf(s->ov_reg1_name, "%s", t1);
            bu_free(t1, "t1");
            bu_free(copy_ovlp_reg1, "cp1");
            char *t2 = (char *)bu_calloc(strlen(copy_ovlp_reg2), sizeof(char), 
"if_hit sval3");
            bu_basename(copy_ovlp_reg2, t2);
-           bu_vls_sprintf(vals->ov_reg2_name, "%s", t2);
+           bu_vls_sprintf(s->ov_reg2_name, "%s", t2);
            bu_free(t2, "t2");
            bu_free(copy_ovlp_reg2, "cp2");
 
 
-           vals->ov_reg1_id = ovp->reg1->reg_regionid;
-           vals->ov_reg2_id = ovp->reg2->reg_regionid;
-           bu_vls_sprintf(vals->ov_sol_in, "%s", 
part->pt_inseg->seg_stp->st_dp->d_namep);
-           bu_vls_sprintf(vals->ov_sol_out, "%s", 
part->pt_outseg->seg_stp->st_dp->d_namep);
-           VMOVE(vals->ov_in, ovp->in_point);
-           VMOVE(vals->ov_out, ovp->out_point);
+           s->ov_reg1_id = ovp->reg1->reg_regionid;
+           s->ov_reg2_id = ovp->reg2->reg_regionid;
+           bu_vls_sprintf(s->ov_sol_in, "%s", 
part->pt_inseg->seg_stp->st_dp->d_namep);
+           bu_vls_sprintf(s->ov_sol_out, "%s", 
part->pt_outseg->seg_stp->st_dp->d_namep);
+           VMOVE(s->ov_in, ovp->in_point);
+           VMOVE(s->ov_out, ovp->out_point);
 
-           vals->ov_d_in = vals->d_orig - ovp->in_dist; // TODO looks sketchy 
in NIRT - did they really mean target(D) ?? -> (VTI_XORIG + 3 -> VTI_H)
-           vals->ov_d_out = vals->d_orig - ovp->out_dist; // TODO looks 
sketchy in NIRT - did they really mean target(D) ?? -> (VTI_XORIG + 3 -> VTI_H)
-           vals->ov_los = vals->ov_d_in - vals->ov_d_out;
+           s->ov_d_in = vals->d_orig - ovp->in_dist; // TODO looks sketchy in 
NIRT - did they really mean target(D) ?? -> (VTI_XORIG + 3 -> VTI_H)
+           s->ov_d_out = vals->d_orig - ovp->out_dist; // TODO looks sketchy 
in NIRT - did they really mean target(D) ?? -> (VTI_XORIG + 3 -> VTI_H)
+           s->ov_los = s->ov_d_in - s->ov_d_out;
 
            _nirt_report(nss, 'o', vals);
 
@@ -1358,13 +1418,22 @@
            /* vlist segment for overlap */
            if (nss->i->plot_overlaps) {
                vhead = bn_vlblock_find(nss->i->segs, 
nss->i->overlap_color->buc_rgb[RED], nss->i->overlap_color->buc_rgb[GRN], 
nss->i->overlap_color->buc_rgb[BLU]);
-               BN_ADD_VLIST(nss->i->segs->free_vlist_hd, vhead, vals->ov_in, 
BN_VLIST_LINE_MOVE);
-               BN_ADD_VLIST(nss->i->segs->free_vlist_hd, vhead, vals->ov_out, 
BN_VLIST_LINE_DRAW);
+               BN_ADD_VLIST(nss->i->segs->free_vlist_hd, vhead, s->ov_in, 
BN_VLIST_LINE_MOVE);
+               BN_ADD_VLIST(nss->i->segs->free_vlist_hd, vhead, s->ov_out, 
BN_VLIST_LINE_DRAW);
                nss->i->b_segs = true;
            }
 
            _nirt_del_ovlp(ovp);
        }
+
+       // TODO - if any differences found, add new nirt_diff seg entry.
+       // diffs[current].segs.push_back(s);
+       // vals->seg = NULL; // Diff will be using this seg structure, so don't 
free it in this logic.
+       
+       if (vals->seg) {
+           _nirt_seg_free(vals->seg);
+           vals->seg = NULL;
+       }
     }
 
     _nirt_report(nss, 'f', vals);
@@ -2919,15 +2988,6 @@
     bu_avs_init_empty(n->val_docs);
 
     BU_GET(n->vals, struct nirt_output_record);
-    BU_GET(n->vals->path_name, struct bu_vls);
-    BU_GET(n->vals->reg_name, struct bu_vls);
-    BU_GET(n->vals->ov_reg1_name, struct bu_vls);
-    BU_GET(n->vals->ov_reg2_name, struct bu_vls);
-    BU_GET(n->vals->ov_sol_in, struct bu_vls);
-    BU_GET(n->vals->ov_sol_out, struct bu_vls);
-    BU_GET(n->vals->claimant_list, struct bu_vls);
-    BU_GET(n->vals->claimant_listn, struct bu_vls);
-    BU_GET(n->vals->attributes, struct bu_vls);
 
     VSETALL(n->vals->orig, 0.0);
     n->vals->h = 0.0;
@@ -2934,16 +2994,6 @@
     n->vals->v = 0.0;
     n->vals->d_orig = 0.0;
 
-    bu_vls_init(n->vals->path_name);
-    bu_vls_init(n->vals->reg_name);
-    bu_vls_init(n->vals->ov_reg1_name);
-    bu_vls_init(n->vals->ov_reg2_name);
-    bu_vls_init(n->vals->ov_sol_in);
-    bu_vls_init(n->vals->ov_sol_out);
-    bu_vls_init(n->vals->claimant_list);
-    bu_vls_init(n->vals->claimant_listn);
-    bu_vls_init(n->vals->attributes);
-
     /* Populate the output key and type information */
     {
        std::string s(nirt_cmd_tbl_defs);
@@ -3071,25 +3121,6 @@
 
     db_close(ns->i->dbip);
 
-    bu_vls_free(ns->i->vals->path_name);
-    bu_vls_free(ns->i->vals->reg_name);
-    bu_vls_free(ns->i->vals->ov_reg1_name);
-    bu_vls_free(ns->i->vals->ov_reg2_name);
-    bu_vls_free(ns->i->vals->ov_sol_in);
-    bu_vls_free(ns->i->vals->ov_sol_out);
-    bu_vls_free(ns->i->vals->claimant_list);
-    bu_vls_free(ns->i->vals->claimant_listn);
-    bu_vls_free(ns->i->vals->attributes);
-
-    BU_PUT(ns->i->vals->path_name, struct bu_vls);
-    BU_PUT(ns->i->vals->reg_name, struct bu_vls);
-    BU_PUT(ns->i->vals->ov_reg1_name, struct bu_vls);
-    BU_PUT(ns->i->vals->ov_reg2_name, struct bu_vls);
-    BU_PUT(ns->i->vals->ov_sol_in, struct bu_vls);
-    BU_PUT(ns->i->vals->ov_sol_out, struct bu_vls);
-    BU_PUT(ns->i->vals->claimant_list, struct bu_vls);
-    BU_PUT(ns->i->vals->claimant_listn, struct bu_vls);
-    BU_PUT(ns->i->vals->attributes, struct bu_vls);
     BU_PUT(ns->i->vals, struct nirt_output_record);
 
     BU_PUT(ns->i->res, struct resource);

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to