Revision: 68852
          http://sourceforge.net/p/brlcad/code/68852
Author:   starseeker
Date:     2016-09-19 20:21:29 +0000 (Mon, 19 Sep 2016)
Log Message:
-----------
Make some regions to and hierarchy to organize things a bit.

Modified Paths:
--------------
    brlcad/trunk/src/conv/dyn-g.cpp

Modified: brlcad/trunk/src/conv/dyn-g.cpp
===================================================================
--- brlcad/trunk/src/conv/dyn-g.cpp     2016-09-19 19:51:15 UTC (rev 68851)
+++ brlcad/trunk/src/conv/dyn-g.cpp     2016-09-19 20:21:29 UTC (rev 68852)
@@ -195,6 +195,7 @@
 int
 main(int argc, char **argv)
 {
+    struct wmember all_head;
     struct dyna_world *world;
 
     if (argc != 3) {
@@ -218,6 +219,8 @@
     bu_ptbl_init(world->nodes, 8, "init node tbl");
     bu_ptbl_init(world->element_shells, 8, "init element tbl");
 
+    BU_LIST_INIT(&all_head.l);
+
     std::string line;
     int nodepos = 0;
     int espos = 0;
@@ -319,13 +322,32 @@
            eind++;
        }
 
-       struct bu_vls ptname = BU_VLS_INIT_ZERO;
-       bu_vls_sprintf(&ptname, "%ld.bot", *it);
-       mk_bot(fd_out, bu_vls_addr(&ptname), RT_BOT_SURFACE, RT_BOT_UNORIENTED, 
NULL, NIDs.size(), EIDs.size() * 2, bot_vertices, bot_faces, NULL, NULL);
-       bu_vls_free(&ptname);
+       struct bu_vls sname = BU_VLS_INIT_ZERO;
+       bu_vls_sprintf(&sname, "%ld.bot", *it);
+       mk_bot(fd_out, bu_vls_addr(&sname), RT_BOT_SURFACE, RT_BOT_UNORIENTED, 
NULL, NIDs.size(), EIDs.size() * 2, bot_vertices, bot_faces, NULL, NULL);
 
+       /* Make containing region */
+       struct wmember head;
+       BU_LIST_INIT(&head.l);
+       struct bu_vls rname = BU_VLS_INIT_ZERO;
+       bu_vls_sprintf(&rname, "%ld.r", *it);
+       /* steal this from step-g coloring - really need to fold into a libbu 
random color function
+        * once the API gets figured out... */
+       unsigned char rgb[3];
+       fastf_t hsv[3] = { 0.0, 0.5, 0.95 };
+       double golden_ratio_conjugate = 0.618033988749895;
+       fastf_t h = drand48();
+       h = fmod(h+golden_ratio_conjugate,1.0);
+       *hsv = h * 360.0;
+       bu_hsv_to_rgb(hsv,rgb);
+       (void)mk_addmember(bu_vls_addr(&sname), &head.l, NULL, WMOP_UNION);
+       mk_comb(fd_out, bu_vls_addr(&rname), &head.l, 1, (char *)NULL, (char 
*)NULL, rgb, *it, 0, 0, 0, 0, 0, 0);
+       (void)mk_addmember(bu_vls_addr(&rname), &all_head.l, NULL, WMOP_UNION);
+       bu_vls_free(&sname);
+       bu_vls_free(&rname);
     }
 
+    mk_comb(fd_out, "all", &all_head.l, 0, (char *)NULL, (char *)NULL, NULL, 
0, 0, 0, 0, 0, 0, 0);
 
     wdb_close(fd_out);
     rt_clean_resource_complete(NULL, &rt_uniresource);

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


------------------------------------------------------------------------------
_______________________________________________
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to