Revision: 57170
          http://sourceforge.net/p/brlcad/code/57170
Author:   phoenixyjll
Date:     2013-08-27 05:08:01 +0000 (Tue, 27 Aug 2013)
Log Message:
-----------
Don't always flip that face. We should decide whether it's necessary to flip 
according to the operation.

Modified Paths:
--------------
    brlcad/trunk/src/libbrep/boolean.cpp

Modified: brlcad/trunk/src/libbrep/boolean.cpp
===================================================================
--- brlcad/trunk/src/libbrep/boolean.cpp        2013-08-27 04:51:28 UTC (rev 
57169)
+++ brlcad/trunk/src/libbrep/boolean.cpp        2013-08-27 05:08:01 UTC (rev 
57170)
@@ -1532,16 +1532,21 @@
        ON_SimpleArray<Subsurface*>& surf_tree = i >= facecount1 ? surf_treeA : 
surf_treeB;
        for (int j = 0; j < splitted.Count(); j++) {
            bool belong_to_final = false;
+           bool flip_face = false;
            if (IsFaceInsideBrep(splitted[j], another_brep, surf_tree)) {
                if (DEBUG_BREP_BOOLEAN)
                    bu_log("The trimmed face is inside the other brep.\n");
                if (operation == BOOLEAN_INTERSECT || (operation == 
BOOLEAN_DIFF && i >= facecount1))
                    belong_to_final = true;
+               if (operation == BOOLEAN_DIFF)
+                   flip_face = true;
            } else {
                if (DEBUG_BREP_BOOLEAN)
                    bu_log("The trimmed face is not inside the other brep.\n");
                if (operation == BOOLEAN_UNION || (operation == BOOLEAN_DIFF && 
i < facecount1))
                    belong_to_final = true;
+               if (operation == BOOLEAN_UNION)
+                   flip_face = true;
            }
 
            if (belong_to_final) {
@@ -1557,7 +1562,9 @@
                    add_elements(brepO, new_face, splitted[j]->m_innerloop[k], 
ON_BrepLoop::inner);
 
                brepO->SetTrimIsoFlags(new_face);
-               brepO->FlipFace(new_face);
+               const ON_BrepFace& original_face = i >= facecount1 ? 
brepB->m_F[i - facecount1] : brepA->m_F[i];
+               if (original_face.m_bRev ^ flip_face)
+                   brepO->FlipFace(new_face);
            }
        }
     }

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


------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to