Revision: 73901
          http://sourceforge.net/p/brlcad/code/73901
Author:   starseeker
Date:     2019-09-12 12:40:05 +0000 (Thu, 12 Sep 2019)
Log Message:
-----------
Turn off the trim points temporarily - trying to get a handle on what p2t's 
problem is.

Modified Paths:
--------------
    brlcad/trunk/src/libbrep/cdt_edge.cpp
    brlcad/trunk/src/libbrep/cdt_surf.cpp

Modified: brlcad/trunk/src/libbrep/cdt_edge.cpp
===================================================================
--- brlcad/trunk/src/libbrep/cdt_edge.cpp       2019-09-12 12:30:34 UTC (rev 
73900)
+++ brlcad/trunk/src/libbrep/cdt_edge.cpp       2019-09-12 12:40:05 UTC (rev 
73901)
@@ -135,7 +135,7 @@
 // Probably still want some minimum distance to avoid extremely slim 
triangles, even if they
 // are "valid"...
 void
-rtree_bbox_2d(struct ON_Brep_CDT_State *s_cdt, cdt_mesh::cpolyedge_t *pe)
+rtree_bbox_2d(struct ON_Brep_CDT_State *s_cdt, cdt_mesh::cpolyedge_t *pe, int 
tight)
 {
     ON_BrepTrim& trim = s_cdt->brep->m_T[pe->trim_ind];
     ON_2dPoint p2d1(pe->polygon->pnts_2d[pe->v[0]].first, 
pe->polygon->pnts_2d[pe->v[0]].second);
@@ -145,7 +145,7 @@
 
     // If we have an associated 3D edge, we need a surface point that will
     // result in a sensible triangle near that edge.
-    if (pe->eseg) {
+    if (!tight && pe->eseg) {
        ON_3dPoint p13d(p2d1.x, p2d1.y, 0);
        ON_3dPoint p23d(p2d2.x, p2d2.y, 0);
        ON_3dPoint p1norm(p2d1.x, p2d1.y, 1);
@@ -169,21 +169,23 @@
     pe->bb.m_min.x = pe->bb.m_min.x - ON_ZERO_TOLERANCE;
     pe->bb.m_min.y = pe->bb.m_min.y - ON_ZERO_TOLERANCE;
 
-    double xdist = pe->bb.m_max.x - pe->bb.m_min.x;
-    double ydist = pe->bb.m_max.y - pe->bb.m_min.y;
-    // If we're close to the edge, we want to know - the Search callback will
-    // check the precise distance and make a decision on what to do.
-    if (xdist < bdist) {
-       pe->bb.m_min.x = pe->bb.m_min.x - 0.5*bdist;
-       pe->bb.m_max.x = pe->bb.m_max.x + 0.5*bdist;
-    }
-    if (ydist < bdist) {
-       pe->bb.m_min.y = pe->bb.m_min.y - 0.5*bdist;
-       pe->bb.m_max.y = pe->bb.m_max.y + 0.5*bdist;
-    }
+    if (!tight) {
+       double xdist = pe->bb.m_max.x - pe->bb.m_min.x;
+       double ydist = pe->bb.m_max.y - pe->bb.m_min.y;
+       // If we're close to the edge, we want to know - the Search callback 
will
+       // check the precise distance and make a decision on what to do.
+       if (xdist < bdist) {
+           pe->bb.m_min.x = pe->bb.m_min.x - 0.5*bdist;
+           pe->bb.m_max.x = pe->bb.m_max.x + 0.5*bdist;
+       }
+       if (ydist < bdist) {
+           pe->bb.m_min.y = pe->bb.m_min.y - 0.5*bdist;
+           pe->bb.m_max.y = pe->bb.m_max.y + 0.5*bdist;
+       }
 
-    if (pe->eseg) {
-       pe->bb.Set(pe->spnt, true);
+       if (pe->eseg) {
+           pe->bb.Set(pe->spnt, true);
+       }
     }
 
     double p1[2];
@@ -780,10 +782,10 @@
 
     // Update the rtrees with the new segments
     if (update_rtrees) {
-       rtree_bbox_2d(s_cdt, bseg1->tseg1);
-       rtree_bbox_2d(s_cdt, bseg1->tseg2);
-       rtree_bbox_2d(s_cdt, bseg2->tseg1);
-       rtree_bbox_2d(s_cdt, bseg2->tseg2);
+       rtree_bbox_2d(s_cdt, bseg1->tseg1, 0);
+       rtree_bbox_2d(s_cdt, bseg1->tseg2, 0);
+       rtree_bbox_2d(s_cdt, bseg2->tseg1, 0);
+       rtree_bbox_2d(s_cdt, bseg2->tseg2, 0);
 #if 0
        struct bu_vls fname = BU_VLS_INIT_ZERO;
        int face_index = 
s_cdt->brep->m_T[bseg1->tseg1->trim_ind].Face()->m_face_index;
@@ -931,8 +933,8 @@
     nedges.insert(poly_ne2);
 
     if (update_rtrees) {
-       rtree_bbox_2d(s_cdt, poly_ne1);
-       rtree_bbox_2d(s_cdt, poly_ne2);
+       rtree_bbox_2d(s_cdt, poly_ne1, 0);
+       rtree_bbox_2d(s_cdt, poly_ne2, 0);
     }
 
     return nedges;
@@ -1249,7 +1251,7 @@
                ne->trim_start = range.m_t[0];
                ne->trim_end = range.m_t[1];
 
-               rtree_bbox_2d(s_cdt, ne);
+               rtree_bbox_2d(s_cdt, ne, 0);
 
                if (trim->m_ei >= 0) {
                    cdt_mesh::bedge_seg_t *eseg = 
s_cdt->e2polysegs[trim->m_ei][0];
@@ -1719,12 +1721,12 @@
            cdt_mesh::cpolyedge_t *pe = (*cpoly->poly.begin());
            cdt_mesh::cpolyedge_t *first = pe;
            cdt_mesh::cpolyedge_t *next = pe->next;
-           rtree_bbox_2d(s_cdt, first);
+           rtree_bbox_2d(s_cdt, first, 1);
            // Walk the loop
            while (first != next) {
                ecnt++;
                if (!next) break;
-               rtree_bbox_2d(s_cdt, next);
+               rtree_bbox_2d(s_cdt, next, 1);
                next = next->next;
                if (ecnt > cpoly->poly.size()) {
                    std::cerr << "\nfinalize_2d_rtrees: ERROR! encountered 
infinite loop\n";

Modified: brlcad/trunk/src/libbrep/cdt_surf.cpp
===================================================================
--- brlcad/trunk/src/libbrep/cdt_surf.cpp       2019-09-12 12:30:34 UTC (rev 
73900)
+++ brlcad/trunk/src/libbrep/cdt_surf.cpp       2019-09-12 12:40:05 UTC (rev 
73901)
@@ -420,6 +420,7 @@
     bool *use;
 };
 
+#if 0
 static bool UseTrimPntCallback(void *data, void *a_context) {
     cdt_mesh::cpolyedge_t *tseg = (cdt_mesh::cpolyedge_t *)data;
     struct rtree_trimpnt_context *context= (struct rtree_trimpnt_context 
*)a_context;
@@ -437,9 +438,9 @@
 
     return true;
 }
+#endif
 
 
-
 static void
 sinfo_init(struct cdt_surf_info *sinfo, struct ON_Brep_CDT_State *s_cdt, int 
face_index)
 {
@@ -474,7 +475,7 @@
     sinfo->min_edge = (*s_cdt->min_edge_seg_len)[face_index];
     sinfo->max_edge = (*s_cdt->max_edge_seg_len)[face_index];
 
-
+#if 0
     // If the trims will be contributing points, we need to figure out which 
ones
     // and assemble an rtree for them.  We can't insert points from the general
     // build too close to them or we run the risk of duplicate points and very 
small
@@ -514,6 +515,7 @@
            sinfo->on_surf_points.insert(new ON_2dPoint(px, py));
        }
     }
+#endif
 
 
 
@@ -572,8 +574,6 @@
 filter_surface_pnts(struct cdt_surf_info *sinfo)
 {
 
-    // Points on 
-    
     // TODO - it's looking like a 2D check isn't going to be enough - we 
probably
     // need BOTH a 2D and a 3D check to make sure none of the points are in a
     // position that will cause trouble.  Will need to build a 3D RTree of the 
line
@@ -1072,6 +1072,7 @@
            double px = p2d.x + (bn_rand_half(prand) * 0.3*ulen);
            double py = p2d.y + (bn_rand_half(prand) * 0.3*vlen);
 
+#if 0
            double tMin[2];
            tMin[0] = (*b_it)->Min().x;
            tMin[1] = (*b_it)->Min().y;
@@ -1086,6 +1087,9 @@
            } else {
                std::cout << "reject - already have trim point in here\n";
            }
+#else
+           sinfo.on_surf_points.insert(new ON_2dPoint(px,py));
+#endif
        }
 
        // Strip out points from the surface that are too close to the trimming 
curves.

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



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to