Revision: 41573
          http://brlcad.svn.sourceforge.net/brlcad/?rev=41573&view=rev
Author:   r_weiss
Date:     2010-12-10 01:52:44 +0000 (Fri, 10 Dec 2010)

Log Message:
-----------
Updated functions 'nmg_boolean' and 'nmg_booltree_evaluate'. Removed 
'nmg_model_fuse' from the function 'nmg_boolean' and placed it within 
'nmg_booltree_evaluate' which is later in the boolean process and is where all 
the geometry is location in a single nmg model structure. This change appears 
to improve 'facetize' but further testing is necessary.

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

Modified: brlcad/trunk/src/librt/primitives/nmg/nmg_bool.c
===================================================================
--- brlcad/trunk/src/librt/primitives/nmg/nmg_bool.c    2010-12-10 00:25:36 UTC 
(rev 41572)
+++ brlcad/trunk/src/librt/primitives/nmg/nmg_bool.c    2010-12-10 01:52:44 UTC 
(rev 41573)
@@ -1222,6 +1222,17 @@
     if (tr->tr_d.td_r->m_p != tl->tr_d.td_r->m_p)
        nmg_merge_models(tl->tr_d.td_r->m_p, tr->tr_d.td_r->m_p);
 
+    /* The 'nmg_model_fuse' function is best to be run here, i.e. just before
+     * the actual boolean operation is performed because at this point all
+     * the geometry to be operated upon is in one single nmg model structure
+     * which is necessary for all the geometry to be fused. Pointer compares
+     * are done in some cases instead of distance testing to determine if
+     * geometry is equal, if fuse is not performed, equal geometry will not
+     * have the same address pointer and therefore an equal test will fail
+     * and break the logic used to perform the boolean operation.
+     */
+    nmg_model_fuse(tl->tr_d.td_r->m_p, tol);
+
     /* input r1 and r2 are destroyed, output is new region */
     reg = nmg_do_bool(tl->tr_d.td_r, tr->tr_d.td_r, op, tol);
     tl->tr_d.td_r = NULL;
@@ -1285,13 +1296,16 @@
               tp, m);
     }
 
-    /*
-     * Find all entities within geometric tolerance of each other and
-     * "fuse" them, establishing topological sharing.  Also breaks all
-     * edges on all vertices that are within tolerance.  Operate on
-     * the entire model at once.
+    /* The nmg_model_fuse function was removed from this point in the
+     * boolean process since not all geometry that is to be processed is
+     * always within the single 'm' nmg model structure passed into this
+     * function. In some cases the geometry resides in multiple nmg model
+     * structures within the 'tp' tree that is passed into this function.
+     * Running nmg_model_fuse is still required but is done later, i.e.
+     * within the nmg_booltree_evaluate function just before the nmg_do_bool
+     * function is called which is when the geometry, in which the boolean
+     * to be performed, is always in a single nmg model structure.
      */
-    (void)nmg_model_fuse(m, tol);
 
     /*
      * Evaluate the nodes of the boolean tree one at a time, until


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

Reply via email to