Revision: 55697
          http://sourceforge.net/p/brlcad/code/55697
Author:   r_weiss
Date:     2013-06-07 22:42:23 +0000 (Fri, 07 Jun 2013)
Log Message:
-----------
Updates to 'gqa' command to improve results with default settings and improve 
user messages/warnings. More testing is needed.

Modified Paths:
--------------
    brlcad/trunk/src/libged/gqa.c

Modified: brlcad/trunk/src/libged/gqa.c
===================================================================
--- brlcad/trunk/src/libged/gqa.c       2013-06-07 20:29:26 UTC (rev 55696)
+++ brlcad/trunk/src/libged/gqa.c       2013-06-07 22:42:23 UTC (rev 55697)
@@ -611,10 +611,6 @@
 
                        gridSpacing = 0.0; /* flag it */
                    }
-
-                   bu_vls_printf(_ged_current_gedp->ged_result_str, "set grid 
spacing:%g %s limit:%g %s\n",
-                                 gridSpacing / units[LINE]->val, 
units[LINE]->name,
-                                 gridSpacingLimit / units[LINE]->val, 
units[LINE]->name);
                    break;
                }
            case 'G':
@@ -1613,10 +1609,10 @@
     }
 
     if (!ZERO(newGridSpacing - gridSpacing)) {
-       bu_vls_printf(_ged_current_gedp->ged_result_str, "Grid spacing %g %s is 
does not allow %g samples per axis\n",
+       bu_log("Initial grid spacing %g %s does not allow %g samples per 
axis.\n",
                      gridSpacing / units[LINE]->val, units[LINE]->name, 
Samples_per_model_axis - 1);
 
-       bu_vls_printf(_ged_current_gedp->ged_result_str, "Adjusted to %g %s to 
get %g samples per model axis\n",
+       bu_log("Adjusted initial grid spacing to %g %s to get %g samples per 
model axis.\n",
                      newGridSpacing / units[LINE]->val, units[LINE]->name, 
Samples_per_model_axis);
 
        gridSpacing = newGridSpacing;
@@ -1625,19 +1621,20 @@
     /* if the vol/weight tolerances are not set, pick something */
     if (analysis_flags & ANALYSIS_VOLUME) {
        char *name = "volume.pl";
-       if (ZERO(volume_tolerance - 1.0)) {
+       if (EQUAL(volume_tolerance, -1)) {
            volume_tolerance = span[X] * span[Y] * span[Z] * 0.001;
-           bu_vls_printf(_ged_current_gedp->ged_result_str, "setting volume 
tolerance to %g %s\n",
+           bu_log("Using estimated volume tolerance %g %s\n",
                          volume_tolerance / units[VOL]->val, units[VOL]->name);
        } else
-           bu_vls_printf(_ged_current_gedp->ged_result_str, "volume tolerance  
 %g\n", volume_tolerance);
+           bu_log("Using volume tolerance %g %s\n",
+                         volume_tolerance / units[VOL]->val, units[VOL]->name);
        if (plot_files)
            if ((plot_volume=fopen(name, "wb")) == (FILE *)NULL) {
                bu_vls_printf(_ged_current_gedp->ged_result_str, "cannot open 
plot file %s\n", name);
            }
     }
     if (analysis_flags & ANALYSIS_WEIGHT) {
-       if (ZERO(weight_tolerance - 1.0)) {
+       if (EQUAL(weight_tolerance, -1)) {
            double max_den = 0.0;
            int i;
            for (i = 0; i < num_densities; i++) {
@@ -1788,15 +1785,15 @@
            val = obj_tbl[obj].o_weight[view] =
                obj_tbl[obj].o_lenDensity[view] * (state->area[view] / 
state->shots[view]);
 
-           low = hi = 0.0;
-
+           low = INFINITY;
+           hi = -INFINITY;
            /* compute the per-view weight of this object */
            for (view=1; view < num_views; view++) {
                obj_tbl[obj].o_weight[view] =
                    obj_tbl[obj].o_lenDensity[view] *
                    (state->area[view] / state->shots[view]);
 
-               delta = val - obj_tbl[obj].o_weight[view];
+               delta = fabs(val - obj_tbl[obj].o_weight[view]);
                if (delta < low) low = delta;
                if (delta > hi) hi = delta;
            }
@@ -1839,13 +1836,14 @@
            val = obj_tbl[obj].o_volume[view] =
                obj_tbl[obj].o_len[view] * (state->area[view] / 
state->shots[view]);
 
-           low = hi = 0.0;
+           low = INFINITY;
+           hi = -INFINITY;
            /* compute the per-view volume of this object */
            for (view=1; view < num_views; view++) {
                obj_tbl[obj].o_volume[view] =
                    obj_tbl[obj].o_len[view] * (state->area[view] / 
state->shots[view]);
 
-               delta = val - obj_tbl[obj].o_volume[view];
+               delta = fabs(val - obj_tbl[obj].o_volume[view]);
                if (delta < low) low = delta;
                if (delta > hi) hi = delta;
            }
@@ -1911,9 +1909,8 @@
 
     /* if we've reached the grid limit, we're done, no matter what */
     if (gridSpacing < gridSpacingLimit) {
-       if (verbose)
-           bu_vls_printf(_ged_current_gedp->ged_result_str, "grid spacing 
refined to %g (below lower limit %g)\n",
-                         gridSpacing, gridSpacingLimit);
+       bu_vls_printf(_ged_current_gedp->ged_result_str, "NOTE: Stopped, grid 
spacing refined to %g (below lower limit %g).\n",
+           gridSpacing, gridSpacingLimit);
        return 0;
     }
 
@@ -2361,7 +2358,8 @@
     elevation_deg = 0.0;
     densityFileName = (char *)0;
     gridSpacing = 50.0;
-    gridSpacingLimit = 0.25;
+    /* set default grid spacing limit based on distance tolerance */
+    gridSpacingLimit = 4.0 * gedp->ged_wdbp->wdb_tol.dist;
     makeOverlapAssemblies = 0;
     require_num_hits = 1;
     max_cpus = ncpu = bu_avail_cpus();
@@ -2458,11 +2456,20 @@
        do {
            gridSpacing *= 2.0;
        } while (gridSpacing < min_span);
+
        gridSpacing *= 0.25;
        if (gridSpacing < gridSpacingLimit) gridSpacing = gridSpacingLimit;
-       bu_vls_printf(gedp->ged_result_str, "initial spacing %g\n", 
gridSpacing);
+
+       bu_log("Trying estimated initial grid spacing: %g %s\n", 
+           gridSpacing / units[LINE]->val, units[LINE]->name);
+    } else {
+       bu_log("Trying initial grid spacing: %g %s\n", 
+           gridSpacing / units[LINE]->val, units[LINE]->name);
     }
 
+    bu_log("Using grid spacing lower limit: %g %s\n", 
+           gridSpacingLimit / units[LINE]->val, units[LINE]->name);
+
     if (options_prep(rtip, state.span) != GED_OK) return GED_ERROR;
 
     /* initialize some stuff */
@@ -2477,7 +2484,7 @@
 
        VSCALE(state.steps, state.span, inv_spacing);
 
-       bu_vls_printf(gedp->ged_result_str, "grid spacing %g %s %ld x %ld x 
%ld\n",
+       bu_log("Processing with grid spacing %g %s %ld x %ld x %ld\n",
                      gridSpacing / units[LINE]->val,
                      units[LINE]->name,
                      state.steps[0]-1,

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


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to