Revision: 73892
http://sourceforge.net/p/brlcad/code/73892
Author: starseeker
Date: 2019-09-11 19:06:35 +0000 (Wed, 11 Sep 2019)
Log Message:
-----------
We need to jitter the surface points from the trims to bump them out of
colinearity, just like we need to do for the main surface sampling.
Modified Paths:
--------------
brlcad/trunk/src/libbrep/cdt_surf.cpp
Modified: brlcad/trunk/src/libbrep/cdt_surf.cpp
===================================================================
--- brlcad/trunk/src/libbrep/cdt_surf.cpp 2019-09-11 18:41:15 UTC (rev
73891)
+++ brlcad/trunk/src/libbrep/cdt_surf.cpp 2019-09-11 19:06:35 UTC (rev
73892)
@@ -485,6 +485,8 @@
// triangles.
std::vector<cdt_mesh::cpolyedge_t *> ws = cdt_face_polyedges(s_cdt,
face.m_face_index);
std::vector<cdt_mesh::cpolyedge_t *>::iterator w_it;
+ float *prand;
+ bn_rand_init(prand, 0);
for (w_it = ws.begin(); w_it != ws.end(); w_it++) {
cdt_mesh::cpolyedge_t *tseg = *w_it;
if (!tseg->defines_spnt) continue;
@@ -495,21 +497,25 @@
a_context.cseg = tseg;
a_context.use = &include_pnt;
+ double dlen = tseg->bb.Diagonal().Length();
+ dlen = 0.01 * dlen;
+ double px = tseg->spnt.x + (bn_rand_half(prand) * dlen);
+ double py = tseg->spnt.y + (bn_rand_half(prand) * dlen);
+
double tMin[2];
- tMin[0] = tseg->spnt.x - ON_ZERO_TOLERANCE;
- tMin[1] = tseg->spnt.y - ON_ZERO_TOLERANCE;
+ tMin[0] = px - ON_ZERO_TOLERANCE;
+ tMin[1] = py - ON_ZERO_TOLERANCE;
double tMax[2];
- tMax[0] = tseg->spnt.x + ON_ZERO_TOLERANCE;
- tMax[1] = tseg->spnt.y + ON_ZERO_TOLERANCE;
+ tMax[0] = px + ON_ZERO_TOLERANCE;
+ tMax[1] = py + ON_ZERO_TOLERANCE;
s_cdt->face_rtrees_2d[face.m_face_index].Search(tMin, tMax,
UseTrimPntCallback, (void *)&a_context);
- if (!include_pnt) {
- std::cout << "Reject\n";
- } else {
- std::cout << "Accept\n";
+ if (include_pnt) {
+ //std::cout << "Accept\n";
sinfo->rtree_trim_spnts_2d.Insert(tMin, tMax, (void *)tseg);
- sinfo->on_surf_points.insert(new ON_2dPoint(tseg->spnt));
+
+ sinfo->on_surf_points.insert(new ON_2dPoint(px, py));
}
}
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