Revision: 74181
http://sourceforge.net/p/brlcad/code/74181
Author: starseeker
Date: 2019-10-19 13:13:25 +0000 (Sat, 19 Oct 2019)
Log Message:
-----------
Filter inside/outside on both faces in the interaction pair, not just one, and
visualize the p_mvert points to be considered for triangle splitting. Can see
visually we need to filter cases when the closest_surf_pnt is already an
existing vertex, and we definitely need to handle situations where the new
closest point is sitting on the edge between two triangles.
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-10-19 11:20:08 UTC (rev
74180)
+++ brlcad/trunk/src/libbrep/cdt_ovlps.cpp 2019-10-19 13:13:25 UTC (rev
74181)
@@ -1442,8 +1442,17 @@
bool deactivate;
};
+void plot_mvert_set(double r, std::set<struct p_mvert_info *> &pv)
+{
+ FILE *plot = fopen("mvert.plot3", "w");
+ pl_color(plot, 255, 0, 0);
+ std::set<struct p_mvert_info *>::iterator pm_it;
+ for (pm_it = pv.begin(); pm_it != pv.end(); pm_it++) {
+ plot_pnt_3d(plot, &((*pm_it)->p), r, 0);
+ }
+ fclose(plot);
+}
-
std::map<cdt_mesh::cdt_mesh_t *, std::set<struct p_mvert_info *>> *
get_intruding_points(std::set<std::pair<cdt_mesh::cdt_mesh_t *,
cdt_mesh::cdt_mesh_t *>> &check_pairs)
{
@@ -1486,9 +1495,6 @@
double dist = plane1.DistanceTo(tp);
if (dist < 0 && fabs(dist) > ON_ZERO_TOLERANCE) {
bool pinside = fmesh1->point_inside(&tp);
- // TODO - this is backwards of what I would
expect, but the other way
- // increases the overlapping triangles... did I
flip the test somehow?
- // Need to print out some point sets...
if (pinside) {
std::cout << "test point inside\n";
//std::cout << "face " << fmesh1->f_id << "
new interior point from face " << fmesh2->f_id << ": " << tp.x << "," << tp.y
<< "," << tp.z << "\n";
@@ -1506,6 +1512,8 @@
bb.m_min.y = bb.m_min.y - t1_longest;
bb.m_min.z = bb.m_min.z - t1_longest;
np->bb = bb;
+ // TODO - check if this point is too close
to an existing vert
+ // point to insert. If so, tweak the vert
point to match this point
(*face_npnts)[fmesh1].insert(np);
added_verts[fmesh1].insert(std::make_pair(fmesh2, t2.v[i]));
} else {
@@ -1521,22 +1529,29 @@
double dist = plane2.DistanceTo(tp);
if (dist < 0 && fabs(dist) > ON_ZERO_TOLERANCE) {
//std::cout << "face " << fmesh2->f_id << " new
interior point from face " << fmesh1->f_id << ": " << tp.x << "," << tp.y <<
"," << tp.z << "\n";
- struct p_mvert_info *np = new struct
p_mvert_info;
- np->s_cdt = s_cdt2;
- np->f_id = fmesh2->f_id;
- np->edge_split_only = false;
- np->deactivate = false;
- closest_surf_pnt(np->p, np->n, *fmesh2, &tp,
2*t2_longest);
- ON_BoundingBox bb(np->p, np->p);
- bb.m_max.x = bb.m_max.x + t2_longest;
- bb.m_max.y = bb.m_max.y + t2_longest;
- bb.m_max.z = bb.m_max.z + t2_longest;
- bb.m_min.x = bb.m_min.x - t2_longest;
- bb.m_min.y = bb.m_min.y - t2_longest;
- bb.m_min.z = bb.m_min.z - t2_longest;
- np->bb = bb;
- (*face_npnts)[fmesh2].insert(np);
-
added_verts[fmesh2].insert(std::make_pair(fmesh1, t1.v[i]));
+ bool pinside = fmesh2->point_inside(&tp);
+ if (pinside) {
+ struct p_mvert_info *np = new struct
p_mvert_info;
+ np->s_cdt = s_cdt2;
+ np->f_id = fmesh2->f_id;
+ np->edge_split_only = false;
+ np->deactivate = false;
+ closest_surf_pnt(np->p, np->n, *fmesh2,
&tp, 2*t2_longest);
+ ON_BoundingBox bb(np->p, np->p);
+ bb.m_max.x = bb.m_max.x + t2_longest;
+ bb.m_max.y = bb.m_max.y + t2_longest;
+ bb.m_max.z = bb.m_max.z + t2_longest;
+ bb.m_min.x = bb.m_min.x - t2_longest;
+ bb.m_min.y = bb.m_min.y - t2_longest;
+ bb.m_min.z = bb.m_min.z - t2_longest;
+ np->bb = bb;
+ // TODO - check if this point is too close
to an existing vert
+ // point to insert. If so, tweak the vert
point to match this point
+ (*face_npnts)[fmesh2].insert(np);
+
added_verts[fmesh2].insert(std::make_pair(fmesh1, t1.v[i]));
+ } else {
+ std::cout << "test point outside\n";
+ }
}
}
}
@@ -1892,10 +1907,14 @@
for (f_it = face_npnts->begin(); f_it != face_npnts->end(); f_it++) {
cdt_mesh::cdt_mesh_t *fmesh = f_it->first;
struct ON_Brep_CDT_State *s_cdt = (struct ON_Brep_CDT_State
*)fmesh->p_cdt;
+ std::cout << "Refining " << s_cdt->name << " face " << fmesh->f_id << "
with " << f_it->second.size() << " points.\n";
std::set<struct p_mvert_info *>::iterator pm_it;
std::map<long, std::set<struct p_mvert_info *>> tri_npnts;
+ fmesh->tris_plot("face.plot3");
+ plot_mvert_set(0.1,f_it->second);
+
for (pm_it = f_it->second.begin(); pm_it != f_it->second.end();
pm_it++) {
struct p_mvert_info *pmv = *pm_it;
@@ -1938,7 +1957,7 @@
}
point_type = (ptype > point_type) ? ptype : point_type;
}
- //std::cout << "Point/tri characterization: " << point_type << "\n";
+ std::cout << "Point/tri characterization: " << point_type << "\n";
// Plot point and neighborhood triangles
struct bu_vls fname = BU_VLS_INIT_ZERO;
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