Revision: 73844
http://sourceforge.net/p/brlcad/code/73844
Author: starseeker
Date: 2019-09-06 13:40:06 +0000 (Fri, 06 Sep 2019)
Log Message:
-----------
Split curved edges an additional time so we don't end up with square circles.
Interestingly, with NIST2 this one refinement introduces a need for repairs to
a number of faces, not due to a topologically invalid output but rather due to
triangles on the edges that end up at right angles to the face. That situation
was originally observed in sparse sampling and has a much higher probability in
this testing (since surface point sampling is currently off) than in normal
mesh sampling, but at least for NIST2 the repair logic appears able to deal
with it even working only with edge points.
Modified Paths:
--------------
brlcad/trunk/src/libbrep/cdt.cpp
Modified: brlcad/trunk/src/libbrep/cdt.cpp
===================================================================
--- brlcad/trunk/src/libbrep/cdt.cpp 2019-09-06 13:12:00 UTC (rev 73843)
+++ brlcad/trunk/src/libbrep/cdt.cpp 2019-09-06 13:40:06 UTC (rev 73844)
@@ -866,7 +866,8 @@
if (trim1->IsClosed() || trim2->IsClosed()) {
esegs_closed = split_edge_seg(s_cdt, e, 1);
if (!esegs_closed.size()) {
- // split failed??
+ // split failed?? On a closed edge this is fatal - we must split it
+ // to work with it at all
return false;
}
} else {
@@ -881,12 +882,28 @@
if (!crv->IsLinear(BN_TOL_DIST)) {
std::set<cdt_mesh::bedge_seg_t *>::iterator e_it;
for (e_it = esegs_closed.begin(); e_it != esegs_closed.end(); e_it++) {
- std::set<cdt_mesh::bedge_seg_t *> etmp = split_edge_seg(s_cdt,
*e_it, 1);
- if (!etmp.size()) {
- // split failed??
+ std::set<cdt_mesh::bedge_seg_t *> efirst = split_edge_seg(s_cdt,
*e_it, 1);
+ if (!efirst.size()) {
+ // split failed?? On a curved edge we must split at least once
to
+ // avoid potentially degenerate polygons (if we had to split a
closed
+ // loop from step 1, for example;
return false;
+ } else {
+ // To avoid representing circles with squares, split curved
segments
+ // one additional time
+ std::set<cdt_mesh::bedge_seg_t *>::iterator s_it;
+ for (s_it = efirst.begin(); s_it != efirst.end(); s_it++) {
+ std::set<cdt_mesh::bedge_seg_t *> etmp =
split_edge_seg(s_cdt, *s_it, 1);
+ if (!etmp.size()) {
+ // split failed?? This isn't good and shouldn't
+ // happen, but it's not fatal the way the previous two
+ // failure cases are...
+ esegs_csplit.insert(*s_it);
+ } else {
+ esegs_csplit.insert(etmp.begin(), etmp.end());
+ }
+ }
}
- esegs_csplit.insert(etmp.begin(), etmp.end());
}
} else {
esegs_csplit = esegs_closed;
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