Revision: 55916
          http://sourceforge.net/p/brlcad/code/55916
Author:   starseeker
Date:     2013-07-01 19:36:46 +0000 (Mon, 01 Jul 2013)
Log Message:
-----------
Finally - successfully consolidate the two splitting functions into one.  Not 
fully simplified by any means, but this should at least improve the readability 
- there was a lot of common code between the two cases.

Modified Paths:
--------------
    brlcad/trunk/include/brep.h
    brlcad/trunk/src/libbrep/opennurbs_ext.cpp

Modified: brlcad/trunk/include/brep.h
===================================================================
--- brlcad/trunk/include/brep.h 2013-07-01 19:28:51 UTC (rev 55915)
+++ brlcad/trunk/include/brep.h 2013-07-01 19:36:46 UTC (rev 55916)
@@ -1631,8 +1631,7 @@
     bool isStraight(ON_Plane frames[]);
     bool isFlatU(ON_Plane frames[]);
     bool isFlatV(ON_Plane frames[]);
-    BBNode* subdivideSurfaceByKnots(const ON_Surface *localsurf, const 
ON_Interval& u, const ON_Interval& v, ON_Plane frames[], int depth, int 
depthLimit, int prev_knot);
-    BBNode* subdivideSurface(const ON_Surface *localsurf, const ON_Interval& 
u, const ON_Interval& v, ON_Plane frames[], int depth, int depthLimit);
+    BBNode* subdivideSurface(const ON_Surface *localsurf, const ON_Interval& 
u, const ON_Interval& v, ON_Plane frames[], int depth, int depthLimit, int 
prev_knot);
     BBNode* surfaceBBox(const ON_Surface *localsurf, bool leaf, ON_Plane 
frames[], const ON_Interval& u, const ON_Interval& v);
 
     const ON_BrepFace* m_face;

Modified: brlcad/trunk/src/libbrep/opennurbs_ext.cpp
===================================================================
--- brlcad/trunk/src/libbrep/opennurbs_ext.cpp  2013-07-01 19:28:51 UTC (rev 
55915)
+++ brlcad/trunk/src/libbrep/opennurbs_ext.cpp  2013-07-01 19:36:46 UTC (rev 
55916)
@@ -674,7 +674,7 @@
        surf->FrameAt(u.Mid() + uq, v.Mid() - vq, frames[7]);
        surf->FrameAt(u.Mid() + uq, v.Mid() + vq, frames[8]);
 
-       m_root = subdivideSurfaceByKnots(surf, u, v, frames, 0, depthLimit, 1);
+       m_root = subdivideSurface(surf, u, v, frames, 0, depthLimit, 1);
        if (m_root) {
            m_root->BuildBBox();
        }
@@ -935,7 +935,7 @@
 
 
     BBNode*
-       SurfaceTree::subdivideSurfaceByKnots(const ON_Surface *localsurf,
+       SurfaceTree::subdivideSurface(const ON_Surface *localsurf,
                const ON_Interval& u,
                const ON_Interval& v,
                ON_Plane frames[],
@@ -1112,28 +1112,28 @@
                newframes[2] = frames[4];
                newframes[3] = sharedframes[1];
                newframes[4] = frames[5];
-               quads[0] = subdivideSurfaceByKnots(q0surf, firstu, firstv, 
newframes, divDepth+1, depthLimit, prev_knot);
+               quads[0] = subdivideSurface(q0surf, firstu, firstv, newframes, 
divDepth+1, depthLimit, prev_knot);
                delete q0surf;
                newframes[0] = sharedframes[0];
                newframes[1] = frames[1];
                newframes[2] = sharedframes[3];
                newframes[3] = frames[4];
                newframes[4] = frames[7];
-               quads[1] = subdivideSurfaceByKnots(q1surf, secondu, firstv, 
newframes, divDepth+1, depthLimit, prev_knot);
+               quads[1] = subdivideSurface(q1surf, secondu, firstv, newframes, 
divDepth+1, depthLimit, prev_knot);
                delete q1surf;
                newframes[0] = frames[4];
                newframes[1] = sharedframes[3];
                newframes[2] = frames[2];
                newframes[3] = sharedframes[2];
                newframes[4] = frames[8];
-               quads[2] = subdivideSurfaceByKnots(q2surf, secondu, secondv, 
newframes, divDepth+1, depthLimit, prev_knot);
+               quads[2] = subdivideSurface(q2surf, secondu, secondv, 
newframes, divDepth+1, depthLimit, prev_knot);
                delete q2surf;
                newframes[0] = sharedframes[1];
                newframes[1] = frames[4];
                newframes[2] = sharedframes[2];
                newframes[3] = frames[3];
                newframes[4] = frames[6];
-               quads[3] = subdivideSurfaceByKnots(q3surf, firstu, secondv, 
newframes, divDepth+1, depthLimit, prev_knot);
+               quads[3] = subdivideSurface(q3surf, firstu, secondv, newframes, 
divDepth+1, depthLimit, prev_knot);
                delete q3surf;
                bu_free(newframes, "free subsurface frames array");
 
@@ -1286,11 +1286,11 @@
 
                if (prev_knot) {
                    localsurf->FrameAt(firstu.Mid(), v.Mid(), newframes[4]);
-                   quads[0] = subdivideSurfaceByKnots(east, firstu, v, 
newframes, divDepth+1, depthLimit, prev_knot);
+                   quads[0] = subdivideSurface(east, firstu, v, newframes, 
divDepth+1, depthLimit, prev_knot);
                } else {
                    ON_Interval first(0, 0.5);
                    localsurf->FrameAt(u.Mid() - uq, v.Mid(), newframes[4]);
-                   quads[0] = subdivideSurfaceByKnots(east, 
u.ParameterAt(first), v, newframes, divDepth + 1, depthLimit, prev_knot);
+                   quads[0] = subdivideSurface(east, u.ParameterAt(first), v, 
newframes, divDepth + 1, depthLimit, prev_knot);
                }
                delete east;
 
@@ -1301,11 +1301,11 @@
 
                if (prev_knot) {
                    localsurf->FrameAt(secondu.Mid(), v.Mid(), newframes[4]);
-                   quads[1] = subdivideSurfaceByKnots(west, secondu, v, 
newframes, divDepth+1, depthLimit, prev_knot);
+                   quads[1] = subdivideSurface(west, secondu, v, newframes, 
divDepth+1, depthLimit, prev_knot);
                } else {
                    ON_Interval second(0.5, 1.0);
                    localsurf->FrameAt(u.Mid() + uq, v.Mid(), newframes[4]);
-                   quads[1] = subdivideSurfaceByKnots(west, 
u.ParameterAt(second), v, newframes, divDepth + 1, depthLimit, prev_knot);
+                   quads[1] = subdivideSurface(west, u.ParameterAt(second), v, 
newframes, divDepth + 1, depthLimit, prev_knot);
                }
                delete west;
 
@@ -1443,11 +1443,11 @@
                newframes[3] = sharedframes[0];
                if (prev_knot) {
                    localsurf->FrameAt(u.Mid(), firstv.Mid(), newframes[4]);
-                   quads[0] = subdivideSurfaceByKnots(south, u, firstv, 
newframes, divDepth+1, depthLimit, prev_knot);
+                   quads[0] = subdivideSurface(south, u, firstv, newframes, 
divDepth+1, depthLimit, prev_knot);
                } else {
                    ON_Interval first(0, 0.5);
                    localsurf->FrameAt(u.Mid(), v.Mid() - vq, newframes[4]);
-                   quads[0] = subdivideSurfaceByKnots(south, u, 
v.ParameterAt(first), newframes, divDepth + 1, depthLimit, prev_knot);
+                   quads[0] = subdivideSurface(south, u, v.ParameterAt(first), 
newframes, divDepth + 1, depthLimit, prev_knot);
                }
                delete south;
 
@@ -1458,11 +1458,11 @@
 
                if (prev_knot) {
                    localsurf->FrameAt(u.Mid(), secondv.Mid(), newframes[4]);
-                   quads[1] = subdivideSurfaceByKnots(north, u, secondv, 
newframes, divDepth+1, depthLimit, prev_knot);
+                   quads[1] = subdivideSurface(north, u, secondv, newframes, 
divDepth+1, depthLimit, prev_knot);
                } else {
                    ON_Interval second(0.5, 1.0);
                    localsurf->FrameAt(u.Mid(), v.Mid() + vq, newframes[4]);
-                   quads[1] = subdivideSurfaceByKnots(north, u, 
v.ParameterAt(second), newframes, divDepth + 1, depthLimit, prev_knot);
+                   quads[1] = subdivideSurface(north, u, 
v.ParameterAt(second), newframes, divDepth + 1, depthLimit, prev_knot);
                }
                delete north;
 
@@ -1504,515 +1504,11 @@
            if (!do_both_splits && !do_u_split && !do_v_split) {
                ((ON_Surface *)localsurf)->ClearBoundingBox();
                delete parent;
-               return subdivideSurface(localsurf, u, v, frames, 0, depthLimit);
+               return subdivideSurface(localsurf, u, v, frames, 0, depthLimit, 
0);
            }
-       }
 
-
-    BBNode*
-       SurfaceTree::subdivideSurface(const ON_Surface *localsurf,
-               const ON_Interval& u,
-               const ON_Interval& v,
-               ON_Plane frames[],
-               int divDepth,
-               int depthLimit)
-       {
-           double uq = u.Length()*0.25;
-           double vq = v.Length()*0.25;
-           localsurf->FrameAt(u.Mid() - uq, v.Mid() - vq, frames[5]);
-           localsurf->FrameAt(u.Mid() - uq, v.Mid() + vq, frames[6]);
-           localsurf->FrameAt(u.Mid() + uq, v.Mid() - vq, frames[7]);
-           localsurf->FrameAt(u.Mid() + uq, v.Mid() + vq, frames[8]);
-           BBNode* quads[4];
-           double usplit = u.Mid();
-           double vsplit = v.Mid();
-           double width, height;
-           double ratio = 5.0;
-           unsigned int do_u_split = 0;
-           unsigned int do_v_split = 0;
-           unsigned int do_both_splits = 0;
-
-           localsurf->GetSurfaceSize(&width, &height);
-           if (((width/height < ratio) && (width/height > 1.0/ratio) && 
isFlat(frames) && isStraight(frames))
-                   || (divDepth >= depthLimit)) { //BREP_MAX_FT_DEPTH
-               return surfaceBBox(localsurf, true, frames, u, v);
-           }
-
-           bool isUFlat = isFlatU(frames);
-           bool isVFlat = isFlatV(frames);
-
-           BBNode* parent = (divDepth == 0) ? initialBBox(ctree, localsurf, 
m_face, u, v) :
-               surfaceBBox(localsurf, false, frames, u, v);
-
-           if ((!isVFlat || (width/height > ratio)) && (!isUFlat || 
(height/width > ratio))) {
-               do_both_splits = 1;
-           }
-           if ((!isUFlat || (width/height > ratio)) && !do_both_splits) {
-               do_u_split = 1;
-           }
-           if (!do_both_splits && ! do_u_split) {
-               do_v_split = 1;
-           }
-
-           if (do_both_splits) {
-               ON_Interval firstu(u.Min(), usplit);
-               ON_Interval secondu(usplit, u.Max());
-               ON_Interval firstv(v.Min(), vsplit);
-               ON_Interval secondv(vsplit, v.Max());
-               ON_BoundingBox box = localsurf->BoundingBox();
-
-               ON_Surface *q0surf = NULL;
-               ON_Surface *q1surf = NULL;
-               ON_Surface *q2surf = NULL;
-               ON_Surface *q3surf = NULL;
-
-               bool split = ON_Surface_Quad_Split(localsurf, u, v, usplit, 
vsplit, &q0surf, &q1surf, &q2surf, &q3surf);
-               /* FIXME: this needs to be handled more gracefully */
-               if (!split) {
-                   delete parent;
-                   return NULL;
-               }
-               q0surf->ClearBoundingBox();
-               q1surf->ClearBoundingBox();
-               q2surf->ClearBoundingBox();
-               q3surf->ClearBoundingBox();
-
-               
/*********************************************************************
-                * In order to avoid fairly expensive re-calculation of 3d 
points at
-                * uv coordinates, all values that are shared between children 
at
-                * the same depth of a surface subdivision are pre-computed and
-                * passed as parameters.
-                *
-                * The majority of these points are already evaluated in the 
process
-                * of testing whether a subdivision has produced a leaf node.  
These
-                * values are in the normals and corners arrays and have index 
values
-                * corresponding to the values of the figure on the left below. 
 There
-                * are four other shared values that are precomputed in the 
sharedcorners
-                * and sharednormals arrays; their index values in those arrays 
are
-                * illustrated in the figure on the right:
-                *
-                *
-                *   3-------------------2      +---------2---------+
-                *   |                   |      |                   |
-                *   |    6         8    |      |                   |
-                *   |                   |      |                   |
-                *  V|         4         |      1                   3
-                *   |                   |      |                   |
-                *   |    5         7    |      |                   |
-                *   |                   |      |                   |
-                *   0-------------------1      +---------0---------+
-                *             U                          U
-                *
-                *   Values inherited from      Values pre-prepared in
-                *   parent subdivision         shared arrays
-                *
-                *
-                * When the four subdivisions are made, the parent parameters
-                * are passed to the children as follows (values from the
-                * shared arrays are prefaced with an s):
-                *
-                *    3--------------S2     S2--------------2
-                *    |               |     |               |
-                *    |               |     |               |
-                *  V |       6       |     |       8       |
-                *    |               |     |               |
-                *    |               |     |               |
-                *    S1--------------4     4--------------S3
-                *            U                     U
-                *
-                *        Quadrant 3            Quadrant 2
-                *
-                *    S1--------------4     4--------------S3
-                *    |               |     |               |
-                *    |               |     |               |
-                *  V |       5       |     |       7       |
-                *    |               |     |               |
-                *    |               |     |               |
-                *    0--------------S0     S0--------------1
-                *             U                         U
-                *
-                *        Quadrant 0            Quadrant 1
-                *
-                *
-                
**********************************************************************/
-
-               ON_Plane sharedframes[4];
-               localsurf->FrameAt(usplit, v.Min(), sharedframes[0]);
-               localsurf->FrameAt(u.Min(), vsplit, sharedframes[1]);
-               localsurf->FrameAt(usplit, v.Max(), sharedframes[2]);
-               localsurf->FrameAt(u.Max(), vsplit, sharedframes[3]);
-
-               ON_Plane *newframes;
-               newframes = (ON_Plane *)bu_malloc(9*sizeof(ON_Plane), "new 
frames");
-               newframes[0] = frames[0];
-               newframes[1] = sharedframes[0];
-               newframes[2] = frames[4];
-               newframes[3] = sharedframes[1];
-               newframes[4] = frames[5];
-               quads[0] = subdivideSurface(q0surf, firstu, firstv, newframes, 
divDepth+1, depthLimit);
-               delete q0surf;
-               newframes[0] = sharedframes[0];
-               newframes[1] = frames[1];
-               newframes[2] = sharedframes[3];
-               newframes[3] = frames[4];
-               newframes[4] = frames[7];
-               quads[1] = subdivideSurface(q1surf, secondu, firstv, newframes, 
divDepth+1, depthLimit);
-               delete q1surf;
-               newframes[0] = frames[4];
-               newframes[1] = sharedframes[3];
-               newframes[2] = frames[2];
-               newframes[3] = sharedframes[2];
-               newframes[4] = frames[8];
-               quads[2] = subdivideSurface(q2surf, secondu, secondv, 
newframes, divDepth+1, depthLimit);
-               delete q2surf;
-               newframes[0] = sharedframes[1];
-               newframes[1] = frames[4];
-               newframes[2] = sharedframes[2];
-               newframes[3] = frames[3];
-               newframes[4] = frames[6];
-               quads[3] = subdivideSurface(q3surf, firstu, secondv, newframes, 
divDepth+1, depthLimit);
-               delete q3surf;
-               bu_free(newframes, "free subsurface frames array");
-
-               parent->m_trimmed = true;
-               parent->m_checkTrim = false;
-
-               for (int i = 0; i < 4; i++) {
-                   if (!quads[i]) {
-                       continue;
-                   }
-                   if (!(quads[i]->m_trimmed)) {
-                       parent->m_trimmed = false;
-                   }
-                   if (quads[i]->m_checkTrim) {
-                       parent->m_checkTrim = true;
-                   }
-               }
-               if (m_removeTrimmed) {
-                   for (int i = 0; i < 4; i++) {
-                       if (!quads[i]) {
-                           continue;
-                       }
-                       if (!(quads[i]->m_trimmed)) {
-                           parent->addChild(quads[i]);
-                       }
-                   }
-               } else {
-                   for (int i = 0; i < 4; i++) {
-                       parent->addChild(quads[i]);
-                   }
-               }
-               parent->BuildBBox();
-               return parent;
-           }
-
-
-           if (do_u_split) {
-               //////////////////////////////////////
-               ON_Surface *east = NULL;
-               ON_Surface *west = NULL;
-
-               ON_BoundingBox box = localsurf->BoundingBox();
-
-               int dir = 0;
-               bool split = localsurf->Split(dir, 
localsurf->Domain(dir).Mid(), east, west);
-
-               /* FIXME: this needs to be handled more gracefully */
-               if (!split || !east || !west) {
-                   bu_log("DEBUG: Split failure (split:%d, surf1:%p, 
surf2:%p)\n", split, (void *)east, (void *)west);
-                   delete parent;
-                   return NULL;
-               }
-
-               east->ClearBoundingBox();
-               west->ClearBoundingBox();
-
-               //////////////////////////////////
-               
/*********************************************************************
-                * In order to avoid fairly expensive re-calculation of 3d 
points at
-                * uv coordinates, all values that are shared between children 
at
-                * the same depth of a surface subdivision are pre-computed and
-                * passed as parameters.
-                *
-                * The majority of these points are already evaluated in the 
process
-                * of testing whether a subdivision has produced a leaf node.  
These
-                * values are in the normals and corners arrays and have index 
values
-                * corresponding to the values of the figure on the left below. 
 There
-                * are four other shared values that are precomputed in the 
sharedcorners
-                * and sharednormals arrays; their index values in those arrays 
are
-                * illustrated in the figure on the right:
-                *
-                *
-                *   3-------------------2      +---------2---------+
-                *   |                   |      |                   |
-                *   |    6         8    |      |                   |
-                *   |                   |      |                   |
-                *  V|         4         |      1                   3
-                *   |                   |      |                   |
-                *   |    5         7    |      |                   |
-                *   |                   |      |                   |
-                *   0-------------------1      +---------0---------+
-                *             U                          U
-                *
-                *   Values inherited from      Values pre-prepared in
-                *   parent subdivision         shared arrays
-                *
-                *
-                * When the four subdivisions are made, the parent parameters
-                * are passed to the children as follows (values from the
-                * shared arrays are prefaced with an s):
-                *
-                *    3--------------S1     S1--------------2
-                *    |               |     |               |
-                *    |               |     |               |
-                *  V |       4       |     |       5       |
-                *    |               |     |               |
-                *    |               |     |               |
-                *    0--------------S0     S0--------------1
-                *             U                         U
-                *
-                *        East                 West
-                *
-                *
-                
**********************************************************************/
-               /* When the four subdivisions are made, the parent parameters
-                * are passed to the children as follows (values from the
-                * shared arrays are prefaced with an s):
-                *
-                *    3--------------S2     S2--------------2
-                *    |               |     |               |
-                *    |               |     |               |
-                *  V |       6       |     |       8       |
-                *    |               |     |               |
-                *    |               |     |               |
-                *    S1--------------4     4--------------S3
-                *            U                     U
-                *
-                *        Quadrant 3            Quadrant 2
-                *
-                *    S1--------------4     4--------------S3
-                *    |               |     |               |
-                *    |               |     |               |
-                *  V |       5       |     |       7       |
-                *    |               |     |               |
-                *    |               |     |               |
-                *    0--------------S0     S0--------------1
-                *             U                         U
-                *
-                *        Quadrant 0            Quadrant 1
-                *
-                *
-                
**********************************************************************/
-
-               ON_Plane sharedframes[4];
-               localsurf->FrameAt(u.Mid(), v.Min(), sharedframes[0]);
-               localsurf->FrameAt(u.Mid(), v.Max(), sharedframes[1]);
-
-               ON_Plane *newframes;
-               newframes = (ON_Plane *) bu_malloc(9 * sizeof(ON_Plane),
-                       "new frames");
-               newframes[0] = frames[0];
-               newframes[1] = sharedframes[0];
-               newframes[2] = sharedframes[1];
-               newframes[3] = frames[3];
-               localsurf->FrameAt(u.Mid() - uq, v.Mid(), newframes[4]);
-
-               //ON_BoundingBox bbox = q0surf->BoundingBox();
-               //bu_log("%d - in bbq0 rpp %f %f %f %f %f %f\n", divDepth, 
bbox.m_min.x, bbox.m_max.x, bbox.m_min.y, bbox.m_max.y, bbox.m_min.z, 
bbox.m_max.z);
-               ON_Interval first(0, 0.5);
-               ON_Interval second(0.5, 1.0);
-
-               quads[0] = subdivideSurface(east, u.ParameterAt(first), v, 
newframes, divDepth + 1, depthLimit);
-               delete east;
-
-               newframes[0] = sharedframes[0];
-               newframes[1] = frames[1];
-               newframes[2] = frames[2];
-               newframes[3] = sharedframes[1];
-               localsurf->FrameAt(u.Mid() + uq, v.Mid(), newframes[4]);
-
-               //bbox = q1surf->BoundingBox();
-               //bu_log("%d - in bbq1 rpp %f %f %f %f %f %f\n", divDepth, 
bbox.m_min.x, bbox.m_max.x, bbox.m_min.y, bbox.m_max.y, bbox.m_min.z, 
bbox.m_max.z);
-               quads[1] = subdivideSurface(west, u.ParameterAt(second), v, 
newframes, divDepth + 1, depthLimit);
-               delete west;
-
-               bu_free(newframes, "free subsurface frames array");
-
-               parent->m_trimmed = true;
-               parent->m_checkTrim = false;
-
-               for (int i = 0; i < 2; i++) {
-                   if (!quads[i]) {
-                       continue;
-                   }
-                   if (!(quads[i]->m_trimmed)) {
-                       parent->m_trimmed = false;
-                   }
-                   if (quads[i]->m_checkTrim) {
-                       parent->m_checkTrim = true;
-                   }
-               }
-               if (m_removeTrimmed) {
-                   for (int i = 0; i < 2; i++) {
-                       if (!quads[i]) {
-                           continue;
-                       }
-                       if (!(quads[i]->m_trimmed)) {
-                           parent->addChild(quads[i]);
-                       }
-                   }
-               } else {
-                   for (int i = 0; i < 2; i++) {
-                       parent->addChild(quads[i]);
-                   }
-               }
-               parent->BuildBBox();
-               return parent;
-           }
-           // If we reach this point, do a v split
-           //////////////////////////////////////
-           ON_Surface *north = NULL;
-           ON_Surface *south = NULL;
-
-           ON_BoundingBox box = localsurf->BoundingBox();
-
-           int dir = 1;
-           bool split = localsurf->Split(dir, localsurf->Domain(dir).Mid(), 
south, north);
-
-           /* FIXME: this needs to be handled more gracefully */
-           if (!split || !south || !north) {
-               bu_log("DEBUG: Split failure (split:%d, surf1:%p, surf2:%p)\n", 
split, (void *)south, (void *)north);
-               delete parent;
-               return NULL;
-           }
-
-           south->ClearBoundingBox();
-           north->ClearBoundingBox();
-
-           //////////////////////////////////
-           
/*********************************************************************
-            * In order to avoid fairly expensive re-calculation of 3d points at
-            * uv coordinates, all values that are shared between children at
-            * the same depth of a surface subdivision are pre-computed and
-            * passed as parameters.
-            *
-            * The majority of these points are already evaluated in the process
-            * of testing whether a subdivision has produced a leaf node.  These
-            * values are in the normals and corners arrays and have index 
values
-            * corresponding to the values of the figure on the left below.  
There
-            * are four other shared values that are precomputed in the 
sharedcorners
-            * and sharednormals arrays; their index values in those arrays are
-            * illustrated in the figure on the right:
-            *
-            *
-            *   3-------------------2      +---------2---------+
-            *   |                   |      |                   |
-            *   |    6         8    |      |                   |
-            *   |                   |      |                   |
-            *  V|         4         |      1                   3
-            *   |                   |      |                   |
-            *   |    5         7    |      |                   |
-            *   |                   |      |                   |
-            *   0-------------------1      +---------0---------+
-            *             U                          U
-            *
-            *   Values inherited from      Values pre-prepared in
-            *   parent subdivision         shared arrays
-            *
-            *
-            * When the four subdivisions are made, the parent parameters
-            * are passed to the children as follows (values from the
-            * shared arrays are prefaced with an s):
-            *
-            *    3--------------------2
-            *    |                    |
-            *    |                    |
-            *  V |         5          |
-            *    |                    |
-            *    |                    |
-            *    S0-------------------S1
-            *            U
-            *
-            *        North
-            *
-            *    S0-------------------S1
-            *    |                    |
-            *    |                    |
-            *  V |         4          |
-            *    |                    |
-            *    |                    |
-            *    0--------------------1
-            *             U
-            *
-            *        South
-            *
-            *
-            
**********************************************************************/
-
-           ON_Plane sharedframes[2];
-           localsurf->FrameAt(u.Min(), v.Mid(), sharedframes[0]);
-           localsurf->FrameAt(u.Max(), v.Mid(), sharedframes[1]);
-
-           ON_Plane *newframes;
-           newframes = (ON_Plane *) bu_malloc(9 * sizeof(ON_Plane),
-                   "new frames");
-           newframes[0] = frames[0];
-           newframes[1] = frames[1];
-           newframes[2] = sharedframes[1];
-           newframes[3] = sharedframes[0];
-           localsurf->FrameAt(u.Mid(), v.Mid() - vq, newframes[4]);
-
-           ON_Interval first(0, 0.5);
-           ON_Interval second(0.5, 1.0);
-
-           //ON_BoundingBox bbox = q0surf->BoundingBox();
-           //bu_log("%d - in bbq0 rpp %f %f %f %f %f %f\n", divDepth, 
bbox.m_min.x, bbox.m_max.x, bbox.m_min.y, bbox.m_max.y, bbox.m_min.z, 
bbox.m_max.z);
-           quads[0] = subdivideSurface(south, u, v.ParameterAt(first), 
newframes, divDepth + 1, depthLimit);
-           delete south;
-
-           newframes[0] = sharedframes[0];
-           newframes[1] = sharedframes[1];
-           newframes[2] = frames[2];
-           newframes[3] = frames[3];
-           localsurf->FrameAt(u.Mid(), v.Mid() + vq, newframes[4]);
-
-           //bbox = q1surf->BoundingBox();
-           //bu_log("%d - in bbq1 rpp %f %f %f %f %f %f\n", divDepth, 
bbox.m_min.x, bbox.m_max.x, bbox.m_min.y, bbox.m_max.y, bbox.m_min.z, 
bbox.m_max.z);
-           quads[1] = subdivideSurface(north, u, v.ParameterAt(second), 
newframes, divDepth + 1, depthLimit);
-           delete north;
-
-           bu_free(newframes, "free subsurface frames array");
-
-           parent->m_trimmed = true;
-           parent->m_checkTrim = false;
-
-           for (int i = 0; i < 2; i++) {
-               if (!quads[i]) {
-                   continue;
-               }
-               if (!(quads[i]->m_trimmed)) {
-                   parent->m_trimmed = false;
-               }
-               if (quads[i]->m_checkTrim) {
-                   parent->m_checkTrim = true;
-               }
-           }
-           if (m_removeTrimmed) {
-               for (int i = 0; i < 2; i++) {
-                   if (!quads[i]) {
-                       continue;
-                   }
-                   if (!(quads[i]->m_trimmed)) {
-                       parent->addChild(quads[i]);
-                   }
-               }
-           } else {
-               for (int i = 0; i < 2; i++) {
-                   parent->addChild(quads[i]);
-               }
-           }
-           parent->BuildBBox();
-           return parent;
+            // Should never get here
+            return NULL;
        }
 
     bool

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


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to