Revision: 72001 http://sourceforge.net/p/brlcad/code/72001 Author: starseeker Date: 2018-11-09 21:20:43 +0000 (Fri, 09 Nov 2018) Log Message: ----------- This is a dangerous change, and will need extensive testing, but getting a case where the near miss resolving logic is ending up with a single near-miss point surviving in the middle of the hit points along a ray. Need to get a better sense of why this is happening, but an immediately obvious thing to do is be more agressive about stripping out a NM point when we have an odd point count. I suspect there are other dragons lurking here - this may be part of the problem we sometimes have with odd results along grazing tangent rays, for example - and we may need something more generally sophisticated here that factors in matters such as angles between hit normals and ray directions when voting which points to keep or ignore.
Modified Paths: -------------- brlcad/trunk/src/librt/primitives/brep/brep.cpp Modified: brlcad/trunk/src/librt/primitives/brep/brep.cpp =================================================================== --- brlcad/trunk/src/librt/primitives/brep/brep.cpp 2018-11-09 21:10:27 UTC (rev 72000) +++ brlcad/trunk/src/librt/primitives/brep/brep.cpp 2018-11-09 21:20:43 UTC (rev 72001) @@ -1468,7 +1468,7 @@ } /* If we've got an odd number of hits, try tossing out a near-miss hit. Try the last and first - * hits. */ + * hits first, and if neither of those qualify see if there's an interior hit. */ if (!hits.empty() && ((hits.size() % 2) != 0)) { const brep_hit &curr_hit = hits.back(); @@ -1478,9 +1478,12 @@ } if (!hits.empty() && ((hits.size() % 2) != 0)) { - const brep_hit &curr_hit = hits.front(); - if (curr_hit.hit == brep_hit::NEAR_MISS) { - hits.pop_front(); + for (std::list<brep_hit>::iterator i = hits.begin(); i != hits.end(); ++i) { + const brep_hit &h = *i; + if (h.hit == brep_hit::NEAR_MISS) { + hits.erase(i); + break; + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ BRL-CAD Source Commits mailing list brlcad-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/brlcad-commits