Revision: 74291
          http://sourceforge.net/p/brlcad/code/74291
Author:   starseeker
Date:     2019-11-04 21:50:49 +0000 (Mon, 04 Nov 2019)
Log Message:
-----------
Make the bounding box around the surface point center on the surface point, 
don't just copy the ov bbox.  Not getting the vtree error now, but still have 
problem edges (seeing them earlier now, I think...)

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

Modified: brlcad/trunk/src/libbrep/cdt_ovlps.cpp
===================================================================
--- brlcad/trunk/src/libbrep/cdt_ovlps.cpp      2019-11-04 21:28:37 UTC (rev 
74290)
+++ brlcad/trunk/src/libbrep/cdt_ovlps.cpp      2019-11-04 21:50:49 UTC (rev 
74291)
@@ -131,6 +131,7 @@
        void plot_vtree(const char *fname);
        bool validate_vtree();
        void save_vtree(const char *fname);
+       void load_vtree(const char *fname);
 
        void vert_adjust(long p_id, ON_3dPoint *p, ON_3dVector *v);
 
@@ -323,7 +324,10 @@
        }
        if (search_verts.find(ov) == search_verts.end()) {
            std::cout << "Error: vert in tree, but search couldn't find: " << 
v_ind << "\n";
-           vert_search(ov->bb);
+           std::set<overt_t *> s2 = vert_search(ov->bb);
+           if (s2.find(ov) == s2.end()) {
+               std::cout << "Second try didn't work: " << v_ind << "\n";
+           }
            return false;
        }
        ++tree_it;
@@ -332,6 +336,13 @@
 }
 
 void
+omesh_t::load_vtree(const char *fname)
+{
+    vtree.RemoveAll();
+    vtree.Load(fname);
+}
+
+void
 omesh_t::save_vtree(const char *fname)
 {
     vtree.Save(fname);
@@ -1384,7 +1395,16 @@
                CDT_Add3DPnt(s_cdt, omesh->fmesh->pnts[f3ind], 
omesh->fmesh->f_id, -1, -1, -1, 0, 0);
                CDT_Add3DNorm(s_cdt, omesh->fmesh->normals[fnind], 
omesh->fmesh->pnts[f3ind], omesh->fmesh->f_id, -1, -1, -1, 0, 0);
                omesh->fmesh->nmap[f3ind] = fnind;
-               overt_t *nvrt = omesh->vert_add(f3ind, &(epnts[i].ov->bb));
+               ON_BoundingBox sbb(epnts[i].spnt,epnts[i].spnt);
+               ON_3dVector vmin = epnts[i].ov->bb.Min() - 
epnts[i].ov->bb.Center();
+               ON_3dVector vmax = epnts[i].ov->bb.Max() - 
epnts[i].ov->bb.Center();
+               vmin.Unitize();
+               vmax.Unitize();
+               vmin = vmin * epnts[i].ov->bb.Diagonal().Length() * 0.5;
+               vmax = vmax * epnts[i].ov->bb.Diagonal().Length() * 0.5;
+               sbb.m_min = epnts[i].spnt + vmin;
+               sbb.m_max = epnts[i].spnt + vmax;
+               overt_t *nvrt = omesh->vert_add(f3ind, &sbb);
                new_overts.insert(nvrt);
                polygon->p2o[p2dind] = f3ind;
                polygon->interior_points.insert(p2dind);

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