Revision: 76076
http://sourceforge.net/p/brlcad/code/76076
Author: starseeker
Date: 2020-06-08 20:10:58 +0000 (Mon, 08 Jun 2020)
Log Message:
-----------
move the mc version as well
Modified Paths:
--------------
brlcad/trunk/include/gcv/util.h
brlcad/trunk/include/rt/tree.h
brlcad/trunk/src/conv/CMakeLists.txt
brlcad/trunk/src/conv/g-egg.c
brlcad/trunk/src/conv/raw/g-raw.c
brlcad/trunk/src/conv/stl/g-stl.c
brlcad/trunk/src/libgcv/CMakeLists.txt
brlcad/trunk/src/libgcv/plugins/stl/stl_write.c
brlcad/trunk/src/librt/CMakeLists.txt
Added Paths:
-----------
brlcad/trunk/src/librt/region_end_mc.c
Removed Paths:
-------------
brlcad/trunk/src/libgcv/region_end_mc.c
Modified: brlcad/trunk/include/gcv/util.h
===================================================================
--- brlcad/trunk/include/gcv/util.h 2020-06-08 19:45:04 UTC (rev 76075)
+++ brlcad/trunk/include/gcv/util.h 2020-06-08 20:10:58 UTC (rev 76076)
@@ -57,12 +57,6 @@
GCV_EXPORT extern int gcv_bot_is_orientable(const struct rt_bot_internal *bot);
-/**
- * Exact same as gcv_region_end, except using the marching cubes algorithm.
- */
-GCV_EXPORT extern union tree *gcv_region_end_mc(struct db_tree_state *tsp,
const struct db_full_path *pathp, union tree *curtree, void *client_data);
-
-
GCV_EXPORT extern union tree *gcv_bottess_region_end(struct db_tree_state
*tsp, const struct db_full_path *pathp, union tree *curtree, void *client_data);
Modified: brlcad/trunk/include/rt/tree.h
===================================================================
--- brlcad/trunk/include/rt/tree.h 2020-06-08 19:45:04 UTC (rev 76075)
+++ brlcad/trunk/include/rt/tree.h 2020-06-08 20:10:58 UTC (rev 76076)
@@ -796,6 +796,11 @@
*/
RT_EXPORT extern union tree *rt_region_end(struct db_tree_state *tsp, const
struct db_full_path *pathp, union tree *curtree, void *client_data);
+/**
+ * Exact same as rt_region_end, except using the marching cubes algorithm.
+ */
+RT_EXPORT extern union tree *rt_region_end_mc(struct db_tree_state *tsp, const
struct db_full_path *pathp, union tree *curtree, void *client_data);
+
__END_DECLS
#endif /* RT_TREE_H */
Modified: brlcad/trunk/src/conv/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/conv/CMakeLists.txt 2020-06-08 19:45:04 UTC (rev
76075)
+++ brlcad/trunk/src/conv/CMakeLists.txt 2020-06-08 20:10:58 UTC (rev
76076)
@@ -57,10 +57,8 @@
BRLCAD_ADDEXEC(g-dot g-dot.c "libged;libbu")
BRLCAD_ADDEXEC(g-dxf dxf/g-dxf.c "librt;libgcv;libnmg;libbu")
-add_dependencies(g-dxf libgcv_plugins)
-BRLCAD_ADDEXEC(g-egg g-egg.c "libwdb;libgcv;libnmg")
-add_dependencies(g-egg libgcv_plugins)
+BRLCAD_ADDEXEC(g-egg g-egg.c "libwdb;librt;libgcv;libnmg")
BRLCAD_ADDEXEC(g-nff g-nff.c "libwdb;libnmg;${M_LIBRARY}")
Modified: brlcad/trunk/src/conv/g-egg.c
===================================================================
--- brlcad/trunk/src/conv/g-egg.c 2020-06-08 19:45:04 UTC (rev 76075)
+++ brlcad/trunk/src/conv/g-egg.c 2020-06-08 20:10:58 UTC (rev 76076)
@@ -38,8 +38,6 @@
#include <string.h>
#include "bio.h"
-#include "gcv.h"
-
/* interface headers */
#include "bu/app.h"
#include "bu/getopt.h"
@@ -46,6 +44,7 @@
#include "vmath.h"
#include "nmg.h"
#include "rt/geom.h"
+#include "rt/tree.h"
#include "raytrace.h"
#include "gcv.h"
@@ -327,7 +326,7 @@
ncpu, /* ncpu */
&tree_state, /* state */
NULL, /* start func */
-
use_mc?gcv_region_end_mc:use_bottess?gcv_bottess_region_end:rt_region_end, /*
end func */
+
use_mc?rt_region_end_mc:use_bottess?gcv_bottess_region_end:rt_region_end, /*
end func */
use_mc?NULL:nmg_booltree_leaf_tess, /* leaf func */
(void *)&gcvwriter); /* client_data */
fprintf(conv_data.fp, "}\n");
Modified: brlcad/trunk/src/conv/raw/g-raw.c
===================================================================
--- brlcad/trunk/src/conv/raw/g-raw.c 2020-06-08 19:45:04 UTC (rev 76075)
+++ brlcad/trunk/src/conv/raw/g-raw.c 2020-06-08 20:10:58 UTC (rev 76076)
@@ -349,7 +349,7 @@
1,
&tree_state,
0, /* take all regions */
- use_mc?gcv_region_end_mc:rt_region_end,
+ use_mc?rt_region_end_mc:rt_region_end,
use_mc?NULL:nmg_booltree_leaf_tess,
(void *)&gcvwriter);
Modified: brlcad/trunk/src/conv/stl/g-stl.c
===================================================================
--- brlcad/trunk/src/conv/stl/g-stl.c 2020-06-08 19:45:04 UTC (rev 76075)
+++ brlcad/trunk/src/conv/stl/g-stl.c 2020-06-08 20:10:58 UTC (rev 76076)
@@ -44,6 +44,7 @@
#include "vmath.h"
#include "nmg.h"
#include "rt/geom.h"
+#include "rt/tree.h"
#include "raytrace.h"
#include "gcv.h"
@@ -474,7 +475,7 @@
1,
&tree_state,
0, /* take all regions */
- use_mc?gcv_region_end_mc:rt_region_end,
+ use_mc?rt_region_end_mc:rt_region_end,
use_mc?NULL:nmg_booltree_leaf_tess,
(void *)&gcvwriter);
Modified: brlcad/trunk/src/libgcv/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/libgcv/CMakeLists.txt 2020-06-08 19:45:04 UTC (rev
76075)
+++ brlcad/trunk/src/libgcv/CMakeLists.txt 2020-06-08 20:10:58 UTC (rev
76076)
@@ -21,7 +21,6 @@
bottess.c
facetize.c
gcv.c
- region_end_mc.c
tri_intersect.c
)
Modified: brlcad/trunk/src/libgcv/plugins/stl/stl_write.c
===================================================================
--- brlcad/trunk/src/libgcv/plugins/stl/stl_write.c 2020-06-08 19:45:04 UTC
(rev 76075)
+++ brlcad/trunk/src/libgcv/plugins/stl/stl_write.c 2020-06-08 20:10:58 UTC
(rev 76076)
@@ -414,7 +414,7 @@
1,
&tree_state,
0, /* take all regions */
- (gcv_options->tessellation_algorithm ==
GCV_TESS_MARCHING_CUBES)?gcv_region_end_mc:rt_region_end,
+ (gcv_options->tessellation_algorithm ==
GCV_TESS_MARCHING_CUBES)?rt_region_end_mc:rt_region_end,
(gcv_options->tessellation_algorithm ==
GCV_TESS_MARCHING_CUBES)?NULL:nmg_booltree_leaf_tess,
(void *)&gcvwriter);
Deleted: brlcad/trunk/src/libgcv/region_end_mc.c
===================================================================
--- brlcad/trunk/src/libgcv/region_end_mc.c 2020-06-08 19:45:04 UTC (rev
76075)
+++ brlcad/trunk/src/libgcv/region_end_mc.c 2020-06-08 20:10:58 UTC (rev
76076)
@@ -1,207 +0,0 @@
-/* R E G I O N _ E N D _ M C . C
- * BRL-CAD
- *
- * Copyright (c) 2008-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this file; see the file named COPYING for more
- * information.
- */
-
-/** @file libgcv/region_end.c
- *
- * Routines to process regions during a db_walk_tree using the marching cubes
- * algorithm.
- *
- */
-
-#include "common.h"
-
-#include "bu/parallel.h"
-#include "rt/rt_instance.h"
-#include "rt/tree.h"
-#include "gcv.h"
-
-union tree *
-_gcv_cleanup(int state, union tree *tp)
-{
- /* restore previous debug state */
- nmg_debug = state;
-
- /* Dispose of original tree, so that all associated dynamic memory
- * is released now, not at the end of all regions. A return of
- * TREE_NULL from this routine signals an error, and there is no
- * point to adding _another_ message to our output, so we need to
- * cons up an OP_NOP node to return.
- */
- db_free_tree(tp, &rt_uniresource); /* Does an nmg_kr() */
-
- BU_ALLOC(tp, union tree);
- RT_TREE_INIT(tp);
- tp->tr_op = OP_NOP;
- return tp;
-}
-
-union tree *
-gcv_region_end_mc(struct db_tree_state *tsp, const struct db_full_path *pathp,
union tree *curtree, void *client_data)
-{
- union tree *tp = NULL;
- struct model *m = NULL;
- struct nmgregion *r = NULL;
- struct shell *s = NULL;
- struct bu_list vhead;
-
- int empty_region = 0;
- int empty_model = 0;
- int NMG_debug_state = 0;
- int count = 0;
-
- struct rt_region_end_data *data = (struct rt_region_end_data *)client_data;
-
- if (!tsp || !pathp || !client_data) {
- bu_log("INTERNAL ERROR: gcv_region_end_mc missing parameters\n");
- return TREE_NULL;
- }
-
- if (!data->write_region) {
- bu_log("INTERNAL ERROR: gcv_region_end missing conversion callback
function\n");
- return TREE_NULL;
- }
-
- RT_CK_FULL_PATH(pathp);
- RT_CK_TREE(curtree);
- BG_CK_TESS_TOL(tsp->ts_ttol);
- BN_CK_TOL(tsp->ts_tol);
- NMG_CK_MODEL(*tsp->ts_m);
-
- BU_LIST_INIT(&vhead);
-
- /*
- if (curtree->tr_op == OP_NOP)
- return 0;
- */
-
-
- /* get a copy to play with as the parameters might get clobbered
- * by a longjmp. FIXME: db_dup_subtree() doesn't create real copies
- */
- tp = db_dup_subtree(curtree, &rt_uniresource);
-
- /* FIXME: we can't free curtree until we get a "real" copy form
- * db_dup_subtree(). right now we get a fake copy just so we can
- * keep the compiler quiet about clobbering curtree during longjmp
- */
- /* db_free_tree(curtree, &rt_uniresource); */
-
- /* Sometimes the NMG library adds debugging bits when it detects
- * an internal error, before bombing. Stash.
- */
- NMG_debug_state = nmg_debug;
-
- m = nmg_mmr();
- r = nmg_mrsv(m);
- s = BU_LIST_FIRST(shell, &r->s_hd);
-
- if (tsp->ts_rtip == NULL)
- tsp->ts_rtip = rt_new_rti(tsp->ts_dbip);
-
- count += nmg_mc_evaluate (s, tsp->ts_rtip, pathp, tsp->ts_ttol,
tsp->ts_tol);
-
- /* empty region? */
- if (count == 0) {
- char *str_path = db_path_to_string(pathp);
- bu_log("Region %s appears to be empty.\n", str_path);
- bu_free(str_path, "str_path");
- return TREE_NULL;
- }
-
- /*
- bu_log("Target is shot, %d triangles seen.\n", count);
-
- bu_log("Fusing\n"); fflush(stdout);
- nmg_model_fuse(m, tsp->ts_tol);
- bu_log("Done\n"); fflush(stdout);
- */
-
- /* Kill cracks */
- while (BU_LIST_NOT_HEAD(&s->l, &r->s_hd)) {
- struct shell *next_s;
-
- next_s = BU_LIST_PNEXT(shell, &s->l);
- if (nmg_kill_cracks(s)) {
- if (nmg_ks(s)) {
- empty_region = 1;
- break;
- }
- }
- /*
- nmg_shell_coplanar_face_merge(s, tsp->ts_tol, 42);
- */
- s = next_s;
- }
- if (empty_region)
- return _gcv_cleanup(NMG_debug_state, tp);
-
- /* kill zero length edgeuses */
- empty_model = nmg_kill_zero_length_edgeuses(*tsp->ts_m);
- if (empty_model)
- return _gcv_cleanup(NMG_debug_state, tp);
-
- if (!BU_SETJUMP) {
- /* try */
- /* Write the region out */
- data->write_region(r, pathp, tsp->ts_regionid, tsp->ts_gmater,
tsp->ts_mater.ma_color, data->client_data);
- } else {
- /* catch */
- /* Error, bail out */
- char *sofar;
-
- /* Relinquish bomb protection */
- BU_UNSETJUMP;
-
- sofar = db_path_to_string(pathp);
- bu_log("FAILED in triangulator: %s\n", sofar);
- bu_free((char *)sofar, "sofar");
-
- /* Release any intersector 2d tables */
- nmg_isect2d_final_cleanup();
-
- /* Get rid of (m)any other intermediate structures */
- if ((*tsp->ts_m)->magic == NMG_MODEL_MAGIC)
- nmg_km(*tsp->ts_m);
- else
- bu_log("WARNING: tsp->ts_m pointer corrupted, ignoring it.\n");
-
- /* Now, make a new, clean model structure for next pass. */
- *tsp->ts_m = nmg_mm();
- nmg_kr(r);
-
- return _gcv_cleanup(NMG_debug_state, tp);
-
- } BU_UNSETJUMP; /* Relinquish bomb protection */
-
- nmg_kr(r);
-
- return _gcv_cleanup(NMG_debug_state, tp);
-}
-
-
-/*
- * Local Variables:
- * tab-width: 8
- * mode: C
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */
Modified: brlcad/trunk/src/librt/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/librt/CMakeLists.txt 2020-06-08 19:45:04 UTC (rev
76075)
+++ brlcad/trunk/src/librt/CMakeLists.txt 2020-06-08 20:10:58 UTC (rev
76076)
@@ -212,6 +212,7 @@
reduce.c
reduce_db.cpp
region_end.c
+ region_end_mc.c
regionfix.c
roots.c
search.c
Copied: brlcad/trunk/src/librt/region_end_mc.c (from rev 76075,
brlcad/trunk/src/libgcv/region_end_mc.c)
===================================================================
--- brlcad/trunk/src/librt/region_end_mc.c (rev 0)
+++ brlcad/trunk/src/librt/region_end_mc.c 2020-06-08 20:10:58 UTC (rev
76076)
@@ -0,0 +1,206 @@
+/* R E G I O N _ E N D _ M C . C
+ * BRL-CAD
+ *
+ * Copyright (c) 2008-2020 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+
+/** @file librt/region_end.c
+ *
+ * Routines to process regions during a db_walk_tree using the marching cubes
+ * algorithm.
+ *
+ */
+
+#include "common.h"
+
+#include "bu/parallel.h"
+#include "rt/rt_instance.h"
+#include "rt/tree.h"
+
+static union tree *
+_rt_cleanup(int state, union tree *tp)
+{
+ /* restore previous debug state */
+ nmg_debug = state;
+
+ /* Dispose of original tree, so that all associated dynamic memory
+ * is released now, not at the end of all regions. A return of
+ * TREE_NULL from this routine signals an error, and there is no
+ * point to adding _another_ message to our output, so we need to
+ * cons up an OP_NOP node to return.
+ */
+ db_free_tree(tp, &rt_uniresource); /* Does an nmg_kr() */
+
+ BU_ALLOC(tp, union tree);
+ RT_TREE_INIT(tp);
+ tp->tr_op = OP_NOP;
+ return tp;
+}
+
+union tree *
+rt_region_end_mc(struct db_tree_state *tsp, const struct db_full_path *pathp,
union tree *curtree, void *client_data)
+{
+ union tree *tp = NULL;
+ struct model *m = NULL;
+ struct nmgregion *r = NULL;
+ struct shell *s = NULL;
+ struct bu_list vhead;
+
+ int empty_region = 0;
+ int empty_model = 0;
+ int NMG_debug_state = 0;
+ int count = 0;
+
+ struct rt_region_end_data *data = (struct rt_region_end_data *)client_data;
+
+ if (!tsp || !pathp || !client_data) {
+ bu_log("INTERNAL ERROR: rt_region_end_mc missing parameters\n");
+ return TREE_NULL;
+ }
+
+ if (!data->write_region) {
+ bu_log("INTERNAL ERROR: rt_region_end missing conversion callback
function\n");
+ return TREE_NULL;
+ }
+
+ RT_CK_FULL_PATH(pathp);
+ RT_CK_TREE(curtree);
+ BG_CK_TESS_TOL(tsp->ts_ttol);
+ BN_CK_TOL(tsp->ts_tol);
+ NMG_CK_MODEL(*tsp->ts_m);
+
+ BU_LIST_INIT(&vhead);
+
+ /*
+ if (curtree->tr_op == OP_NOP)
+ return 0;
+ */
+
+
+ /* get a copy to play with as the parameters might get clobbered
+ * by a longjmp. FIXME: db_dup_subtree() doesn't create real copies
+ */
+ tp = db_dup_subtree(curtree, &rt_uniresource);
+
+ /* FIXME: we can't free curtree until we get a "real" copy form
+ * db_dup_subtree(). right now we get a fake copy just so we can
+ * keep the compiler quiet about clobbering curtree during longjmp
+ */
+ /* db_free_tree(curtree, &rt_uniresource); */
+
+ /* Sometimes the NMG library adds debugging bits when it detects
+ * an internal error, before bombing. Stash.
+ */
+ NMG_debug_state = nmg_debug;
+
+ m = nmg_mmr();
+ r = nmg_mrsv(m);
+ s = BU_LIST_FIRST(shell, &r->s_hd);
+
+ if (tsp->ts_rtip == NULL)
+ tsp->ts_rtip = rt_new_rti(tsp->ts_dbip);
+
+ count += nmg_mc_evaluate (s, tsp->ts_rtip, pathp, tsp->ts_ttol,
tsp->ts_tol);
+
+ /* empty region? */
+ if (count == 0) {
+ char *str_path = db_path_to_string(pathp);
+ bu_log("Region %s appears to be empty.\n", str_path);
+ bu_free(str_path, "str_path");
+ return TREE_NULL;
+ }
+
+ /*
+ bu_log("Target is shot, %d triangles seen.\n", count);
+
+ bu_log("Fusing\n"); fflush(stdout);
+ nmg_model_fuse(m, tsp->ts_tol);
+ bu_log("Done\n"); fflush(stdout);
+ */
+
+ /* Kill cracks */
+ while (BU_LIST_NOT_HEAD(&s->l, &r->s_hd)) {
+ struct shell *next_s;
+
+ next_s = BU_LIST_PNEXT(shell, &s->l);
+ if (nmg_kill_cracks(s)) {
+ if (nmg_ks(s)) {
+ empty_region = 1;
+ break;
+ }
+ }
+ /*
+ nmg_shell_coplanar_face_merge(s, tsp->ts_tol, 42);
+ */
+ s = next_s;
+ }
+ if (empty_region)
+ return _rt_cleanup(NMG_debug_state, tp);
+
+ /* kill zero length edgeuses */
+ empty_model = nmg_kill_zero_length_edgeuses(*tsp->ts_m);
+ if (empty_model)
+ return _rt_cleanup(NMG_debug_state, tp);
+
+ if (!BU_SETJUMP) {
+ /* try */
+ /* Write the region out */
+ data->write_region(r, pathp, tsp->ts_regionid, tsp->ts_gmater,
tsp->ts_mater.ma_color, data->client_data);
+ } else {
+ /* catch */
+ /* Error, bail out */
+ char *sofar;
+
+ /* Relinquish bomb protection */
+ BU_UNSETJUMP;
+
+ sofar = db_path_to_string(pathp);
+ bu_log("FAILED in triangulator: %s\n", sofar);
+ bu_free((char *)sofar, "sofar");
+
+ /* Release any intersector 2d tables */
+ nmg_isect2d_final_cleanup();
+
+ /* Get rid of (m)any other intermediate structures */
+ if ((*tsp->ts_m)->magic == NMG_MODEL_MAGIC)
+ nmg_km(*tsp->ts_m);
+ else
+ bu_log("WARNING: tsp->ts_m pointer corrupted, ignoring it.\n");
+
+ /* Now, make a new, clean model structure for next pass. */
+ *tsp->ts_m = nmg_mm();
+ nmg_kr(r);
+
+ return _rt_cleanup(NMG_debug_state, tp);
+
+ } BU_UNSETJUMP; /* Relinquish bomb protection */
+
+ nmg_kr(r);
+
+ return _rt_cleanup(NMG_debug_state, tp);
+}
+
+
+/*
+ * Local Variables:
+ * tab-width: 8
+ * mode: C
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits