Revision: 73894
http://sourceforge.net/p/brlcad/code/73894
Author: starseeker
Date: 2019-09-11 20:23:46 +0000 (Wed, 11 Sep 2019)
Log Message:
-----------
If we run into edge triangles that are flipped, just flip them - if things can
be sorted out, it will be with interior faces.
Modified Paths:
--------------
brlcad/trunk/src/libbrep/cdt_edge.cpp
brlcad/trunk/src/libbrep/cdt_mesh.cpp
Modified: brlcad/trunk/src/libbrep/cdt_edge.cpp
===================================================================
--- brlcad/trunk/src/libbrep/cdt_edge.cpp 2019-09-11 19:15:31 UTC (rev
73893)
+++ brlcad/trunk/src/libbrep/cdt_edge.cpp 2019-09-11 20:23:46 UTC (rev
73894)
@@ -1700,7 +1700,6 @@
ON_BrepFace &face = s_cdt->brep->m_F[face_index];
s_cdt->face_rtrees_2d[face.m_face_index].RemoveAll();
cdt_mesh::cdt_mesh_t *fmesh = &s_cdt->fmeshes[face.m_face_index];
- std::cout << "Face " << face.m_face_index << " final 2D rtree
build...\n";
std::vector<cdt_mesh::cpolyedge_t *> ws;
std::vector<cdt_mesh::cpolyedge_t *>::iterator w_it;
Modified: brlcad/trunk/src/libbrep/cdt_mesh.cpp
===================================================================
--- brlcad/trunk/src/libbrep/cdt_mesh.cpp 2019-09-11 19:15:31 UTC (rev
73893)
+++ brlcad/trunk/src/libbrep/cdt_mesh.cpp 2019-09-11 20:23:46 UTC (rev
73894)
@@ -1509,9 +1509,10 @@
std::vector<triangle_t>
cdt_mesh_t::interior_incorrect_normals()
{
- std::vector<triangle_t> results;
+ std::set<triangle_t>::iterator tr_it;
- std::set<triangle_t>::iterator tr_it;
+ std::set<triangle_t> flip_tris;
+
for (tr_it = this->tris.begin(); tr_it != this->tris.end(); tr_it++) {
ON_3dVector tdir = this->tnorm(*tr_it);
ON_3dVector bdir = this->bnorm(*tr_it);
@@ -1521,7 +1522,9 @@
epnt_cnt = (ep.find((*tr_it).v[i]) == ep.end()) ? epnt_cnt :
epnt_cnt + 1;
}
if (epnt_cnt == 2) {
- std::cerr << "UNCULLED problem point from surface???????:\n";
+ // We're on the edge of the face - just flip this
+ flip_tris.insert(*tr_it);
+#if 0
for (int i = 0; i < 3; i++) {
if (ep.find((*tr_it).v[i]) == ep.end()) {
ON_3dPoint *p = pnts[(*tr_it).v[i]];
@@ -1528,9 +1531,29 @@
std::cerr << "(" << (*tr_it).v[i] << "): " << p->x << "
" << p->y << " " << p->z << "\n";
}
}
- results.clear();
- return results;
+#endif
}
+ }
+ }
+
+ for (tr_it = flip_tris.begin(); tr_it != flip_tris.end(); tr_it++) {
+ triangle_t t = *tr_it;
+ tris.erase(t);
+ long tmp = t.v[1];
+ t.v[1] = t.v[2];
+ t.v[2] = tmp;
+ tris.insert(t);
+ std::cerr << "Repairing flipped edge triangle\n";
+ }
+ if (flip_tris.size()) {
+ update_problem_edges();
+ }
+
+ std::vector<triangle_t> results;
+ for (tr_it = this->tris.begin(); tr_it != this->tris.end(); tr_it++) {
+ ON_3dVector tdir = this->tnorm(*tr_it);
+ ON_3dVector bdir = this->bnorm(*tr_it);
+ if (tdir.Length() > 0 && bdir.Length() > 0 && ON_DotProduct(tdir, bdir)
< 0.1) {
results.push_back(*tr_it);
}
}
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