Revision: 56977
          http://sourceforge.net/p/brlcad/code/56977
Author:   phoenixyjll
Date:     2013-08-20 08:22:12 +0000 (Tue, 20 Aug 2013)
Log Message:
-----------
Separate the code, so that we can then update the connectivity graph after we 
have done the surface partitioning.

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

Modified: brlcad/trunk/src/libbrep/boolean.cpp
===================================================================
--- brlcad/trunk/src/libbrep/boolean.cpp        2013-08-20 05:58:18 UTC (rev 
56976)
+++ brlcad/trunk/src/libbrep/boolean.cpp        2013-08-20 08:22:12 UTC (rev 
56977)
@@ -984,14 +984,19 @@
     }
 
     // split the surfaces with the intersection curves
+    ON_ClassArray<ON_SimpleArray<TrimmedFace*> > trimmedfaces;
     for (int i = 0; i < original_faces.Count(); i++) {
        TrimmedFace* first = original_faces[i];
-
        ON_SimpleArray<ON_Curve*> linked_curves;
        link_curves(curvesarray[i], linked_curves);
-       ON_SimpleArray<TrimmedFace*> trimmedfaces;
-       split_trimmed_face(trimmedfaces, first, linked_curves);
+       ON_SimpleArray<TrimmedFace*> splitted;
+       split_trimmed_face(splitted, first, linked_curves);
+       trimmedfaces.Append(splitted);
+    }
 
+    for (int i = 0; i < trimmedfaces.Count(); i++) {
+       const ON_SimpleArray<TrimmedFace*>& splitted = trimmedfaces[i];
+       const ON_Surface* surf = splitted.Count() ? 
splitted[0]->face->SurfaceOf() : NULL;
        /* TODO: Perform inside-outside test to decide whether the trimmed face
         * should be used in the final b-rep structure or not.
         * Different operations should be dealt with accordingly.
@@ -1000,17 +1005,17 @@
         * inside-outside tests.
         * Here we just use all of these trimmed faces.
         */
-       for (int j = 0; j < trimmedfaces.Count(); j++) {
+       for (int j = 0; j < splitted.Count(); j++) {
            // Add the surfaces, faces, loops, trims, vertices, edges, etc.
            // to the brep structure.
-           ON_Surface *new_surf = first->face->SurfaceOf()->Duplicate();
+           ON_Surface *new_surf = surf->Duplicate();
            int surfindex = brepO->AddSurface(new_surf);
            ON_BrepFace& new_face = brepO->NewFace(surfindex);
 
-           add_elements(brepO, new_face, trimmedfaces[j]->outerloop, 
ON_BrepLoop::outer);
+           add_elements(brepO, new_face, splitted[j]->outerloop, 
ON_BrepLoop::outer);
            // ON_BrepLoop &loop = brepO->m_L[brepO->m_L.Count() - 1];
-           for (unsigned int k = 0; k < trimmedfaces[j]->innerloop.size(); k++)
-               add_elements(brepO, new_face, trimmedfaces[j]->innerloop[k], 
ON_BrepLoop::inner);
+           for (unsigned int k = 0; k < splitted[j]->innerloop.size(); k++)
+               add_elements(brepO, new_face, splitted[j]->innerloop[k], 
ON_BrepLoop::inner);
 
            brepO->SetTrimIsoFlags(new_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