Revision: 74311
http://sourceforge.net/p/brlcad/code/74311
Author: starseeker
Date: 2019-11-07 14:36:22 +0000 (Thu, 07 Nov 2019)
Log Message:
-----------
If we're doing an interior processing step but the point ends up at a brep face
edge, skip - we'll just end up making degenerate triangles doing this.
Modified Paths:
--------------
brlcad/trunk/src/libbrep/cdt_mesh.cpp
brlcad/trunk/src/libbrep/cdt_mesh.h
brlcad/trunk/src/libbrep/cdt_ovlps.cpp
Modified: brlcad/trunk/src/libbrep/cdt_mesh.cpp
===================================================================
--- brlcad/trunk/src/libbrep/cdt_mesh.cpp 2019-11-06 21:03:22 UTC (rev
74310)
+++ brlcad/trunk/src/libbrep/cdt_mesh.cpp 2019-11-07 14:36:22 UTC (rev
74311)
@@ -1800,6 +1800,21 @@
return uedges;
}
+std::set<uedge_t>
+cdt_mesh_t::b_uedges(const triangle_t &t)
+{
+ std::set<uedge_t> b_ue;
+ std::set<uedge_t> ue = uedges(t);
+ std::set<uedge_t>::iterator u_it;
+ for (u_it = ue.begin(); u_it != ue.end(); u_it++) {
+ if (brep_edges.find(*u_it) != brep_edges.end()) {
+ b_ue.insert(*u_it);
+ }
+ }
+
+ return b_ue;
+}
+
bool
cdt_mesh_t::face_edge_tri(const triangle_t &t)
{
Modified: brlcad/trunk/src/libbrep/cdt_mesh.h
===================================================================
--- brlcad/trunk/src/libbrep/cdt_mesh.h 2019-11-06 21:03:22 UTC (rev 74310)
+++ brlcad/trunk/src/libbrep/cdt_mesh.h 2019-11-07 14:36:22 UTC (rev 74311)
@@ -513,6 +513,7 @@
ON_Plane tplane(const triangle_t &t);
ON_Plane bplane(const triangle_t &t);
std::set<uedge_t> uedges(const triangle_t &t);
+ std::set<uedge_t> b_uedges(const triangle_t &t);
bool face_edge_tri(const triangle_t &t);
Modified: brlcad/trunk/src/libbrep/cdt_ovlps.cpp
===================================================================
--- brlcad/trunk/src/libbrep/cdt_ovlps.cpp 2019-11-06 21:03:22 UTC (rev
74310)
+++ brlcad/trunk/src/libbrep/cdt_ovlps.cpp 2019-11-07 14:36:22 UTC (rev
74311)
@@ -609,8 +609,8 @@
overts[f3ind]->bb = *bb;
}
-#if 0
- ON_3dPoint problem(3.4781932643130933,7.5707323832445113,24);
+#if 1
+ ON_3dPoint
problem(2.5989674496614925,7.8208160252273471,23.158125750337142);
ON_3dPoint vp = *fmesh->pnts[f3ind];
if (vp.DistanceTo(problem) < 0.1) {
std::cout << "Adding trouble...\n";
@@ -1423,9 +1423,43 @@
if (skip_epnt) {
continue;
}
+ // If the point is too close to a brep face edge,
+ // we also need to reject it to avoid creating degenerate
+ // triangles
+ std::set<cdt_mesh::uedge_t>::iterator ue_it;
+ std::set<cdt_mesh::uedge_t> b_ue_1 = omesh->fmesh->b_uedges(tri1);
+ for (ue_it = b_ue_1.begin(); ue_it != b_ue_1.end(); ue_it++) {
+ cdt_mesh::uedge_t lue = *ue_it;
+ double epdist = omesh->fmesh->uedge_dist(lue, epnts[i].spnt);
+ ON_Line lline(*omesh->fmesh->pnts[lue.v[0]],
*omesh->fmesh->pnts[lue.v[1]]);
+ if (epdist < 0.001 * lline.Length()) {
+ std::cout << "Close to brep face edge\n";
+ skip_epnt = true;
+ break;
+ }
+ }
+ if (skip_epnt) {
+ continue;
+ }
+ std::set<cdt_mesh::uedge_t> b_ue_2 = omesh->fmesh->b_uedges(tri2);
+ for (ue_it = b_ue_2.begin(); ue_it != b_ue_2.end(); ue_it++) {
+ cdt_mesh::uedge_t lue = *ue_it;
+ double epdist = omesh->fmesh->uedge_dist(lue, epnts[i].spnt);
+ ON_Line lline(*omesh->fmesh->pnts[lue.v[0]],
*omesh->fmesh->pnts[lue.v[1]]);
+ if (epdist < 0.001 * lline.Length()) {
+ std::cout << "Close to brep face edge\n";
+ skip_epnt = true;
+ break;
+ }
+ }
+ if (skip_epnt) {
+ continue;
+ }
bool inside = false;
{
+ // Use the overt point for this - the closest surface point will
+ // always pass, so it's not usable for rejection.
ON_3dPoint ovpnt = epnts[i].ov->vpnt();
double u, v;
fit_plane.ClosestPointTo(ovpnt, &u, &v);
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