Revision: 56565
          http://sourceforge.net/p/brlcad/code/56565
Author:   brlcad
Date:     2013-08-05 06:54:27 +0000 (Mon, 05 Aug 2013)
Log Message:
-----------
three more dead code functions from nmg, though two are relatively recent and 
may need revisiting at some point later.

Modified Paths:
--------------
    brlcad/trunk/src/librt/primitives/nmg/nmg_inter.c

Modified: brlcad/trunk/src/librt/primitives/nmg/nmg_inter.c
===================================================================
--- brlcad/trunk/src/librt/primitives/nmg/nmg_inter.c   2013-08-05 06:24:46 UTC 
(rev 56564)
+++ brlcad/trunk/src/librt/primitives/nmg/nmg_inter.c   2013-08-05 06:54:27 UTC 
(rev 56565)
@@ -2865,152 +2865,6 @@
 
 
 /**
- * N M G _ I S E C T _ T W O _ F A C E 2 P
- *
- * Manage the mutual intersection of two 3-D coplanar planar faces.
- *
- * The big challenge in this routine comes from the fact that
- * loopuses can come and go as the facecutter operates.
- * Thus, after a call to nmg_isect_edge2p_face2p(), the current
- * loopuse structure may be invalid.
- * The intersection operations being performed here never delete
- * edgeuses, only split existing ones and add new ones.
- * It might reduce complexity to unbreak edges in here, but that
- * would violate the assumption of edgeuses not vanishing.
- *
- * Called by -
- * nmg_isect_two_generic_faces()
- *
- * Call tree -
- * nmg_isect_vert2p_face2p()
- * nmg_isect_edge2p_face2p()
- *             nmg_isect_vert2p_face2p()
- *             nmg_isect_line2_face2p()
- *             nmg_purge_unwanted_intersection_points()
- *             nmg_face_cutjoin()
- */
-#if 0
-static void
-nmg_isect_two_face2p(is, fu1, fu2)
-    struct nmg_inter_struct *is;
-    struct faceuse *fu1, *fu2;
-{
-    struct model *m;
-    struct loopuse *lu;
-    struct edgeuse *eu;
-    struct vertexuse *vu;
-    unsigned char *tags;
-    int tagsize;
-
-    NMG_CK_INTER_STRUCT(is);
-    NMG_CK_FACEUSE(fu1);
-    NMG_CK_FACEUSE(fu2);
-    m = fu1->s_p->r_p->m_p;
-    NMG_CK_MODEL(m);
-
-    is->l1 = 0;
-    is->l2 = 0;
-    is->fu1 = fu1;
-    is->fu2 = fu2;
-
-    if (RTG.NMG_debug & DEBUG_POLYSECT)
-       bu_log("nmg_isect_two_face2p(fu1=x%x, fu2=x%x) START\n", fu1, fu2);
-
-    /* Allocate map of edgegeom's visited */
-    tagsize = 4 * m->maxindex+1;
-    tags = (unsigned char *)bu_calloc(tagsize, 1, "nmg_isect_two_face2p() 
tags[]");
-
-/* XXX A vastly better strategy would be to build a list of vu's and eu's,
- * XXX and then intersect them with the other face.
- * XXX loopuses can come and go as loops get cutjoin'ed, but at this
- * XXX stage edgeuses are created, but never deleted.
- * XXX This way, the process should converge in 2 iterations, rather than N.
- */
-
-    /* For every edge in f1, intersect with f2, incl. cutjoin */
-    memset((char *)tags, 0, tagsize);
-f1_again:
-    if (RTG.NMG_debug & DEBUG_VERIFY) {
-       nmg_fu_touchingloops(fu1);
-       nmg_fu_touchingloops(fu2);
-       nmg_region_v_unique(fu1->s_p->r_p, &is->tol);
-       nmg_region_v_unique(fu2->s_p->r_p, &is->tol);
-    }
-    for (BU_LIST_FOR(lu, loopuse, &fu1->lu_hd)) {
-       NMG_CK_LOOPUSE(lu);
-       if (BU_LIST_FIRST_MAGIC(&lu->down_hd) == NMG_VERTEXUSE_MAGIC) {
-           is->l1 = 0;
-           is->l2 = 0;
-           vu = BU_LIST_FIRST(vertexuse, &lu->down_hd);
-           if (!NMG_INDEX_FIRST_TIME(tags, vu->v_p)) continue;
-           nmg_isect_vert2p_face2p(is, vu, fu2);
-           continue;
-       }
-       for (BU_LIST_FOR(eu, edgeuse, &lu->down_hd)) {
-           struct edge_g_lseg *eg;
-
-           NMG_CK_EDGEUSE(eu);
-           eg = eu->g.lseg_p;
-           /* If this eu's eg has been seen before, skip on. */
-           if (eg && !NMG_INDEX_FIRST_TIME(tags, eg)) continue;
-
-           if (nmg_isect_edge2p_face2p(is, eu, fu2, fu1)) {
-               /* Face topologies have changed */
-               /* This loop might have been joined into another loopuse! */
-               /* XXX Might want to unbreak edges? */
-               goto f1_again;
-           }
-       }
-    }
-
-    /* Zap 2d cache, we are switching faces now */
-    nmg_isect2d_cleanup(is);
-
-    /* For every edge in f2, intersect with f1, incl. cutjoin */
-    memset((char *)tags, 0, tagsize);
-f2_again:
-    if (RTG.NMG_debug & DEBUG_VERIFY) {
-       nmg_fu_touchingloops(fu1);
-       nmg_fu_touchingloops(fu2);
-       nmg_region_v_unique(fu1->s_p->r_p, &is->tol);
-       nmg_region_v_unique(fu2->s_p->r_p, &is->tol);
-    }
-    for (BU_LIST_FOR(lu, loopuse, &fu2->lu_hd)) {
-       NMG_CK_LOOPUSE(lu);
-       if (BU_LIST_FIRST_MAGIC(&lu->down_hd) == NMG_VERTEXUSE_MAGIC) {
-           is->l1 = 0;
-           is->l2 = 0;
-           vu = BU_LIST_FIRST(vertexuse, &lu->down_hd);
-           if (!NMG_INDEX_FIRST_TIME(tags, vu->v_p)) continue;
-           nmg_isect_vert2p_face2p(is, vu, fu1);
-           continue;
-       }
-       for (BU_LIST_FOR(eu, edgeuse, &lu->down_hd)) {
-           struct edge_g_lseg *eg;
-
-           NMG_CK_EDGEUSE(eu);
-           eg = eu->g.lseg_p;
-           /* If this eu's eg has been seen before, skip on. */
-           if (eg && !NMG_INDEX_FIRST_TIME(tags, eg)) continue;
-
-           if (nmg_isect_edge2p_face2p(is, eu, fu1, fu2)) {
-               /* Face topologies have changed */
-               goto f2_again;
-           }
-       }
-    }
-    if (RTG.NMG_debug & DEBUG_VERIFY) {
-       nmg_fu_touchingloops(fu1);
-       nmg_fu_touchingloops(fu2);
-       nmg_region_v_unique(fu1->s_p->r_p, &is->tol);
-       nmg_region_v_unique(fu2->s_p->r_p, &is->tol);
-    }
-    bu_free((char *)tags, "tags[]");
-    if (RTG.NMG_debug & DEBUG_POLYSECT)
-       bu_log("nmg_isect_two_face2p(fu1=x%x, fu2=x%x) END\n", fu1, fu2);
-}
-#endif
-/**
  * N M G _ I S E C T _ L I N E 2 _ E D G E 2 P
  *
  * A parallel to nmg_isect_edge2p_edge2p().
@@ -5643,412 +5497,8 @@
 }
 
 
-/* nmg_isect_coplanar_edges is disabled because it is unused since
- * it was only called by nmg_isect_nearly_coplanar_faces which has
- * been disabled due to it no longer being used.
- */
-#if 0
-static void
-nmg_isect_coplanar_edges(struct nmg_inter_struct *is, struct bu_ptbl 
*eu1_list, struct bu_ptbl *eu2_list)
-{
-    struct model *m;
-    struct loopuse *lu;
-    struct bu_ptbl v_list;
-    int i, j;
-    plane_t pl1, pl2;
 
-    if (RTG.NMG_debug & DEBUG_POLYSECT)
-       bu_log("nmg_isect_coplanar_edges START\n");
 
-    NMG_CK_INTER_STRUCT(is);
-    BU_CK_PTBL(eu1_list);
-    BU_CK_PTBL(eu2_list);
-
-    m = nmg_find_model(&is->fu1->l.magic);
-
-    NMG_GET_FU_PLANE(pl1, is->fu1);
-    NMG_GET_FU_PLANE(pl2, is->fu2);
-
-    if (RTG.NMG_debug & DEBUG_POLYSECT) {
-       bu_log("pl1 = %g %g %g %g\n", V4ARGS(pl1));
-       bu_log("pl2 = %g %g %g %g\n", V4ARGS(pl2));
-    }
-
-    /* First split all edgeuses that intersect */
-    for (i=0; i<BU_PTBL_END(eu1_list); i++) {
-       struct edgeuse *eu1;
-       double len_vt1;
-       vect_t vt1;
-       struct vertex_g *vg1a, *vg1b;
-
-       eu1 = (struct edgeuse *)BU_PTBL_GET(eu1_list, i);
-       NMG_CK_EDGEUSE(eu1);
-
-       vg1a = eu1->vu_p->v_p->vg_p;
-       NMG_CK_VERTEX_G(vg1a);
-       vg1b = eu1->eumate_p->vu_p->v_p->vg_p;
-       NMG_CK_VERTEX_G(vg1b);
-
-       if (RTG.NMG_debug & DEBUG_POLYSECT)
-           bu_log("Considering EU x%x (%g %g %g) <-> (%g %g %g)\n",
-                  eu1, V3ARGS(vg1a->coord), V3ARGS(vg1b->coord));
-
-       VSUB2(vt1, vg1b->coord, vg1a->coord);
-       len_vt1 = MAGNITUDE(vt1);
-       VSCALE(vt1, vt1, 1.0/len_vt1);
-
-       for (j=0; j<BU_PTBL_END(eu2_list); j++) {
-           struct edgeuse *eu2 = NULL;
-           struct vertex_g *vg2a = NULL;
-           struct vertex_g *vg2b = NULL;
-           int code = 0;
-           vect_t vt2 = VINIT_ZERO;
-           double len_vt2 = 0.0;
-           fastf_t dist[2] = V2INIT_ZERO;
-           point_t hit_pt = VINIT_ZERO;
-           int hit_no = 0;
-           int hit_count = 0;
-
-           struct vertex *hitv = NULL;
-           struct vertexuse *hit_vu = NULL;
-
-           eu2 = (struct edgeuse *)BU_PTBL_GET(eu2_list, j);
-           NMG_CK_EDGEUSE(eu2);
-
-           if (RTG.NMG_debug & DEBUG_POLYSECT)
-               bu_log("\tConsidering EU2 x%x (%g %g %g) <-> (%g %g %g)\n",
-                      eu2, V3ARGS(eu2->vu_p->v_p->vg_p->coord), 
V3ARGS(eu2->eumate_p->vu_p->v_p->vg_p->coord));
-
-           /* if these edges are radial, nothing to do */
-           if (eu1->vu_p->v_p == eu2->vu_p->v_p &&
-               eu1->eumate_p->vu_p->v_p == eu2->eumate_p->vu_p->v_p)
-               continue;
-
-           if (eu1->vu_p->v_p == eu2->eumate_p->vu_p->v_p &&
-               eu1->eumate_p->vu_p->v_p == eu2->vu_p->v_p)
-               continue;
-
-           vg2a = eu2->vu_p->v_p->vg_p;
-           NMG_CK_VERTEX_G(vg2a);
-           vg2b = eu2->eumate_p->vu_p->v_p->vg_p;
-           NMG_CK_VERTEX_G(vg2b);
-           VSUB2(vt2, vg2b->coord, vg2a->coord);
-           len_vt2 = MAGNITUDE(vt2);
-           VSCALE(vt2, vt2, 1.0/len_vt2);
-
-           code = bn_dist_line3_line3(dist, vg1a->coord, vt1,
-                                      vg2a->coord, vt2, &is->tol);
-
-           if (RTG.NMG_debug & DEBUG_POLYSECT)
-               bu_log("\tcode = %d\n", code);
-
-           if (code == (-2) || code == 1)
-               continue;
-
-           if (code == (-1)) {
-               fastf_t tmp;
-               vect_t tmp_vect;
-               fastf_t dist1[2];
-
-               hit_count = 0;
-
-               /* lines are colinear */
-               VSUB2(tmp_vect, vg2a->coord, vg1a->coord);
-               dist1[0] = VDOT(tmp_vect, vt1);
-               if (NEAR_ZERO(dist1[0], is->tol.dist))
-                   dist1[0] = 0.0;
-               else if (NEAR_EQUAL(dist1[0], len_vt1, is->tol.dist))
-                   dist1[0] = len_vt1;
-               VSUB2(tmp_vect, vg2b->coord, vg1a->coord);
-               dist1[1] = VDOT(tmp_vect, vt1);
-               if (NEAR_ZERO(dist1[1], is->tol.dist))
-                   dist1[1] = 0.0;
-               else if (NEAR_EQUAL(dist1[1], len_vt1, is->tol.dist))
-                   dist1[1] = len_vt1;
-
-               if ((dist1[0] >= 0.0 && dist1[0] <= len_vt1)) {
-                   dist[hit_count] = dist1[0];
-                   hit_count++;
-               }
-               if ((dist1[1] >= 0.0 && dist1[1] <= len_vt1)) {
-                   dist[hit_count] = dist1[1];
-                   hit_count++;
-               }
-
-               if (hit_count == 0)
-                   continue;
-
-               if (hit_count == 2 && dist[0] < dist[1]) {
-                   tmp = dist[0];
-                   dist[0] = dist[1];
-                   dist[1] = tmp;
-               }
-           } else {
-               if (NEAR_ZERO(dist[0], is->tol.dist))
-                   dist[0] = 0.0;
-               else if (NEAR_EQUAL(dist[0], len_vt1, is->tol.dist))
-                   dist[0] = len_vt1;
-               if (NEAR_ZERO(dist[1], is->tol.dist))
-                   dist[1] = 0.0;
-               else if (NEAR_EQUAL(dist[1], len_vt2, is->tol.dist))
-                   dist[1] = len_vt2;
-               if (dist[0] < 0.0 || dist[0] > len_vt1)
-                   continue;
-               if (dist[1] < 0.0 || dist[1] > len_vt2)
-                   continue;
-               hit_count = 1;
-           }
-
-           for (hit_no=0; hit_no < hit_count; hit_no++) {
-               struct edgeuse *new_eu;
-
-               if (RTG.NMG_debug & DEBUG_POLYSECT)
-                   bu_log("\tdist[%d] = %g\n", hit_no, dist[hit_no]);
-
-               hitv = (struct vertex *)NULL;
-               hit_vu = (struct vertexuse *)NULL;
-
-               if (ZERO(dist[hit_no])) {
-                   hit_vu = eu1->vu_p;
-                   hitv = hit_vu->v_p;
-                   VMOVE(hit_pt, hitv->vg_p->coord);
-               } else if (ZERO(dist[hit_no] - len_vt1)) {
-                   hit_vu = eu1->eumate_p->vu_p;
-                   hitv = hit_vu->v_p;
-                   VMOVE(hit_pt, hitv->vg_p->coord);
-               } else
-                   VJOIN1(hit_pt, vg1a->coord, dist[hit_no], vt1)
-
-                       if (RTG.NMG_debug & DEBUG_POLYSECT)
-                           bu_log("eus x%x and x%x intersect #%d at (%g %g 
%g)\n",
-                                  eu1, eu2, hit_no, V3ARGS(hit_pt));
-
-               if (!hit_vu)
-                   hit_vu = nmg_find_pt_in_face(is->fu2, hit_pt, &is->tol);
-
-               if (!hit_vu)
-                   hitv = 
nmg_find_pt_in_model(nmg_find_model(&is->fu1->l.magic), hit_pt, &is->tol);
-               else
-                   hitv = hit_vu->v_p;
-
-               if (RTG.NMG_debug & DEBUG_POLYSECT && hitv)
-                   bu_log("Found vertex (x%x) at hit_pt\n", hitv);
-
-               if (hitv != eu1->vu_p->v_p && hitv != eu1->eumate_p->vu_p->v_p) 
{
-                   if (RTG.NMG_debug & DEBUG_POLYSECT)
-                       bu_log("Splitting eu1 x%x\n", eu1);
-                   new_eu = nmg_esplit(hitv, eu1, 1);
-                   hitv = new_eu->vu_p->v_p;
-                   if (!hitv->vg_p)
-                       nmg_vertex_gv(hitv, hit_pt);
-                   vg1b = eu1->eumate_p->vu_p->v_p->vg_p;
-                   VSUB2(vt1, vg1b->coord, vg1a->coord);
-                   len_vt1 = MAGNITUDE(vt1);
-                   VSCALE(vt1, vt1, 1.0/len_vt1);
-                   bu_ptbl_ins(eu1_list, (long *)new_eu);
-               }
-               if (code == 0 && hitv != eu2->vu_p->v_p && hitv != 
eu2->eumate_p->vu_p->v_p) {
-                   if (RTG.NMG_debug & DEBUG_POLYSECT)
-                       bu_log("Splitting eu2 x%x at hitv = x%x\n",  eu2, hitv);
-                   new_eu = nmg_esplit(hitv, eu2, 1);
-                   hitv = new_eu->vu_p->v_p;
-                   if (!hitv->vg_p)
-                       nmg_vertex_gv(hitv, hit_pt);
-                   bu_ptbl_ins(eu2_list, (long *)new_eu);
-               }
-
-               if (hitv)
-                   (void)nmg_break_all_es_on_v(&m->magic, hitv, &is->tol);
-           }
-       }
-    }
-
-    bu_ptbl_free(eu1_list);
-    bu_ptbl_free(eu2_list);
-
-    /* Make sure every vertex in fu1 has dual in fu2
-     * (if they overlap)
-     */
-    nmg_vertex_tabulate(&v_list, &is->fu1->l.magic);
-
-    for (i=0; i<BU_PTBL_END(&v_list); i++) {
-       struct vertex *v;
-       int class;
-
-       v = (struct vertex *)BU_PTBL_GET(&v_list, i);
-       NMG_CK_VERTEX(v);
-
-       if (nmg_find_v_in_face(v, is->fu2))
-           continue;
-
-       /* Check if this vertex is within other FU */
-       if (!NEAR_ZERO(DIST_PT_PLANE(v->vg_p->coord, pl2), is->tol.dist))
-           continue;
-
-       class = nmg_class_pt_fu_except(v->vg_p->coord, is->fu2, NULL, NULL, 
NULL,
-                                      (char *)NULL, 0, 0, &is->tol);
-
-       if (class == NMG_CLASS_AinB) {
-           if (RTG.NMG_debug & DEBUG_POLYSECT)
-               bu_log("Making dualvu of vertex x%x in is->fu2 x%x\n", v, 
is->fu2);
-           (void)nmg_make_dualvu(v, is->fu2, &is->tol);
-       }
-    }
-    bu_ptbl_reset(&v_list);
-
-    /* same for fu2 */
-    nmg_vertex_tabulate(&v_list, &is->fu2->l.magic);
-
-    for (i=0; i<BU_PTBL_END(&v_list); i++) {
-       struct vertex *v;
-       int class;
-
-       v = (struct vertex *)BU_PTBL_GET(&v_list, i);
-       NMG_CK_VERTEX(v);
-
-       if (nmg_find_v_in_face(v, is->fu1))
-           continue;
-
-       /* Check if this vertex is within other FU */
-       if (!NEAR_ZERO(DIST_PT_PLANE(v->vg_p->coord, pl1), is->tol.dist))
-           continue;
-
-       class = nmg_class_pt_fu_except(v->vg_p->coord, is->fu1, NULL, NULL, 
NULL,
-                                      (char *)NULL, 0, 0, &is->tol);
-
-       if (class == NMG_CLASS_AinB) {
-           if (RTG.NMG_debug & DEBUG_POLYSECT)
-               bu_log("Making dualvu of vertex x%x in fu1 x%x\n", v, is->fu1);
-           (void)nmg_make_dualvu(v, is->fu1, &is->tol);
-       }
-    }
-
-    bu_ptbl_free(&v_list);
-
-    bu_ptbl_reset(is->l1);
-    bu_ptbl_reset(is->l2);
-
-    for (BU_LIST_FOR(lu, loopuse, &is->fu1->lu_hd)) {
-       struct edgeuse *eu;
-
-       NMG_CK_LOOPUSE(lu);
-
-       if (BU_LIST_FIRST_MAGIC(&lu->down_hd) != NMG_EDGEUSE_MAGIC)
-           continue;
-
-       for (BU_LIST_FOR(eu, edgeuse, &lu->down_hd)) {
-           struct vertexuse *vu;
-           struct vertex *v1, *v2;
-
-           NMG_CK_EDGEUSE(eu);
-
-           v1 = eu->vu_p->v_p;
-           NMG_CK_VERTEX(v1);
-           v2 = eu->eumate_p->vu_p->v_p;
-           NMG_CK_VERTEX(v2);
-
-           if (!NEAR_ZERO(DIST_PT_PLANE(v1->vg_p->coord, pl2), is->tol.dist))
-               continue;
-           if (!NEAR_ZERO(DIST_PT_PLANE(v2->vg_p->coord, pl2), is->tol.dist))
-               continue;
-
-           if (!nmg_find_v_in_face(v1, is->fu2) ||
-               !nmg_find_v_in_face(v2, is->fu2))
-               continue;
-
-           if (RTG.NMG_debug & DEBUG_POLYSECT)
-               bu_log("Making EU x%x an intersect line for face cutting\n", 
eu);
-
-           for (BU_LIST_FOR(vu, vertexuse, &v1->vu_hd)) {
-               struct faceuse *fu;
-
-               fu = nmg_find_fu_of_vu(vu);
-
-               if (fu == is->fu2)
-                   nmg_enlist_one_vu(is, vu, 0.0);
-           }
-
-           for (BU_LIST_FOR(vu, vertexuse, &v2->vu_hd)) {
-               struct faceuse *fu;
-
-               fu = nmg_find_fu_of_vu(vu);
-
-               if (fu == is->fu2)
-                   nmg_enlist_one_vu(is, vu, 1.0);
-           }
-
-           /* Now do face cutting */
-           if (RTG.NMG_debug & DEBUG_POLYSECT)
-               bu_log("Calling face cutter for fu2 x%x\n", is->fu2);
-           nmg_fcut_face_2d(is->l2, is->mag2, is->fu2, is->fu1, &is->tol);
-
-           bu_ptbl_reset(is->l1);
-           bu_ptbl_reset(is->l2);
-       }
-    }
-
-    for (BU_LIST_FOR(lu, loopuse, &is->fu2->lu_hd)) {
-       struct edgeuse *eu;
-
-       NMG_CK_LOOPUSE(lu);
-
-       if (BU_LIST_FIRST_MAGIC(&lu->down_hd) != NMG_EDGEUSE_MAGIC)
-           continue;
-
-       for (BU_LIST_FOR(eu, edgeuse, &lu->down_hd)) {
-           struct vertexuse *vu;
-           struct vertex *v1, *v2;
-
-           NMG_CK_EDGEUSE(eu);
-
-           v1 = eu->vu_p->v_p;
-           NMG_CK_VERTEX(v1);
-           v2 = eu->eumate_p->vu_p->v_p;
-           NMG_CK_VERTEX(v2);
-
-           if (!NEAR_ZERO(DIST_PT_PLANE(v1->vg_p->coord, pl1), is->tol.dist))
-               continue;
-           if (!NEAR_ZERO(DIST_PT_PLANE(v2->vg_p->coord, pl1), is->tol.dist))
-               continue;
-
-           if (!nmg_find_v_in_face(v1, is->fu1) ||
-               !nmg_find_v_in_face(v2, is->fu1))
-               continue;
-
-           if (RTG.NMG_debug & DEBUG_POLYSECT)
-               bu_log("Making EU x%x an intersect line for face cutting\n", 
eu);
-
-           for (BU_LIST_FOR(vu, vertexuse, &v1->vu_hd)) {
-               struct faceuse *fu;
-
-               fu = nmg_find_fu_of_vu(vu);
-
-               if (fu == is->fu1)
-                   nmg_enlist_one_vu(is, vu, 0.0);
-           }
-
-           for (BU_LIST_FOR(vu, vertexuse, &v2->vu_hd)) {
-               struct faceuse *fu;
-
-               fu = nmg_find_fu_of_vu(vu);
-
-               if (fu == is->fu1)
-                   nmg_enlist_one_vu(is, vu, 1.0);
-           }
-
-           /* Now do face cutting */
-           if (RTG.NMG_debug & DEBUG_POLYSECT)
-               bu_log("Calling face cutter for fu1 x%x\n", is->fu1);
-           nmg_fcut_face_2d(is->l1, is->mag1, is->fu1, is->fu2, &is->tol);
-
-           bu_ptbl_reset(is->l1);
-           bu_ptbl_reset(is->l2);
-       }
-    }
-}
-#endif
-
-
 #define MAX_FACES 200
 void
 nmg_check_radial_angles(char *str, struct shell *s, const struct bn_tol *tol)
@@ -6152,532 +5602,6 @@
 }
 
 
-#if 0
-/* unused due to change to function 'nmg_isect_two_generic_faces' */
-/** N M G _ I S E C T _ N E A R L Y _ C O P L A N A R _ F A C E S
- *
- * The two faceuses passed are expected to be parallel and distinct or coplanar
- * according to bn_isect_2planes(). Also, some (but not all) of the vertices in
- * one faceuse are within tolerance of the other faceuse. This case is singled
- * out in nmg_isect_two_generic_faces().
- *
- * The algorithm is:
- *             1. split any edges that pass from beyond tolerance on one side
- *                of the other faceuse to beyond tolerance on the other side.
- *             2. cut all loops in each faceuse such that the resulting loops 
are
- *                either entirely within tolerance of the other faceuse, or 
share
- *                only one "line of intersection" with the other faceuse.
- *             3. intersect coplanar loops same as done in 
nmg_isect_two_face2p_jra().
- */
-static void
-nmg_isect_nearly_coplanar_faces(struct nmg_inter_struct *is, struct faceuse 
*fu1, struct faceuse *fu2)
-{
-    int i;
-    struct model *m;
-    struct edgeuse *eu;
-    struct loopuse *lu;
-    struct bu_ptbl loops;
-    plane_t pl1;
-    plane_t pl2;
-    fastf_t *mag1, *mag2;
-    struct bu_ptbl eu1_list;
-    struct bu_ptbl vert_list1;
-    struct bu_ptbl eu2_list;
-    struct bu_ptbl vert_list2;
-    struct bu_ptbl verts;
-
-    NMG_CK_FACEUSE(fu1);
-    NMG_CK_FACEUSE(fu2);
-    NMG_CK_INTER_STRUCT(is);
-
-    if (RTG.NMG_debug & DEBUG_POLYSECT)
-       bu_log("nmg_isect_nearly_coplanar_faces(fu1=x%x, fu2=x%x)\n", fu1, fu2);
-
-    m = nmg_find_model(&fu1->l.magic);
-    NMG_CK_MODEL(m);
-
-    NMG_GET_FU_PLANE(pl1, fu1);
-    NMG_GET_FU_PLANE(pl2, fu2);
-
-    nmg_edgeuse_tabulate(&eu1_list, &fu1->l.magic);
-    nmg_edgeuse_tabulate(&eu2_list, &fu2->l.magic);
-
-    is->mag_len = 2 * (BU_PTBL_END(&eu1_list) + BU_PTBL_END(&eu2_list));
-    mag1 = (fastf_t *)bu_calloc(is->mag_len, sizeof(fastf_t), "mag1");
-    mag2 = (fastf_t *)bu_calloc(is->mag_len, sizeof(fastf_t), "mag2");
-
-    for (i=0; i<is->mag_len; i++) {
-       mag1[i] = MAX_FASTF;
-       mag2[i] = MAX_FASTF;
-    }
-
-    bu_ptbl_init(&vert_list1, 64, " &vert_list1");
-    bu_ptbl_init(&vert_list2, 64, " &vert_list2");
-
-    is->s1 = fu1->s_p;
-    is->s2 = fu2->s_p;
-    is->fu1 = fu1;
-    is->fu2 = fu2;
-    is->l1 = &vert_list1;
-    is->l2 = &vert_list2;
-    is->mag1 = mag1;
-    is->mag2 = mag2;
-    is->on_eg = (struct edge_g_lseg *)NULL;
-
-    /* split any edges that pass through the plane of the other faceuse */
-    for (BU_LIST_FOR(lu, loopuse, &fu1->lu_hd)) {
-       NMG_CK_LOOPUSE(lu);
-       if (BU_LIST_FIRST_MAGIC(&lu->down_hd) != NMG_EDGEUSE_MAGIC)
-           continue;
-
-       for (BU_LIST_FOR(eu, edgeuse, &lu->down_hd)) {
-           int code;
-           int class1, class2;
-           fastf_t dist;
-           struct vertex_g *vg1, *vg2;
-           vect_t dir;
-           point_t hit_pt;
-           struct vertexuse *hit_vu;
-           struct vertex *hit_v=(struct vertex *)NULL;
-           struct edgeuse *new_eu;
-
-           NMG_CK_EDGEUSE(eu);
-
-           vg1 = eu->vu_p->v_p->vg_p;
-           vg2 = eu->eumate_p->vu_p->v_p->vg_p;
-
-           dist = DIST_PT_PLANE(vg1->coord, pl2);
-           if (dist > is->tol.dist)
-               class1 = NMG_CLASS_AoutB;
-           else if (dist < (-is->tol.dist))
-               class1 = NMG_CLASS_AinB;
-           else
-               class1 = NMG_CLASS_AonBshared;
-
-           dist = DIST_PT_PLANE(vg2->coord, pl2);
-           if (dist > is->tol.dist)
-               class2 = NMG_CLASS_AoutB;
-           else if (dist < (-is->tol.dist))
-               class2 = NMG_CLASS_AinB;
-           else
-               class2 = NMG_CLASS_AonBshared;
-
-           if (class1 == class2)
-               continue;
-
-           if (class1 == NMG_CLASS_AonBshared || class2 == 
NMG_CLASS_AonBshared)
-               continue;
-
-           /* need to split this edge at plane pl2 */
-           VSUB2(dir, vg2->coord, vg1->coord)
-
-               code = bn_isect_line3_plane(&dist, vg1->coord, dir, pl2, 
&is->tol);
-           if (code < 1) {
-               bu_log("nmg_isect_nearly_coplanar_faces: EU (x%x) goes from %s 
to %s\n",
-                      eu, nmg_class_name(class1), nmg_class_name(class2));
-               bu_log("But bn_isect_line3_plane() returns %d\n", code);
-               bu_log("pl2 = (%g %g %g %g)\n", V4ARGS(pl2));
-               nmg_pr_lu_briefly(lu, "");
-               bu_bomb("nmg_isect_nearly_coplanar_faces: BAD EU");
-           }
-
-           if (dist <= 0.0 || dist >= 1.0) {
-               bu_log("nmg_isect_nearly_coplanar_faces: EU (x%x) goes from %s 
to %s\n",
-                      eu, nmg_class_name(class1), nmg_class_name(class2));
-               bu_log("But bn_isect_line3_plane() returns %d and dist=%g\n", 
code, dist);
-               bu_log("pl2 = (%g %g %g %g)\n", V4ARGS(pl2));
-               nmg_pr_lu_briefly(lu, "");
-               bu_bomb("nmg_isect_nearly_coplanar_faces: BAD EU");
-           }
-
-           VJOIN1(hit_pt, vg1->coord, dist, dir);
-
-           hit_vu = nmg_find_pt_in_face(fu2, hit_pt, &is->tol);
-           if (!hit_vu)
-               hit_v = nmg_find_pt_in_model(m, hit_pt, &is->tol);
-           else
-               hit_v = hit_vu->v_p;
-
-           new_eu = nmg_esplit(hit_v, eu, 1);
-           hit_v = new_eu->vu_p->v_p;
-           if (!hit_v->vg_p)
-               nmg_vertex_gv(hit_v, hit_pt);
-
-           if (RTG.NMG_debug & DEBUG_POLYSECT) {
-               bu_log("nmg_cut_lu_into_coplanar_and_non:\n");
-               bu_log("\tsplitting eu x%x at v=x%x (%g %g %g)\n",
-                      eu, hit_v, V3ARGS(hit_v->vg_p->coord));
-           }
-
-       }
-    }
-
-    /* get a list of all the loops in this faceuse */
-    bu_ptbl_init(&loops, 64, " &loops");
-    for (BU_LIST_FOR(lu, loopuse, &fu1->lu_hd))
-       bu_ptbl_ins(&loops, (long *)lu);
-
-    /* cut each loop so that every loop ends up either entirely on the other
-     * face, or with only a "line of intersection" in common
-     */
-    for (i=0; i<BU_PTBL_END(&loops); i++) {
-       lu = (struct loopuse *)BU_PTBL_GET(&loops, i);
-       NMG_CK_LOOPUSE(lu);
-
-       nmg_cut_lu_into_coplanar_and_non(lu, pl2, is);
-    }
-
-    /* same for fu2 */
-    for (BU_LIST_FOR(lu, loopuse, &fu2->lu_hd)) {
-       NMG_CK_LOOPUSE(lu);
-       if (BU_LIST_FIRST_MAGIC(&lu->down_hd) != NMG_EDGEUSE_MAGIC)
-           continue;
-
-       for (BU_LIST_FOR(eu, edgeuse, &lu->down_hd)) {
-           int code;
-           int class1, class2;
-           fastf_t dist;
-           struct vertex_g *vg1, *vg2;
-           vect_t dir;
-           point_t hit_pt;
-           struct vertexuse *hit_vu;
-           struct vertex *hit_v=(struct vertex *)NULL;
-           struct edgeuse *new_eu;
-
-           NMG_CK_EDGEUSE(eu);
-
-           vg1 = eu->vu_p->v_p->vg_p;
-           vg2 = eu->eumate_p->vu_p->v_p->vg_p;
-
-           dist = DIST_PT_PLANE(vg1->coord, pl1);
-           if (dist > is->tol.dist)
-               class1 = NMG_CLASS_AoutB;
-           else if (dist < (-is->tol.dist))
-               class1 = NMG_CLASS_AinB;
-           else
-               class1 = NMG_CLASS_AonBshared;
-
-           dist = DIST_PT_PLANE(vg2->coord, pl1);
-           if (dist > is->tol.dist)
-               class2 = NMG_CLASS_AoutB;
-           else if (dist < (-is->tol.dist))
-               class2 = NMG_CLASS_AinB;
-           else
-               class2 = NMG_CLASS_AonBshared;
-
-           if (class1 == class2)
-               continue;
-
-           if (class1 == NMG_CLASS_AonBshared || class2 == 
NMG_CLASS_AonBshared)
-               continue;
-
-           /* need to split this edge at plane pl1 */
-           VSUB2(dir, vg2->coord, vg1->coord)
-
-               code = bn_isect_line3_plane(&dist, vg1->coord, dir, pl1, 
&is->tol);
-           if (code < 1) {
-               bu_log("nmg_isect_nearly_coplanar_faces: EU (x%x) goes from %s 
to %s\n",
-                      eu, nmg_class_name(class1), nmg_class_name(class2));
-               bu_log("But bn_isect_line3_plane() returns %d\n", code);
-               bu_log("pl1 = (%g %g %g %g)\n", V4ARGS(pl1));
-               nmg_pr_lu_briefly(lu, "");
-               bu_bomb("nmg_isect_nearly_coplanar_faces: BAD EU");
-           }
-
-           if (dist <= 0.0 || dist >= 1.0) {
-               bu_log("nmg_isect_nearly_coplanar_faces: EU (x%x) goes from %s 
to %s\n",
-                      eu, nmg_class_name(class1), nmg_class_name(class2));
-               bu_log("But bn_isect_line3_plane() returns %d and dist=%g\n", 
code, dist);
-               bu_log("pl1 = (%g %g %g %g)\n", V4ARGS(pl1));
-               nmg_pr_lu_briefly(lu, "");
-               bu_bomb("nmg_isect_nearly_coplanar_faces: BAD EU");
-           }
-           VJOIN1(hit_pt, vg1->coord, dist, dir);
-
-           hit_vu = nmg_find_pt_in_face(fu2, hit_pt, &is->tol);
-           if (!hit_vu)
-               hit_v = nmg_find_pt_in_model(m, hit_pt, &is->tol);
-           else
-               hit_v = hit_vu->v_p;
-
-           new_eu = nmg_esplit(hit_v, eu, 1);
-           hit_v = new_eu->vu_p->v_p;
-           if (!hit_v->vg_p)
-               nmg_vertex_gv(hit_v, hit_pt);
-       }
-    }
-
-    /* get a list of all the loops in this faceuse */
-    bu_ptbl_reset(&loops);
-    for (BU_LIST_FOR(lu, loopuse, &fu2->lu_hd))
-       bu_ptbl_ins(&loops, (long *)lu);
-
-    /* cut each loop so that every loop ends up either entirely on the other
-     * face, or with only a "line of intersection" in common
-     */
-    for (i=0; i<BU_PTBL_END(&loops); i++) {
-       lu = (struct loopuse *)BU_PTBL_GET(&loops, i);
-       NMG_CK_LOOPUSE(lu);
-
-       nmg_cut_lu_into_coplanar_and_non(lu, pl1, is);
-    }
-
-    /* Need to break edges in faces on vertices that may lie on new edges 
formed by cuts */
-    nmg_vertex_tabulate(&verts, &m->magic);
-    /* split new edges in fu1 */
-    for (BU_LIST_FOR(lu, loopuse, &fu1->lu_hd)) {
-       if (BU_LIST_FIRST_MAGIC(&lu->down_hd) != NMG_EDGEUSE_MAGIC)
-           continue;
-
-       for (BU_LIST_FOR(eu, edgeuse, &lu->down_hd)) {
-           if (bu_ptbl_locate(&eu1_list, (long *)eu) != (-1))
-               continue;
-
-           /* this is a new edgeuse, check if it should be split */
-           for (i=0; i<BU_PTBL_END(&verts); i++) {
-               struct vertex *v;
-               int code;
-               fastf_t dist[2];
-               point_t pca;
-
-               v = (struct vertex *)BU_PTBL_GET(&verts, i);
-
-               if (v == eu->vu_p->v_p)
-                   continue;
-
-               if (v == eu->eumate_p->vu_p->v_p)
-                   continue;
-
-               code = bn_dist_pt3_lseg3(dist, pca, eu->vu_p->v_p->vg_p->coord,
-                                        eu->eumate_p->vu_p->v_p->vg_p->coord, 
v->vg_p->coord, &is->tol);
-
-               if (code > 2)
-                   continue;
-
-               if (code == 1)
-                   bu_log("nmg_isect_nearly_coplanar_faces: vertices should 
have been fused x%x and x%x\n", v, eu->vu_p->v_p);
-               else if (code == 2)
-                   bu_log("nmg_isect_nearly_coplanar_faces: vertices should 
have been fused x%x and x%x\n", v, eu->eumate_p->vu_p->v_p);
-               else {
-                   /* need to split EU at V */
-                   (void)nmg_esplit(v, eu, 1);
-               }
-           }
-       }
-    }
-
-    /* split new edges in fu2 */
-    for (BU_LIST_FOR(lu, loopuse, &fu2->lu_hd)) {
-       if (BU_LIST_FIRST_MAGIC(&lu->down_hd) != NMG_EDGEUSE_MAGIC)
-           continue;
-
-       for (BU_LIST_FOR(eu, edgeuse, &lu->down_hd)) {
-           if (bu_ptbl_locate(&eu1_list, (long *)eu) != (-1))
-               continue;
-
-           /* this is a new edgeuse, check if it should be split */
-           for (i=0; i<BU_PTBL_END(&verts); i++) {
-               struct vertex *v;
-               int code;
-               fastf_t dist[2];
-               point_t pca;
-
-               v = (struct vertex *)BU_PTBL_GET(&verts, i);
-
-               if (v == eu->vu_p->v_p)
-                   continue;
-
-               if (v == eu->eumate_p->vu_p->v_p)
-                   continue;
-
-               code = bn_dist_pt3_lseg3(dist, pca, eu->vu_p->v_p->vg_p->coord,
-                                        eu->eumate_p->vu_p->v_p->vg_p->coord, 
v->vg_p->coord, &is->tol);
-
-               if (code > 2)
-                   continue;
-
-               if (code == 1)
-                   bu_log("nmg_isect_nearly_coplanar_faces: vertices should 
have been fused x%x and x%x\n", v, eu->vu_p->v_p);
-               else if (code == 2)
-                   bu_log("nmg_isect_nearly_coplanar_faces: vertices should 
have been fused x%x and x%x\n", v, eu->eumate_p->vu_p->v_p);
-               else {
-                   /* need to split EU at V */
-                   (void)nmg_esplit(v, eu, 1);
-               }
-           }
-       }
-    }
-
-    bu_ptbl_free(&loops);
-    bu_ptbl_free(&verts);
-
-    if (RTG.NMG_debug & DEBUG_POLYSECT) {
-       plane_t plane1, plane2;
-       fastf_t dist;
-
-       bu_log("After splitting loops into coplanar and non:\n");
-       nmg_pr_fu_briefly(fu1, "");
-       nmg_pr_fu_briefly(fu2, "");
-
-       NMG_GET_FU_PLANE(plane1, fu1);
-       NMG_GET_FU_PLANE(plane2, fu2);
-
-       for (BU_LIST_FOR(lu, loopuse, &fu1->lu_hd)) {
-           int in=0, on=0, out=0;
-
-           for (BU_LIST_FOR(eu, edgeuse, &lu->down_hd)) {
-               struct vertex_g *vg;
-
-               vg = eu->vu_p->v_p->vg_p;
-
-               dist = DIST_PT_PLANE(vg->coord, plane2);
-
-               if (dist > is->tol.dist)
-                   out++;
-               else if (dist < (-is->tol.dist))
-                   in++;
-               else
-                   on++;
-           }
-
-           if (in && out)
-               bu_log("lu x%x is in and out of fu x%x\n", lu, fu2);
-           else if (in)
-               bu_log("lu x%x is inside of fu x%x\n", lu, fu2);
-           else if (out)
-               bu_log("lu x%x is outside of fu x%x\n", lu, fu2);
-           else if (on)
-               bu_log("lu x%x is on of fu x%x\n", lu, fu2);
-           else
-               bu_log("Can't figure lu x%x w.r.t fu x%x, on=%d, in=%d, 
out=%d\n",
-                      lu, fu2, on, in, out);
-       }
-
-       for (BU_LIST_FOR(lu, loopuse, &fu2->lu_hd)) {
-           int in=0, on=0, out=0;
-
-           for (BU_LIST_FOR(eu, edgeuse, &lu->down_hd)) {
-               struct vertex_g *vg;
-
-               vg = eu->vu_p->v_p->vg_p;
-
-               dist = DIST_PT_PLANE(vg->coord, plane1);
-
-               if (dist > is->tol.dist)
-                   out++;
-               else if (dist < (-is->tol.dist))
-                   in++;
-               else
-                   on++;
-           }
-
-           if (in && out)
-               bu_log("lu x%x is in and out of fu x%x\n", lu, fu1);
-           else if (in)
-               bu_log("lu x%x is inside of fu x%x\n", lu, fu1);
-           else if (out)
-               bu_log("lu x%x is outside of fu x%x\n", lu, fu1);
-           else if (on)
-               bu_log("lu x%x is on of fu x%x\n", lu, fu1);
-           else
-               bu_log("Can't figure lu x%x w.r.t fu x%x, on=%d, in=%d, 
out=%d\n",
-                      lu, fu1, on, in, out);
-       }
-    }
-
-    /* now intersect only EU's that lie in the plane of the other faceuse */
-    bu_ptbl_reset(&eu1_list);
-    bu_ptbl_reset(&eu2_list);
-    nmg_edgeuse_tabulate(&eu1_list, &fu1->l.magic);
-    nmg_edgeuse_tabulate(&eu2_list, &fu2->l.magic);
-    nmg_isect_coplanar_edges(is, &eu1_list, &eu2_list);
-
-    if (mag1)
-       bu_free((char *)mag1, "mag1");
-    if (mag2)
-       bu_free((char *)mag2, "mag2");
-
-    bu_ptbl_free(is->l1);
-    bu_ptbl_free(is->l2);
-
-    if (RTG.NMG_debug & DEBUG_POLYSECT) {
-       plane_t plane1, plane2;
-       fastf_t dist;
-
-       bu_log("After intersection nearly coplanar faces:\n");
-       nmg_pr_fu_briefly(fu1, "");
-       nmg_pr_fu_briefly(fu2, "");
-
-       NMG_GET_FU_PLANE(plane1, fu1);
-       NMG_GET_FU_PLANE(plane2, fu2);
-
-       for (BU_LIST_FOR(lu, loopuse, &fu1->lu_hd)) {
-           int in=0, on=0, out=0;
-
-           for (BU_LIST_FOR(eu, edgeuse, &lu->down_hd)) {
-               struct vertex_g *vg;
-
-               vg = eu->vu_p->v_p->vg_p;
-
-               dist = DIST_PT_PLANE(vg->coord, plane2);
-
-               if (dist > is->tol.dist)
-                   out++;
-               else if (dist < (-is->tol.dist))
-                   in++;
-               else
-                   on++;
-           }
-
-           if (in && out)
-               bu_log("lu x%x is in and out of fu x%x\n", lu, fu2);
-           else if (in)
-               bu_log("lu x%x is inside of fu x%x\n", lu, fu2);
-           else if (out)
-               bu_log("lu x%x is outside of fu x%x\n", lu, fu2);
-           else if (on)
-               bu_log("lu x%x is on of fu x%x\n", lu, fu2);
-           else
-               bu_log("Can't figure lu x%x w.r.t fu x%x, on=%d, in=%d, 
out=%d\n",
-                      lu, fu2, on, in, out);
-       }
-
-       for (BU_LIST_FOR(lu, loopuse, &fu2->lu_hd)) {
-           int in=0, on=0, out=0;
-
-           for (BU_LIST_FOR(eu, edgeuse, &lu->down_hd)) {
-               struct vertex_g *vg;
-
-               vg = eu->vu_p->v_p->vg_p;
-
-               dist = DIST_PT_PLANE(vg->coord, plane1);
-
-               if (dist > is->tol.dist)
-                   out++;
-               else if (dist < (-is->tol.dist))
-                   in++;
-               else
-                   on++;
-           }
-
-           if (in && out)
-               bu_log("lu x%x is in and out of fu x%x\n", lu, fu1);
-           else if (in)
-               bu_log("lu x%x is inside of fu x%x\n", lu, fu1);
-           else if (out)
-               bu_log("lu x%x is outside of fu x%x\n", lu, fu1);
-           else if (on)
-               bu_log("lu x%x is on of fu x%x\n", lu, fu1);
-           else
-               bu_log("Can't figure lu x%x w.r.t fu x%x, on=%d, in=%d, 
out=%d\n",
-                      lu, fu1, on, in, out);
-       }
-    }
-
-}
-#endif
-
-
 /** N M G _ F A C E S _ C A N _ B E _ I N T E R S E C T E D
  *
  * Check if two faceuses can be intersected normally, by looking at the line

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


------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to