Revision: 52638
          http://brlcad.svn.sourceforge.net/brlcad/?rev=52638&view=rev
Author:   r_weiss
Date:     2012-10-01 19:29:58 +0000 (Mon, 01 Oct 2012)
Log Message:
-----------
Updated files "vmath.h", "nmg_fuse.c", "nmg_class.c", "nmg_mod.c", 
"nmg_inter.c" and "nmg_bool.c". Corrected a bug in macro "V3RPP_DISJOINT_TOL". 
Updated functions "nmg_two_face_fuse", "class_eu_vs_s", 
"nmg_shell_coplanar_face_merge", "nmg_isect_eu_eu" and "nmg_bool" to use the 
"V3RPP_DISJOINT_TOL" macro instead of "V3RPP_OVERLAP_TOL". This change corrects 
a problem where bounding boxes which were less than distance tolerance apart, 
but not overlapping, were being skipped.

Modified Paths:
--------------
    brlcad/trunk/include/vmath.h
    brlcad/trunk/src/librt/primitives/nmg/nmg_bool.c
    brlcad/trunk/src/librt/primitives/nmg/nmg_class.c
    brlcad/trunk/src/librt/primitives/nmg/nmg_fuse.c
    brlcad/trunk/src/librt/primitives/nmg/nmg_inter.c
    brlcad/trunk/src/librt/primitives/nmg/nmg_mod.c

Modified: brlcad/trunk/include/vmath.h
===================================================================
--- brlcad/trunk/include/vmath.h        2012-10-01 19:28:51 UTC (rev 52637)
+++ brlcad/trunk/include/vmath.h        2012-10-01 19:29:58 UTC (rev 52638)
@@ -1685,12 +1685,12 @@
  * by at least distance tolerance.
  */
 #define V3RPP_DISJOINT_TOL(_l1, _h1, _l2, _h2, _t) \
-      (((_l1)[X] > (_h2)[X] + (_t) && \
-       (_l1)[Y] > (_h2)[Y] + (_t) && \
-       (_l1)[Z] > (_h2)[Z] + (_t)) || \
-       ((_l2)[X] > (_h1)[X] + (_t) && \
-       (_l2)[Y] > (_h1)[Y] + (_t) && \
-       (_l2)[Z] > (_h1)[Z] + (_t)))
+       ((_l1)[X] > (_h2)[X] + (_t) || \
+       (_l1)[Y] > (_h2)[Y] + (_t) || \
+       (_l1)[Z] > (_h2)[Z] + (_t) || \
+        (_l2)[X] > (_h1)[X] + (_t) || \
+       (_l2)[Y] > (_h1)[Y] + (_t) || \
+       (_l2)[Z] > (_h1)[Z] + (_t)) 
 
 /** Compare two bounding boxes and return true If they overlap. */
 #define V3RPP_OVERLAP(_l1, _h1, _l2, _h2) \

Modified: brlcad/trunk/src/librt/primitives/nmg/nmg_bool.c
===================================================================
--- brlcad/trunk/src/librt/primitives/nmg/nmg_bool.c    2012-10-01 19:28:51 UTC 
(rev 52637)
+++ brlcad/trunk/src/librt/primitives/nmg/nmg_bool.c    2012-10-01 19:29:58 UTC 
(rev 52638)
@@ -659,10 +659,11 @@
        bu_bomb("nmg_bool(): internal error, both shells are not in the same 
nmg model\n");
     }
 
-    /* for the simple case where shells sA and sB do not overlap, we
-     * can skip most of the steps to perform the boolean operation
+    /* for the simple case where shells sA and sB are disjoint by at
+     * least distance tolerance, we can skip most of the steps to
+     * perform the boolean operation
      */
-    if (!V3RPP_OVERLAP_TOL(sA->sa_p->min_pt, sA->sa_p->max_pt,
+    if (V3RPP_DISJOINT_TOL(sA->sa_p->min_pt, sA->sa_p->max_pt,
                           sB->sa_p->min_pt, sB->sa_p->max_pt, tol->dist)) {
        switch (oper) {
            case NMG_BOOL_ADD: {

Modified: brlcad/trunk/src/librt/primitives/nmg/nmg_class.c
===================================================================
--- brlcad/trunk/src/librt/primitives/nmg/nmg_class.c   2012-10-01 19:28:51 UTC 
(rev 52637)
+++ brlcad/trunk/src/librt/primitives/nmg/nmg_class.c   2012-10-01 19:29:58 UTC 
(rev 52638)
@@ -967,11 +967,11 @@
     VMOVE(e_max_pt, eu->vu_p->v_p->vg_p->coord);
     VMAX(e_max_pt, eu->eumate_p->vu_p->v_p->vg_p->coord);
 
-    /* if the edge and shell bounding boxes do not overlap
-     * then the edge is outside the shell. also both vertices
-     * of the edge are outside the shell.
+    /* if the edge and shell bounding boxes are disjoint by at least
+     * distance tolerance then the edge is outside the shell. also
+     * both vertices of the edge are outside the shell.
      */
-    if (!V3RPP_OVERLAP_TOL(e_min_pt, e_max_pt, s->sa_p->min_pt, 
s->sa_p->max_pt, tol->dist)) {
+    if (V3RPP_DISJOINT_TOL(e_min_pt, e_max_pt, s->sa_p->min_pt, 
s->sa_p->max_pt, tol->dist)) {
        NMG_INDEX_SET(classlist[NMG_CLASS_AoutB], eu->e_p);
        NMG_INDEX_SET(classlist[NMG_CLASS_AoutB], eu->vu_p->v_p);
        NMG_INDEX_SET(classlist[NMG_CLASS_AoutB], eu->eumate_p->vu_p->v_p);

Modified: brlcad/trunk/src/librt/primitives/nmg/nmg_fuse.c
===================================================================
--- brlcad/trunk/src/librt/primitives/nmg/nmg_fuse.c    2012-10-01 19:28:51 UTC 
(rev 52637)
+++ brlcad/trunk/src/librt/primitives/nmg/nmg_fuse.c    2012-10-01 19:29:58 UTC 
(rev 52638)
@@ -1601,10 +1601,10 @@
        return 0;
     }
 
-    /* verify the bounding box of each faceuse overlaps the other
-     * faceuse bounding box
+    /* if the bounding box of each faceuse is not within distance
+     * tolerance of each other, then skip fusing
      */
-    if (!V3RPP_OVERLAP_TOL(f1->min_pt, f1->max_pt, f2->min_pt, f2->max_pt, 
tol->dist)) {
+    if (V3RPP_DISJOINT_TOL(f1->min_pt, f1->max_pt, f2->min_pt, f2->max_pt, 
tol->dist)) {
        return 0;
     }
 

Modified: brlcad/trunk/src/librt/primitives/nmg/nmg_inter.c
===================================================================
--- brlcad/trunk/src/librt/primitives/nmg/nmg_inter.c   2012-10-01 19:28:51 UTC 
(rev 52637)
+++ brlcad/trunk/src/librt/primitives/nmg/nmg_inter.c   2012-10-01 19:29:58 UTC 
(rev 52638)
@@ -3706,7 +3706,7 @@
     VMOVE(e2_max_pt, vg2a->coord);
     VMAX(e2_max_pt, vg2b->coord);
 
-    if (!V3RPP_OVERLAP_TOL(e1_min_pt, e1_max_pt, e2_min_pt, e2_max_pt, 
tol->dist)) {
+    if (V3RPP_DISJOINT_TOL(e1_min_pt, e1_max_pt, e2_min_pt, e2_max_pt, 
tol->dist)) {
        return;
     }
 

Modified: brlcad/trunk/src/librt/primitives/nmg/nmg_mod.c
===================================================================
--- brlcad/trunk/src/librt/primitives/nmg/nmg_mod.c     2012-10-01 19:28:51 UTC 
(rev 52637)
+++ brlcad/trunk/src/librt/primitives/nmg/nmg_mod.c     2012-10-01 19:29:58 UTC 
(rev 52638)
@@ -142,8 +142,10 @@
                register fastf_t dist;
                /* If plane equations are different, done */
 
-               /* test if the bounding boxes of the faceuse overlap */
-               if (!V3RPP_OVERLAP_TOL(f1->min_pt, f1->max_pt, f2->min_pt, 
f2->max_pt, tol->dist)) {
+               /* if the face bounding boxes are at least distance 
+                * distance tolerance apart, skip them.
+                */
+               if (V3RPP_DISJOINT_TOL(f1->min_pt, f1->max_pt, f2->min_pt, 
f2->max_pt, tol->dist)) {
                    continue;
                }
 

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


------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to