Revision: 74310
          http://sourceforge.net/p/brlcad/code/74310
Author:   starseeker
Date:     2019-11-06 21:03:22 +0000 (Wed, 06 Nov 2019)
Log Message:
-----------
Mappings aren't right - not getting the new edges with the new split point 
marked correctly as boundary edges.  I don't think this is right either, but it 
identifies the problem area.

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-06 18:30:42 UTC (rev 
74309)
+++ brlcad/trunk/src/libbrep/cdt_ovlps.cpp      2019-11-06 21:03:22 UTC (rev 
74310)
@@ -1854,6 +1854,7 @@
     int f_id2 = 
s_cdt_edge->brep->m_T[eseg->tseg2->trim_ind].Face()->m_face_index;
     cdt_mesh::cdt_mesh_t &fmesh_f1 = s_cdt_edge->fmeshes[f_id1];
     cdt_mesh::cdt_mesh_t &fmesh_f2 = s_cdt_edge->fmeshes[f_id2];
+
     // Translate the tseg verts to their parent indices in order to get
     // valid triangle lookups
     cdt_mesh::cpolyedge_t *pe1 = eseg->tseg1;
@@ -1860,12 +1861,16 @@
     cdt_mesh::cpolyedge_t *pe2 = eseg->tseg2;
     cdt_mesh::cpolygon_t *poly1 = pe1->polygon;
     cdt_mesh::cpolygon_t *poly2 = pe2->polygon;
-    cdt_mesh::uedge_t ue1(poly1->p2o[eseg->tseg1->v[0]], 
poly1->p2o[eseg->tseg1->v[1]]);
-    cdt_mesh::uedge_t ue2(poly2->p2o[eseg->tseg2->v[0]], 
poly2->p2o[eseg->tseg2->v[1]]);
-    fmesh_f1.brep_edges.erase(ue1); 
-    fmesh_f2.brep_edges.erase(ue2); 
-    fmesh_f1.ue2b_map.erase(ue1); 
-    fmesh_f2.ue2b_map.erase(ue2); 
+    long ue1_1 = fmesh_f1.p2d3d[poly1->p2o[eseg->tseg1->v[0]]];
+    long ue1_2 = fmesh_f1.p2d3d[poly1->p2o[eseg->tseg1->v[1]]];
+    cdt_mesh::uedge_t ue1(ue1_1, ue1_2);
+    long ue2_1 = fmesh_f2.p2d3d[poly2->p2o[eseg->tseg2->v[0]]];
+    long ue2_2 = fmesh_f2.p2d3d[poly2->p2o[eseg->tseg2->v[1]]];
+    cdt_mesh::uedge_t ue2(ue2_1, ue2_2);
+    fmesh_f1.brep_edges.erase(ue1);
+    fmesh_f2.brep_edges.erase(ue2);
+    fmesh_f1.ue2b_map.erase(ue1);
+    fmesh_f2.ue2b_map.erase(ue2);
     //ON_3dPoint ue1_p1 = *fmesh_f1.pnts[ue1.v[0]];
     //ON_3dPoint ue1_p2 = *fmesh_f1.pnts[ue1.v[1]];
     //std::cout << f_id1 << " ue1: " << ue1.v[0] << "," << ue1.v[1] << ": " << 
ue1_p1.x << "," << ue1_p1.y << "," << ue1_p1.z << " -> " << ue1_p2.x << "," << 
ue1_p2.y << "," << ue1_p2.z << "\n";
@@ -1883,11 +1888,6 @@
        std::cerr << "SPLIT FAILED!\n";
        return -1;
     }
-    if (!fmesh_f1.valid(1) || !fmesh_f2.valid(1)) {
-       fmesh_f1.boundary_edges_plot("fmesh_f1_bedges.plot3");
-       fmesh_f2.boundary_edges_plot("fmesh_f2_bedges.plot3");
-       bu_exit(1, "split broke mesh!\n");
-    }
 
     if (nsegs) {
        (*nsegs).insert(esegs_split.begin(), esegs_split.end());
@@ -1909,14 +1909,18 @@
        cdt_mesh::cpolyedge_t *pe_2 = es->tseg2;
        cdt_mesh::cpolygon_t *poly_1 = pe_1->polygon;
        cdt_mesh::cpolygon_t *poly_2 = pe_2->polygon;
-       cdt_mesh::uedge_t ue_1(poly_1->p2o[es->tseg1->v[0]], 
poly_1->p2o[es->tseg1->v[1]]);
-       cdt_mesh::uedge_t ue_2(poly_2->p2o[es->tseg2->v[0]], 
poly_2->p2o[es->tseg2->v[1]]);
-       f1.brep_edges.insert(ue_1); 
-       f2.brep_edges.insert(ue_2); 
+       long nue1_1 = fmesh_f1.p2d3d[poly_1->p2o[es->tseg1->v[0]]];
+       long nue1_2 = fmesh_f1.p2d3d[poly_1->p2o[es->tseg1->v[1]]];
+       cdt_mesh::uedge_t ue_1(nue1_1, nue1_2);
+       long nue2_1 = fmesh_f2.p2d3d[poly_2->p2o[es->tseg2->v[0]]];
+       long nue2_2 = fmesh_f2.p2d3d[poly_2->p2o[es->tseg2->v[1]]];
+       cdt_mesh::uedge_t ue_2(nue2_1, nue2_2);
+       f1.brep_edges.insert(ue_1);
+       f2.brep_edges.insert(ue_2);
        f1_new_ue.insert(ue_1);
        f2_new_ue.insert(ue_2);
-       f1.ue2b_map[ue_1] = es; 
-       f2.ue2b_map[ue_2] = es; 
+       f1.ue2b_map[ue_1] = es;
+       f2.ue2b_map[ue_2] = es;
     }
 
     // Need to return one of the inserted verts from this process - we need to
@@ -1991,6 +1995,7 @@
        int f_id1 = 
s_cdt_edge->brep->m_T[eseg->tseg1->trim_ind].Face()->m_face_index;
        int f_id2 = 
s_cdt_edge->brep->m_T[eseg->tseg2->trim_ind].Face()->m_face_index;
 #endif
+
        int rtris = ovlp_split_edge(nsegs, nverts, eseg, t, f2omap);
        if (rtris >= 0) {
            replaced_tris += rtris;

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