Revision: 56560
http://sourceforge.net/p/brlcad/code/56560
Author: brlcad
Date: 2013-08-05 05:33:30 +0000 (Mon, 05 Aug 2013)
Log Message:
-----------
remove three dead and long-unused functions that have been under if 0 wrappage:
nmg_insert_vu_if_on_edge(), nmg_face_combineX(), and
nmg_face_next_vu_interval(). they even seem interesting/complete, but are not
integrated, easily tested, or fully understood so remove the burden. nmg has
enough complexity without retaining some for reference.
Modified Paths:
--------------
brlcad/trunk/src/librt/primitives/nmg/nmg_fcut.c
Modified: brlcad/trunk/src/librt/primitives/nmg/nmg_fcut.c
===================================================================
--- brlcad/trunk/src/librt/primitives/nmg/nmg_fcut.c 2013-08-05 05:31:05 UTC
(rev 56559)
+++ brlcad/trunk/src/librt/primitives/nmg/nmg_fcut.c 2013-08-05 05:33:30 UTC
(rev 56560)
@@ -2020,89 +2020,6 @@
}
-#if 0
-/**
- * N M G _ F A C E _ N E X T _ V U _ I N T E R V A L
- *
- * Handle the extent of coincident vertexuses at this distance.
- * ptbl_vsort() will have forced all the distances to be
- * exactly equal if they are within tolerance of each other.
- *
- * Two cases: lone vertexuse, and range of vertexuses.
- *
- * Return value is where next interval starts.
- */
-HIDDEN int
-nmg_face_next_vu_interval(struct nmg_ray_state *rs, int cur, fastf_t *mag, int
other_rs_state)
-{
- int j;
- int k;
- int m;
- struct vertex *v;
-
- NMG_CK_RAYSTATE(rs);
- BN_CK_TOL(rs->tol);
- if (rs->eg_p) NMG_CK_EDGE_G_LSEG(rs->eg_p);
-
- if (cur == rs->nvu-1 || !ZERO(mag[cur+1] - mag[cur])) {
- /* Single vertexuse at this dist */
- if (RTG.NMG_debug&DEBUG_FCUT)
- bu_log("nmg_face_next_vu_interval() fu=x%x, single vertexuse at
index %d\n", rs->fu1, cur);
- nmg_face_state_transition(rs, cur, 0, other_rs_state);
-#if PLOT_BOTH_FACES
- nmg_2face_plot(rs->fu1, rs->fu2);
-#else
- nmg_face_plot(rs->fu1);
-#endif
- return cur+1;
- }
-
- /* Find range of vertexuses at this distance */
- v = rs->vu[cur]->v_p;
- for (j = cur+1; j < rs->nvu; j++) {
- /* If distance along the ray changes, start a new interval */
- if (!ZERO(mag[j] - mag[cur])) break;
- }
-
- /* vu Interval runs from [cur] to [j-1] inclusive */
- if (RTG.NMG_debug&DEBUG_FCUT)
- bu_log("nmg_face_next_vu_interval() fu=x%x vu's on list interval [%d]
to [%d] equal\n", rs->fu1, cur, j-1);
-
- /* Ensure that all vu's point to same vertex */
- for (k = cur+1; k < j; k++) {
- if (rs->vu[k]->v_p == v) continue;
- /* Trouble. Print out the interval and die */
- bu_log("At k=%d, vertex changed from v=x%x!\n", k, v);
- bu_log("pt_equality=%d\n", bn_pt3_pt3_equal(v->vg_p->coord,
-
rs->vu[k]->v_p->vg_p->coord, rs->tol));
- for (k = cur; k < j; k++) {
- bu_log(" %d vu=%8x v=%8x mag=%g\n", k,
- rs->vu[k], rs->vu[k]->v_p, mag[k]);
- NMG_CK_VERTEX_G(rs->vu[k]->v_p->vg_p);
- VPRINT("\tpt", rs->vu[k]->v_p->vg_p->coord);
- }
- bu_bomb("nmg_face_combine: vu block with differing vertices\n");
- }
- /* All vu's point to the same vertex, sort them */
- m = nmg_face_coincident_vu_sort(rs, cur, j);
-
- /* Process vu list, up to cutoff index 'm', which can be less than j */
- for (k = cur; k < m; k++) {
- nmg_face_state_transition(rs, k, 1, other_rs_state);
-#if PLOT_BOTH_FACES
- nmg_2face_plot(rs->fu1, rs->fu2);
-#else
- nmg_face_plot(rs->fu1);
-#endif
- }
- rs->vu[j-1] = rs->vu[m-1]; /* for next iteration's lookback */
- if (RTG.NMG_debug&DEBUG_FCUT)
- bu_log("nmg_face_next_vu_interval() vu[%d] set to x%x\n", j-1,
rs->vu[j-1]);
- return j;
-}
-#endif
-
-
#define VAVERAGE(a, b, c) { \
(a)[X] = ((b)[X] + (c)[X]) * 0.5;\
(a)[Y] = ((b)[Y] + (c)[Y]) * 0.5;\
@@ -3041,133 +2958,7 @@
}
-#if 0
/**
- * N M G _ F A C E _ C O M B I N E
- *
- * collapse loops, vertices within face fu1 (relative to fu2)
- *
- */
-HIDDEN void
-nmg_face_combineX(struct nmg_ray_state *rs1, fastf_t *mag1, struct
nmg_ray_state *rs2, fastf_t *mag2)
-{
- register int cur1, cur2;
- register int nxt1, nxt2;
-
- NMG_CK_RAYSTATE(rs1);
- NMG_CK_RAYSTATE(rs2);
- BN_CK_TOL(rs1->tol);
- BN_CK_TOL(rs2->tol);
-
- if (RTG.NMG_debug&DEBUG_FCUT)
- bu_log("nmg_face_combine()\n");
-
- if (rs1->eg_p) NMG_CK_EDGE_G_LSEG(rs1->eg_p);
- if (rs2->eg_p) NMG_CK_EDGE_G_LSEG(rs2->eg_p);
-
-#if PLOT_BOTH_FACES
- nmg_2face_plot(rs1->fu1, rs1->fu2);
-#else
- nmg_face_plot(rs1->fu1);
- nmg_face_plot(rs1->fu2);
-#endif
-
- /* Handle next block of coincident vertexuses.
- * Sometimes only one list has a block in it.
- */
- cur1 = cur2 = 0;
- for (; cur1 < rs1->nvu && cur2 < rs2->nvu; cur1=nxt1, cur2=nxt2) {
- int old_rs1_state = rs1->state;
-
- if (RTG.NMG_debug&DEBUG_FCUT)
- bu_log("\nnmg_face_combineX() vu block, index1=%d, index2=%d\n",
cur1, cur2);
-
- if (mag1[cur1] < mag2[cur2]) {
- if (RTG.NMG_debug&DEBUG_FCUT)
- bu_log("\nnmg_face_combineX() doing index1 block (at end)\n");
- nxt1 = nmg_face_next_vu_interval(rs1, cur1, mag1, rs2->state);
- nxt2 = cur2;
- if (rs1->eg_p) NMG_CK_EDGE_G_LSEG(rs1->eg_p);
- if (rs2->eg_p) NMG_CK_EDGE_G_LSEG(rs2->eg_p);
- if (!rs2->eg_p) rs2->eg_p = rs1->eg_p;
- } else if (mag1[cur1] > mag2[cur2]) {
- if (RTG.NMG_debug&DEBUG_FCUT)
- bu_log("\nnmg_face_combineX() doing index2 block (at end)\n");
- nxt1 = cur1;
- nxt2 = nmg_face_next_vu_interval(rs2, cur2, mag2, old_rs1_state);
- if (rs1->eg_p) NMG_CK_EDGE_G_LSEG(rs1->eg_p);
- if (rs2->eg_p) NMG_CK_EDGE_G_LSEG(rs2->eg_p);
- if (!rs1->eg_p) rs1->eg_p = rs2->eg_p;
- } else {
- struct vertexuse *vu1;
- struct vertexuse *vu2;
- vu1 = rs1->vu[cur1];
- vu2 = rs2->vu[cur2];
- NMG_CK_VERTEXUSE(vu1);
- NMG_CK_VERTEXUSE(vu2);
- if (vu1->v_p != vu2->v_p) {
- bu_log("cur1=%d, cur2=%d, v1=x%x, v2=x%x\n",
- cur1, cur2, vu1->v_p, vu2->v_p);
- bu_bomb("nmg_face_combineX: vertex lists scrambled");
- }
- if (RTG.NMG_debug&DEBUG_FCUT)
- bu_log("\nnmg_face_combineX() doing index1 block\n");
- nxt1 = nmg_face_next_vu_interval(rs1, cur1, mag1, rs2->state);
- if (rs1->eg_p) NMG_CK_EDGE_G_LSEG(rs1->eg_p);
- if (rs2->eg_p) NMG_CK_EDGE_G_LSEG(rs2->eg_p);
- if (!rs2->eg_p) rs2->eg_p = rs1->eg_p;
-
- if (RTG.NMG_debug&DEBUG_FCUT)
- bu_log("\nnmg_face_combineX() doing index2 block\n");
- nxt2 = nmg_face_next_vu_interval(rs2, cur2, mag2, old_rs1_state);
- if (rs1->eg_p) NMG_CK_EDGE_G_LSEG(rs1->eg_p);
- if (rs2->eg_p) NMG_CK_EDGE_G_LSEG(rs2->eg_p);
- if (!rs1->eg_p) rs1->eg_p = rs2->eg_p;
- }
- if (rs1->eg_p) NMG_CK_EDGE_G_LSEG(rs1->eg_p);
- if (rs2->eg_p) NMG_CK_EDGE_G_LSEG(rs2->eg_p);
- }
-
- /*
- * Here, one list is exhausted, but the other may not be.
- * Press on until both are.
- */
- for (; cur1 < rs1->nvu; cur1 = nxt1) {
- nxt1 = nmg_face_next_vu_interval(rs1, cur1, mag1, rs2->state);
- }
- if (!rs2->eg_p) rs2->eg_p = rs1->eg_p;
- if (rs1->eg_p) NMG_CK_EDGE_G_LSEG(rs1->eg_p);
- if (rs2->eg_p) NMG_CK_EDGE_G_LSEG(rs2->eg_p);
-
- for (; cur2 < rs2->nvu; cur2 = nxt2) {
- nxt2 = nmg_face_next_vu_interval(rs2, cur2, mag2, rs1->state);
- }
- if (!rs1->eg_p) rs1->eg_p = rs2->eg_p;
- if (rs1->eg_p) NMG_CK_EDGE_G_LSEG(rs1->eg_p);
- if (rs2->eg_p) NMG_CK_EDGE_G_LSEG(rs2->eg_p);
-
- if (rs1->state != NMG_STATE_OUT || rs2->state != NMG_STATE_OUT) {
- bu_log("ERROR nmg_face_combine() ended in state '%s'/'%s'?\n",
- nmg_state_names[rs1->state],
- nmg_state_names[rs2->state]);
- bu_log("cur1 = %d of %d, cur2 = %d of %d\n",
- cur1, rs1->nvu, cur2, rs2->nvu);
-
- if (RT_G_DEBUG || RTG.NMG_debug) {
- /* Drop a plot file */
- RTG.NMG_debug |= DEBUG_VU_SORT|DEBUG_FCUT|DEBUG_PLOTEM;
- nmg_pl_comb_fu(0, 1, rs1->fu1);
- nmg_pl_comb_fu(0, 2, rs1->fu2);
- }
-
- /* This is the production setting */
- bu_bomb("nmg_face_combine() bad ending state\n");
- }
-}
-#endif
-
-
-/**
* N M G _ U N L I S T _ V
*/
void
@@ -3591,95 +3382,7 @@
};
-#if 0
-/* FIXME: Dead code??? --CSM */
-
/**
- * N M G _ I N S E R T _ V U _ I F _ O N _ E D G E
- *
- * This code checks if the vertex from a loop of a single vertex lies on
- * an edge containing vu2. If so, the edge is split, vu1 is inserted,
- * the loop containing vu1 is killed, and the newly created edgeuse is
- * returned in "new_eu".
- *
- * returns:
- * 0 - did nothing
- * 1 - inserted vu1 and created a new edge
- */
-int
-nmg_insert_vu_if_on_edge(struct vertexuse *vu1, struct vertexuse *vu2, struct
edgeuse *new_eu, struct bn_tol *tol)
- /* vertexuse from a loop of a single vertex */
- /* vertexuse from another loop */
- /* use of new edge that may be created (implicit return) */
- /* tolerance for collinearity check */
-{
- struct edgeuse *eu_from; /* edgeuse that starts at end of vu2's eu */
- struct edgeuse *eu_to; /* edgeuse that terminates at vu2 */
- vect_t eu_vect; /* edge vector starting or terminating
at vu2 */
- vect_t vect_to_loop; /* vector from start of eu_vect to vu1
*/
- fastf_t eu_len_sq; /* square of length of edge containing vu2 */
- fastf_t dist_to_loop_sq; /* square of distance between vu1 and vu2 */
-
- NMG_CK_VERTEXUSE(vu1);
- if (*vu1->up.magic_p != NMG_LOOPUSE_MAGIC)
- bu_bomb("nmg_insert_vu_if_on_edge: vu1 is not from a loop of a single
vertex");
-
- NMG_CK_VERTEXUSE(vu2);
- if (*vu2->up.magic_p != NMG_EDGEUSE_MAGIC)
- bu_bomb("nmg_insert_vu_if_on_edge: vu2 is not from an edgeuse");
-
- BN_CK_TOL(tol);
-
- if (RTG.NMG_debug&DEBUG_FCUT)
- bu_log("nmg_insert_vu_if_on_edge: vu1=x%x, vu2=x%x\n", vu1, vu2);
-
- eu_from = BU_LIST_PNEXT_CIRC(edgeuse, vu2->up.eu_p);
- eu_to = BU_LIST_PPREV_CIRC(edgeuse, vu2->up.eu_p);
- if (bn_3pts_collinear(vu1->v_p->vg_p->coord, vu2->v_p->vg_p->coord,
eu_from->vu_p->v_p->vg_p->coord, tol)) {
- if (RTG.NMG_debug&DEBUG_FCUT)
- bu_log("\t points are collinear with vu2's eu (%g, %g, %g) -> (%g,
%g, %g)\n",
- V3ARGS(vu2->v_p->vg_p->coord),
- V3ARGS(eu_from->vu_p->v_p->vg_p->coord));
- VSUB2(eu_vect, eu_from->vu_p->v_p->vg_p->coord, vu2->v_p->vg_p->coord);
- VSUB2(vect_to_loop, vu1->v_p->vg_p->coord, vu2->v_p->vg_p->coord);
- if (VDOT(eu_vect, vect_to_loop) > 0.0) {
- eu_len_sq = MAGSQ(eu_vect);
- dist_to_loop_sq = MAGSQ(vect_to_loop);
- if (dist_to_loop_sq < eu_len_sq) {
- if (RTG.NMG_debug&DEBUG_FCUT)
- bu_log("\tvu1 is on vu2's eu, creating new edge (MAGSQ=%g,
tol->dist_sq=%g)\n", dist_to_loop_sq, tol->dist_sq);
- new_eu = nmg_ebreaker(vu1->v_p, vu2->up.eu_p, tol);
- nmg_klu(vu1->up.lu_p);
- return 1;
- }
- }
- }
- if (bn_3pts_collinear(vu1->v_p->vg_p->coord, vu2->v_p->vg_p->coord,
eu_to->vu_p->v_p->vg_p->coord, tol)) {
- if (RTG.NMG_debug&DEBUG_FCUT)
- bu_log("\t points are collinear with eu that ends at vu2 (%g, %g,
%g) -> (%g, %g, %g)\n",
- V3ARGS(eu_to->vu_p->v_p->vg_p->coord),
- V3ARGS(vu2->v_p->vg_p->coord));
- VSUB2(eu_vect, vu2->v_p->vg_p->coord, eu_to->vu_p->v_p->vg_p->coord);
- VSUB2(vect_to_loop, vu1->v_p->vg_p->coord,
eu_to->vu_p->v_p->vg_p->coord);
- if (VDOT(eu_vect, vect_to_loop) > 0.0) {
- eu_len_sq = MAGSQ(eu_vect);
- dist_to_loop_sq = MAGSQ(vect_to_loop);
- if (dist_to_loop_sq < eu_len_sq) {
-
- if (RTG.NMG_debug&DEBUG_FCUT)
- bu_log("\tvu1 is on eu that ends at vu2, creating new edge
(MAGSQ=%g, tol->dist_sq=%g)\n", dist_to_loop_sq, tol->dist_sq);
- new_eu = nmg_ebreaker(vu1->v_p, eu_to, tol);
- nmg_klu(vu1->up.lu_p);
- return 1;
- }
- }
- }
- return 0;
-}
-#endif
-
-
-/**
* N M G _ F A C E _ S T A T E _ T R A N S I T I O N
*
* Given current (old) state, assess the current vertexuse, and
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