Revision: 45770
http://brlcad.svn.sourceforge.net/brlcad/?rev=45770&view=rev
Author: r_weiss
Date: 2011-08-03 17:31:06 +0000 (Wed, 03 Aug 2011)
Log Message:
-----------
Added a new function 'nmg_keu_zl' which removes all zero length edgeuse from an
nmg shell. This was added into file 'nmg_mk.c'. This function is disabled by
default and supports the prototype version of 'nmg_triangulate_fu'. This is a
work in progress.
Modified Paths:
--------------
brlcad/trunk/src/librt/primitives/nmg/nmg_mk.c
Modified: brlcad/trunk/src/librt/primitives/nmg/nmg_mk.c
===================================================================
--- brlcad/trunk/src/librt/primitives/nmg/nmg_mk.c 2011-08-03 17:28:01 UTC
(rev 45769)
+++ brlcad/trunk/src/librt/primitives/nmg/nmg_mk.c 2011-08-03 17:31:06 UTC
(rev 45770)
@@ -3140,6 +3140,91 @@
}
+#ifdef TRI_PROTOTYPE
+/**
+ * n m g _ k e u _ z l
+ *
+ * Kill zero length edgeuse from a shell and
+ * return the number of edgeuse killed. If the
+ * shell becomes empty, this function will bomb.
+ *
+ */
+int
+nmg_keu_zl(struct shell *s, const struct bn_tol *tol)
+{
+ int empty_loop = 0;
+ int empty_face = 0;
+ int empty_shell = 0;
+ int eu_killed = 0;
+ struct loopuse *lu;
+ struct faceuse *fu;
+ struct edgeuse *eu;
+
+ NMG_CK_SHELL(s);
+
+ eu_killed = 0;
+ empty_shell = 0;
+ fu = BU_LIST_FIRST(faceuse, &s->fu_hd);
+ while(BU_LIST_NOT_HEAD(fu, &s->fu_hd)) {
+ NMG_CK_FACEUSE(fu);
+ if (fu->orientation != OT_SAME) {
+ fu = BU_LIST_PNEXT(faceuse, fu);
+ continue;
+ }
+ empty_face = 0;
+ lu = BU_LIST_FIRST(loopuse, &fu->lu_hd);
+ while(BU_LIST_NOT_HEAD(lu, &fu->lu_hd)) {
+ NMG_CK_LOOPUSE(lu);
+ if (BU_LIST_FIRST_MAGIC(&lu->down_hd) != NMG_EDGEUSE_MAGIC) {
+ bu_bomb("loopuse does not contains edgeuse\n");
+ }
+ empty_loop = 0;
+ eu = BU_LIST_FIRST(edgeuse, &lu->down_hd);
+ while(BU_LIST_NOT_HEAD(eu, &lu->down_hd)) {
+ NMG_CK_EDGEUSE(eu);
+ if ((eu->vu_p->v_p->vg_p == eu->eumate_p->vu_p->v_p->vg_p) ||
+ bn_pt3_pt3_equal(eu->vu_p->v_p->vg_p->coord,
+ eu->eumate_p->vu_p->v_p->vg_p->coord,
tol)) {
+ /* fuse the two vertices */
+ nmg_jv(eu->vu_p->v_p, eu->eumate_p->vu_p->v_p);
+
+ eu_killed++;
+ if (nmg_keu(eu)) {
+ empty_loop = 1;
+ }
+ eu = BU_LIST_FIRST(edgeuse, &lu->down_hd);
+ } else {
+ eu = BU_LIST_PNEXT(edgeuse, eu);
+ }
+ }
+ if (empty_loop) {
+ if (nmg_klu(lu)) {
+ empty_face = 1;
+ }
+ lu = BU_LIST_FIRST(loopuse, &fu->lu_hd);
+ } else {
+ lu = BU_LIST_PNEXT(loopuse, lu);
+ }
+ }
+
+ if (empty_face) {
+ if (nmg_kfu(fu)) {
+ empty_shell = 1;
+ }
+ fu = BU_LIST_FIRST(faceuse, &s->fu_hd);
+ } else {
+ fu = BU_LIST_PNEXT(faceuse, fu);
+ }
+ }
+
+ if (empty_shell) {
+ bu_bomb("nmg_keu_zl(): removing zero length edgeuse resulted in an
empty shell\n");
+ }
+
+ return eu_killed;
+}
+#endif
+
/*
* Local Variables:
* mode: C
@@ -3149,3 +3234,4 @@
* End:
* ex: shiftwidth=4 tabstop=8
*/
+
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts.
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits