Revision: 45866
          http://brlcad.svn.sourceforge.net/brlcad/?rev=45866&view=rev
Author:   bhinesley
Date:     2011-08-09 23:16:41 +0000 (Tue, 09 Aug 2011)

Log Message:
-----------
Enabled use of bounding box centers of objects as points. Basic object 
translations are working "translate -k obj1 -a obj2 obj3", "translate -a obj2 
obj1", etc. (redrawing is broken, the objects have to be blasted). It turns out 
that getting the natural origin is what is causing the 0,0,0 coordinates; 
haven't been able to figure out why. Many things aren't working yet. At least 
some translations using reference vectors are working.

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

Modified: brlcad/trunk/src/libged/edit.c
===================================================================
--- brlcad/trunk/src/libged/edit.c      2011-08-09 23:14:47 UTC (rev 45865)
+++ brlcad/trunk/src/libged/edit.c      2011-08-09 23:16:41 UTC (rev 45866)
@@ -1563,24 +1563,29 @@
     }
     d_next = RT_DIR_NULL; /* none left */
 
+    /* add final combination/primitive natural origin to sum */
+    if (d->d_flags & RT_DIR_SOLID) {
+       if (_ged_get_obj_bounds2(gedp, 1, (const char **)&d->d_namep, &gtd,
+           rpp_min, rpp_max) == GED_ERROR)
+           return GED_ERROR;
+    } else {
+       BU_ASSERT(d->d_flags & (RT_DIR_REGION | RT_DIR_COMB));
+       if (_ged_get_obj_bounds(gedp, 1, (const char **)&d->d_namep, 1,
+           rpp_min, rpp_max) == GED_ERROR)
+           return GED_ERROR;
+    }
+
     if (arg->type & EDIT_NATURAL_ORIGIN) {
        arg->type &= ~EDIT_NATURAL_ORIGIN;
+       MAT_DELTAS_GET(leaf_deltas, gtd.gtd_xform);
+       bu_vls_printf(gedp->ged_result_str, "natural origin option is not"
+                     " yet working");
+       return GED_ERROR;
     } else {
-       /* TODO: calculate the BB_CENTER, and set to default */
-       bu_vls_printf(gedp->ged_result_str,
-                     "unsupported primitive point type");
-       return GED_ERROR;
+       /* bounding box center is the default */
+       VADD2SCALE(leaf_deltas, rpp_min, rpp_max, 0.5);
     }
 
-    /* add final combination/primitive natural origin to sum */
-    BU_ASSERT(d->d_flags & (RT_DIR_SOLID | RT_DIR_REGION | RT_DIR_COMB));
-    if (_ged_get_obj_bounds2(gedp, 1, (const char **)&d->d_namep, &gtd, 
rpp_min,
-       rpp_max) == GED_ERROR)
-       return GED_ERROR;
-    if (!(d->d_flags & RT_DIR_SOLID) && (_ged_get_obj_bounds(gedp, 1,
-       (const char **)&d->d_namep, 1, rpp_min, rpp_max) == GED_ERROR))
-       return GED_ERROR;
-    MAT_DELTAS_GET(leaf_deltas, gtd.gtd_xform);
     VADD2(*coord, *coord, leaf_deltas);
     return GED_OK;
 }


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

------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to