Revision: 56029
          http://sourceforge.net/p/brlcad/code/56029
Author:   brlcad
Date:     2013-07-13 02:49:55 +0000 (Sat, 13 Jul 2013)
Log Message:
-----------
accept sf patch (https://sourceforge.net/p/brlcad/patches/173/) from Avneet 
Kaur that refactored a 20+ line duplication in some wireframe drawing code.

Modified Paths:
--------------
    brlcad/trunk/AUTHORS
    brlcad/trunk/src/librt/primitives/brep/brep_debug.cpp

Modified: brlcad/trunk/AUTHORS
===================================================================
--- brlcad/trunk/AUTHORS        2013-07-12 20:42:21 UTC (rev 56028)
+++ brlcad/trunk/AUTHORS        2013-07-13 02:49:55 UTC (rev 56029)
@@ -664,7 +664,12 @@
 2013 May
 Open Source (GSoC)
 
+Kaur, Avneet
+nicknames avneetkhalsa
+2013 May
+Open Source (GSoC)
 
+
 SPECIAL THANKS
 --------------
 

Modified: brlcad/trunk/src/librt/primitives/brep/brep_debug.cpp
===================================================================
--- brlcad/trunk/src/librt/primitives/brep/brep_debug.cpp       2013-07-12 
20:42:21 UTC (rev 56028)
+++ brlcad/trunk/src/librt/primitives/brep/brep_debug.cpp       2013-07-13 
02:49:55 UTC (rev 56029)
@@ -1535,6 +1535,47 @@
 }
 
 
+/*  Making a common vhead to be used in brep_surface_cv_plot when checking
+ *  for index value
+ */
+void vhead(struct bn_vlblock *vbp, int ucount, int vcount, ON_NurbsSurface * 
ns)
+{
+    register struct bu_list *vhead;
+    vhead = rt_vlblock_find(vbp, PEACH);
+    ON_3dPoint  cp;
+    fastf_t     pt1[3], pt2[3];
+    int i, j, k, temp;
+    for (k = 0; k < 2; k++)            /*< two times i loop */
+    {
+        for (i = 0; i < ucount; ++i)   /*< k=0, i<ucount; k=1, i<vcount */
+        {
+            if (k == 1)
+                ns->GetCV(0, i, cp);      /*< i < ucount */
+            else
+                ns->GetCV(i, 0, cp);       /*< i < vcount */
+
+            VMOVE(pt1, cp);
+            for (j = 0; j < vcount; ++j)  /*< k=0, j<vcount; k=1, j<ucount */
+            {
+                if (k == 1)
+                   ns->GetCV(j, i, cp);
+                else
+                    ns->GetCV(i, j, cp);
+
+                VMOVE(pt2, cp);
+                RT_ADD_VLIST(vhead, pt1, BN_VLIST_LINE_MOVE);
+                RT_ADD_VLIST(vhead, pt2, BN_VLIST_LINE_DRAW);
+                VMOVE(pt1, cp);
+                RT_ADD_VLIST(vhead, cp, BN_VLIST_POINT_DRAW);
+            }
+        }
+        temp  = ucount;     /*< swapping ucount and vcount */
+        ucount = vcount;
+        vcount = temp;
+    }
+}
+
+
 int
 brep_trim_plot(struct bu_vls *vls, struct brep_specific* bs, struct 
rt_brep_internal*, struct bn_vlblock *vbp, int index, int plotres, bool dim3d)
 {
@@ -1579,82 +1620,32 @@
        bu_log("brep is NOT valid");
     }
 
-       if (index == -1) {
-           for (index = 0; index < brep->m_S.Count(); index++) {
+       if (index == -1) 
+       {
+           for (index = 0; index < brep->m_S.Count(); index++) 
+           {
                ON_Surface *surf = brep->m_S[index];
                ON_NurbsSurface *ns = ON_NurbsSurface::New();
                surf->GetNurbForm(*ns, 0.0);
                int ucount, vcount;
                ucount = ns->m_cv_count[0];
                vcount = ns->m_cv_count[1];
-               ON_3dPoint cp;
-               fastf_t pt1[3], pt2[3];
-               register struct bu_list *vhead;
                surf->Dump(tl);
-               vhead = rt_vlblock_find(vbp, PEACH);
-               for (int i = 0; i < ucount; ++i) {
-                   ns->GetCV(i, 0, cp);
-                   VMOVE(pt1, cp);
-                   for (int j = 0; j < vcount; ++j) {
-                       ns->GetCV(i, j, cp);
-                       VMOVE(pt2, cp);
-                       RT_ADD_VLIST(vhead, pt1, BN_VLIST_LINE_MOVE);
-                       RT_ADD_VLIST(vhead, pt2, BN_VLIST_LINE_DRAW);
-                       VMOVE(pt1, cp);
-                       RT_ADD_VLIST(vhead, cp, BN_VLIST_POINT_DRAW);
-                   }
-               }
-               for (int i = 0; i < vcount; ++i) {
-                   ns->GetCV(0, i, cp);
-                   VMOVE(pt1, cp);
-                   for (int j = 0; j < ucount; ++j) {
-                       ns->GetCV(j, i, cp);
-                       VMOVE(pt2, cp);
-                       RT_ADD_VLIST(vhead, pt1, BN_VLIST_LINE_MOVE);
-                       RT_ADD_VLIST(vhead, pt2, BN_VLIST_LINE_DRAW);
-                       VMOVE(pt1, cp);
-                       RT_ADD_VLIST(vhead, cp, BN_VLIST_POINT_DRAW);
-                   }
-               }
+               vhead(vbp, ucount, vcount, ns);     /* calling common function 
vhead */
            }
-       } else if (index < brep->m_S.Count()) {
+       } 
+       else if (index < brep->m_S.Count()) 
+       {
            ON_Surface *surf = brep->m_S[index];
            ON_NurbsSurface *ns = ON_NurbsSurface::New();
            surf->GetNurbForm(*ns, 0.0);
            int ucount, vcount;
            ucount = ns->m_cv_count[0];
            vcount = ns->m_cv_count[1];
-           ON_3dPoint cp;
-           fastf_t pt1[3], pt2[3];
-           register struct bu_list *vhead;
-           vhead = rt_vlblock_find(vbp, PEACH);
-           for (int i = 0; i < ucount; ++i) {
-               ns->GetCV(i, 0, cp);
-               VMOVE(pt1, cp);
-               for (int j = 0; j < vcount; ++j) {
-                   ns->GetCV(i, j, cp);
-                   VMOVE(pt2, cp);
-                   RT_ADD_VLIST(vhead, pt1, BN_VLIST_LINE_MOVE);
-                   RT_ADD_VLIST(vhead, pt2, BN_VLIST_LINE_DRAW);
-                   VMOVE(pt1, cp);
-                   RT_ADD_VLIST(vhead, cp, BN_VLIST_POINT_DRAW);
-               }
-           }
-           for (int i = 0; i < vcount; ++i) {
-               ns->GetCV(0, i, cp);
-               VMOVE(pt1, cp);
-               for (int j = 0; j < ucount; ++j) {
-                   ns->GetCV(j, i, cp);
-                   VMOVE(pt2, cp);
-                   RT_ADD_VLIST(vhead, pt1, BN_VLIST_LINE_MOVE);
-                   RT_ADD_VLIST(vhead, pt2, BN_VLIST_LINE_DRAW);
-                   VMOVE(pt1, cp);
-                   RT_ADD_VLIST(vhead, cp, BN_VLIST_POINT_DRAW);
-               }
-           }
+           vhead(vbp, ucount, vcount, ns);         /* calling common function 
vhead */
        }
        bu_vls_printf(vls, ON_String(wstr).Array());
-    return 0;
+       return 0;
 
 }
 

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


------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to