Revision: 53696
          http://brlcad.svn.sourceforge.net/brlcad/?rev=53696&view=rev
Author:   n_reed
Date:     2012-11-14 19:58:54 +0000 (Wed, 14 Nov 2012)
Log Message:
-----------
implement fallback to set solid bounds for primitives without a bbox routine

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

Modified: brlcad/trunk/src/libged/draw.c
===================================================================
--- brlcad/trunk/src/libged/draw.c      2012-11-14 19:44:24 UTC (rev 53695)
+++ brlcad/trunk/src/libged/draw.c      2012-11-14 19:58:54 UTC (rev 53696)
@@ -460,13 +460,37 @@
        sp->s_size = max[X] - min[X];
        V_MAX(sp->s_size, max[Y] - min[Y]);
        V_MAX(sp->s_size, max[Z] - min[Z]);
+    } else if (ip->idb_meth->ft_plot) {
+       /* As a fallback for primitives that don't have a bbox function, use
+        * the old bounding method of calculating a plot for the primitive and
+        * using the extent of the plotted segments as the bounds.
+        */
+       int plot_status;
+       struct bu_list vhead;
+       struct bn_vlist *vp;
+
+       BU_LIST_INIT(&vhead);
+
+       plot_status = ip->idb_meth->ft_plot(&vhead, ip, tsp->ts_ttol,
+               tsp->ts_tol, NULL);
+
+       if (plot_status < 0) {
+           bu_vls_printf(dgcdp->gedp->ged_result_str, "%s: plot failure\n",
+                   DB_FULL_PATH_CUR_DIR(pathp)->d_namep);
+
+           return TREE_NULL;
+       }
+
+       solid_append_vlist(sp, (struct bn_vlist *)&vhead);
+
+       bound_solid(dgcdp->gedp, sp);
+
+       while (BU_LIST_WHILE(vp, bn_vlist, &(sp->s_vlist))) {
+           BU_LIST_DEQUEUE(&vp->l);
+           bu_free(vp, "solid vp");
+       }
     }
 
-    /* TODO: As a fallback for primitives that don't have a bbox function, use
-     * the old bounding method of calculating a plot for the primitive and
-     * using the extent of the plotted segments as the bounds.
-     */
-
     db_dup_full_path(&sp->s_fullpath, pathp);
     sp->s_flag = DOWN;
     sp->s_iflag = DOWN;

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


------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to