Revision: 54482
          http://brlcad.svn.sourceforge.net/brlcad/?rev=54482&view=rev
Author:   indianlarry
Date:     2013-02-26 13:08:44 +0000 (Tue, 26 Feb 2013)
Log Message:
-----------
Added ?\226?\128?\156KN2d?\226?\128?\157 option to 
?\226?\128?\156brep?\226?\128?\157 command to display surface knots in 2d UV 
space.

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

Modified: brlcad/trunk/src/librt/primitives/brep/brep_debug.cpp
===================================================================
--- brlcad/trunk/src/librt/primitives/brep/brep_debug.cpp       2013-02-26 
12:54:02 UTC (rev 54481)
+++ brlcad/trunk/src/librt/primitives/brep/brep_debug.cpp       2013-02-26 
13:08:44 UTC (rev 54482)
@@ -419,6 +419,16 @@
 
     vhead = rt_vlblock_find(vbp, PURERED);
 
+       double width,height;
+    ON_BoundingBox loop_bb;
+    ON_BoundingBox trim_bb;
+#ifndef RESETDOMAIN
+       if (face.GetSurfaceSize(&width,&height)) {
+           face.SetDomain(0,0.0,width);
+           face.SetDomain(1,0.0,height);
+
+       }
+#endif
     surf->GetDomain(0, &umin, &umax);
     surf->GetDomain(1, &vmin, &vmax);
     // add a little offset so we can see the boundary curves
@@ -619,7 +629,7 @@
 
 
 void
-plotsurfaceknots(ON_Surface &surf, struct bn_vlblock *vbp)
+plotsurfaceknots(ON_Surface &surf, struct bn_vlblock *vbp, bool dim3d)
 {
     register struct bu_list *vhead;
     fastf_t pt1[3], pt2[3];
@@ -630,14 +640,25 @@
     fastf_t *spanv = NULL;
     spanu = new fastf_t[spanu_cnt+1];
     spanv = new fastf_t[spanv_cnt+1];
+
+#ifndef RESETDOMAIN
+    double width,height;
+    if (surf.GetSurfaceSize(&width,&height)) {
+       surf.SetDomain(0,0.0,width);
+       surf.SetDomain(1,0.0,height);
+
+    }
+#endif
+
     surf.GetSpanVector(0, spanu);
     surf.GetSpanVector(1, spanv);
 
-    vhead = rt_vlblock_find(vbp, YELLOW);
+    vhead = rt_vlblock_find(vbp, GREEN);
 
     ON_Interval udom = surf.Domain(0);
     ON_Interval vdom = surf.Domain(1);
 
+    if (dim3d) {
     for (int u = 0; u <= spanu_cnt; u++) {
        for (int v = 0; v <= spanv_cnt; v++) {
            ON_3dPoint p = surf.PointAt(spanu[u], spanv[v]);
@@ -648,7 +669,16 @@
            VADD2(pt2, pt1, pt2);
            RT_ADD_VLIST(vhead, pt1, BN_VLIST_LINE_MOVE);
            RT_ADD_VLIST(vhead, pt2, BN_VLIST_LINE_DRAW);
+           }
        }
+    } else {
+       for (int u = 0; u <= spanu_cnt; u++) {
+           for (int v = 0; v <= spanv_cnt; v++) {
+               ON_3dPoint p = surf.PointAt(spanu[u], spanv[v]);
+               VSET(pt1, spanu[u], spanv[v], 0.0);
+               RT_ADD_VLIST(vhead, pt1, BN_VLIST_POINT_DRAW);
+           }
+       }
     }
     return;
 }
@@ -1346,13 +1376,13 @@
        if (index == -1) {
            for (index = 0; index < brep->m_S.Count(); index++) {
                ON_Surface *surf = brep->m_S[index];
-               plotsurfaceknots(*surf, vbp);
+               plotsurfaceknots(*surf, vbp, true);
                plotsurfacenormals(*surf, vbp, plotres);
            }
        } else if (index < brep->m_S.Count()) {
            ON_Surface *surf = brep->m_S[index];
            surf->Dump(tl);
-           plotsurfaceknots(*surf, vbp);
+           plotsurfaceknots(*surf, vbp, true);
            plotsurfacenormals(*surf, vbp, plotres);
        }
 
@@ -1362,7 +1392,7 @@
 
 
 int
-brep_surface_knot_plot(struct bu_vls *vls, struct brep_specific* bs, struct 
rt_brep_internal*, struct bn_vlblock *vbp, int index)
+brep_surface_knot_plot(struct bu_vls *vls, struct brep_specific* bs, struct 
rt_brep_internal*, struct bn_vlblock *vbp, int index, bool dim3d)
 {
     ON_wString wstr;
     ON_TextLog tl(wstr);
@@ -1378,12 +1408,12 @@
        if (index == -1) {
            for (index = 0; index < brep->m_S.Count(); index++) {
                ON_Surface *surf = brep->m_S[index];
-               plotsurfaceknots(*surf, vbp);
+               plotsurfaceknots(*surf, vbp, dim3d);
            }
        } else if (index < brep->m_S.Count()) {
            ON_Surface *surf = brep->m_S[index];
            surf->Dump(tl);
-           plotsurfaceknots(*surf, vbp);
+           plotsurfaceknots(*surf, vbp, dim3d);
        }
 
        bu_vls_printf(vls, ON_String(wstr).Array());
@@ -2562,10 +2592,15 @@
                    ret = brep_surface_normal_plot(vls, bs, bi, vbp, i,
                                                   plotres);
                }
+           } else if (BU_STR_EQUAL(part, "KN2d")) {
+               snprintf(commtag, 64, "_BC_KN2d_");
+               for (int i = startindex; i <= endindex; i++) {
+                   ret = brep_surface_knot_plot(vls, bs, bi, vbp, i, false);
+               }
            } else if (BU_STR_EQUAL(part, "KN")) {
                snprintf(commtag, 64, "_BC_KN_");
                for (int i = startindex; i <= endindex; i++) {
-                   ret = brep_surface_knot_plot(vls, bs, bi, vbp, i);
+                   ret = brep_surface_knot_plot(vls, bs, bi, vbp, i, true);
                }
            } else if (BU_STR_EQUAL(part, "F")) {
                snprintf(commtag, 64, "_BC_F_");

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


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to