Revision: 73883
http://sourceforge.net/p/brlcad/code/73883
Author: starseeker
Date: 2019-09-10 18:35:28 +0000 (Tue, 10 Sep 2019)
Log Message:
-----------
Stash local information about how far away neighbor points are in 2D
Modified Paths:
--------------
brlcad/trunk/src/libbrep/cdt.cpp
brlcad/trunk/src/libbrep/cdt.h
brlcad/trunk/src/libbrep/cdt_edge.cpp
brlcad/trunk/src/libbrep/cdt_mesh.h
brlcad/trunk/src/libbrep/cdt_surf.cpp
Modified: brlcad/trunk/src/libbrep/cdt.cpp
===================================================================
--- brlcad/trunk/src/libbrep/cdt.cpp 2019-09-10 17:45:32 UTC (rev 73882)
+++ brlcad/trunk/src/libbrep/cdt.cpp 2019-09-10 18:35:28 UTC (rev 73883)
@@ -203,7 +203,7 @@
// Sample the surface, independent of the trimming curves, to get points
that
// will tie the mesh to the interior surface.
- //GetInteriorPoints(s_cdt, face.m_face_index);
+ GetInteriorPoints(s_cdt, face.m_face_index);
cdt_mesh::cdt_mesh_t *fmesh = &s_cdt->fmeshes[face.m_face_index];
fmesh->f_id = face.m_face_index;
@@ -654,6 +654,9 @@
finalize_2d_rtrees(s_cdt);
+ // Calculate 2D neighbor distances for polyedges
+ cpolyedge_nearest_dists(s_cdt);
+
#if 0
for (int index = 0; index < brep->m_F.Count(); index++) {
struct bu_vls fname = BU_VLS_INIT_ZERO;
Modified: brlcad/trunk/src/libbrep/cdt.h
===================================================================
--- brlcad/trunk/src/libbrep/cdt.h 2019-09-10 17:45:32 UTC (rev 73882)
+++ brlcad/trunk/src/libbrep/cdt.h 2019-09-10 18:35:28 UTC (rev 73883)
@@ -176,6 +176,7 @@
void tol_linear_edges_split(struct ON_Brep_CDT_State *s_cdt);
void refine_near_loops(struct ON_Brep_CDT_State *s_cdt);
void finalize_2d_rtrees(struct ON_Brep_CDT_State *s_cdt);
+void cpolyedge_nearest_dists(struct ON_Brep_CDT_State *s_cdt);
void plot_rtree_2d(ON_RTree *rtree, const char *filename);
void plot_rtree_2d2(RTree<void *, double, 2> &rtree, const char *filename);
Modified: brlcad/trunk/src/libbrep/cdt_edge.cpp
===================================================================
--- brlcad/trunk/src/libbrep/cdt_edge.cpp 2019-09-10 17:45:32 UTC (rev
73882)
+++ brlcad/trunk/src/libbrep/cdt_edge.cpp 2019-09-10 18:35:28 UTC (rev
73883)
@@ -1719,6 +1719,64 @@
}
}
+void
+cpolyedge_ndists(cdt_mesh::cpolyedge_t *pe) {
+ ON_2dPoint p2d1(pe->polygon->pnts_2d[pe->v[0]].first,
pe->polygon->pnts_2d[pe->v[0]].second);
+ ON_2dPoint p2d2(pe->polygon->pnts_2d[pe->v[1]].first,
pe->polygon->pnts_2d[pe->v[1]].second);
+
+ ON_2dPoint p2d1_n(pe->polygon->pnts_2d[pe->prev->v[0]].first,
pe->polygon->pnts_2d[pe->prev->v[0]].second);
+ ON_2dPoint p2d2_n(pe->polygon->pnts_2d[pe->next->v[1]].first,
pe->polygon->pnts_2d[pe->next->v[1]].second);
+
+ pe->v1_dist = p2d1.DistanceTo(p2d1_n);
+ pe->v2_dist = p2d2.DistanceTo(p2d2_n);
+}
+
+void
+cpolyedge_nearest_dists(struct ON_Brep_CDT_State *s_cdt)
+{
+ ON_Brep* brep = s_cdt->brep;
+ for (int face_index = 0; face_index < brep->m_F.Count(); face_index++) {
+ 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;
+
+ int loop_cnt = face.LoopCount();
+ for (int li = 0; li < loop_cnt; li++) {
+ const ON_BrepLoop *loop = face.Loop(li);
+ bool is_outer = (face.OuterLoop()->m_loop_index ==
loop->m_loop_index) ? true : false;
+ cdt_mesh::cpolygon_t *cpoly = NULL;
+ if (is_outer) {
+ cpoly = &fmesh->outer_loop;
+ } else {
+ cpoly = fmesh->inner_loops[li];
+ }
+
+ size_t ecnt = 1;
+ cdt_mesh::cpolyedge_t *pe = (*cpoly->poly.begin());
+ cdt_mesh::cpolyedge_t *first = pe;
+ cdt_mesh::cpolyedge_t *next = pe->next;
+
+ cpolyedge_ndists(first);
+
+ // Walk the loop
+ while (first != next) {
+ ecnt++;
+ if (!next) break;
+ cpolyedge_ndists(next);
+ next = next->next;
+ if (ecnt > cpoly->poly.size()) {
+ std::cerr << "\nrefine_close_edges: ERROR! encountered
infinite loop\n";
+ return;
+ }
+ }
+ }
+ }
+}
+
/** @} */
// Local Variables:
Modified: brlcad/trunk/src/libbrep/cdt_mesh.h
===================================================================
--- brlcad/trunk/src/libbrep/cdt_mesh.h 2019-09-10 17:45:32 UTC (rev 73882)
+++ brlcad/trunk/src/libbrep/cdt_mesh.h 2019-09-10 18:35:28 UTC (rev 73883)
@@ -303,6 +303,8 @@
double trim_start;
double trim_end;
int split_status;
+ double v1_dist;
+ double v2_dist;
bedge_seg_t *eseg;
};
Modified: brlcad/trunk/src/libbrep/cdt_surf.cpp
===================================================================
--- brlcad/trunk/src/libbrep/cdt_surf.cpp 2019-09-10 17:45:32 UTC (rev
73882)
+++ brlcad/trunk/src/libbrep/cdt_surf.cpp 2019-09-10 18:35:28 UTC (rev
73883)
@@ -633,33 +633,15 @@
double p2[2];
p2[0] = bb.Max().x;
p2[1] = bb.Max().y;
+
+ sp.plot("current_patch.plot3");
// Do the search
- if (sinfo->rtree_2d->Search(p1, p2, NULL, NULL)) {
+ size_t tcnt = sinfo->rtree_2d->Search(p1, p2, NULL, NULL);
+ if (tcnt) {
// We have trims involved.
-
- // Check the inside/outside status of the four corners of the patch.
- //
- // 1. If all four are outside the outer loop, no further processing is
- // needed.
- //
- // 2. If all four are inside an inner loop, no further processing is
needed.
- //
- // 3. If we have some points inside and some outside, split in u and v.
- //
- // 4. If the spatch is untrimmed, check if the patch bbox is fully
within
- // any trim bbox. If it is, unless that trim is unsatisfied (i.e. it
has
- // no associated surface patch which can provide an appropriate point)
no
- // further processing is required. If trim is unsatisfied, list as a
- // candidate.
- //
- //
- // 5. If not fully within a trim bbox, check the distance of the center
point
- // of the patch to the center point of each associated trim and compare
it
- // to that trim's distance to it's closest neighbor. If it is closer
than
- // than distance to all associated trims, it can satisfy those trims for
- // tessellation. If it can't satisfy one or more associated trims,
split.
-
+ split_u = 1;
+ split_v = 1;
} else {
// If there are no overlapping trims, we're free to consider this patch
on
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