Revision: 73121
          http://sourceforge.net/p/brlcad/code/73121
Author:   brlcad
Date:     2019-05-22 01:44:11 +0000 (Wed, 22 May 2019)
Log Message:
-----------
this fixes an rtedge bug with occlusion objects.

exposed by the m35 regression test, case D, regression differences
were being caused due to occlusion objects being also in the main
geometry.  when we were determining whether a given point was
occluding our main geometry, we were hitting that same geometry and
finding it occluded (i.e., with itself).

as this determination involved firing another ray at a different
instance with different partitioning, the points could be exactly
equal or within floating point fuzz or at a completely different point
on the geometry if, for example, it were on a grazing edge.  this
reliably (Mac and Windows) resulted in differences with the case D
reference because it was also wrong.

this difference in occlusion determination explains why different
platforms produced different output on some edges of occlusion
objects.  the desired result when the geometry is in both sets is to
treat it as simply exposed (unoccluded geometry) with edges rendered.

this fix makes an assumption that hit points within our typical
distance tolerance are, in fact, the same point and thus probably the
same geometry.  while this is not necessarily true as there could be a
sub-tolerance-thin surface or overlapping geometry cases to consider,
they are close enough to be considered coincident and avoid extra
processing.  we could check and make sure the regions or regionIDs are
also identical, but thus far that has not been demonstrated necessary.

Modified Paths:
--------------
    brlcad/trunk/src/rt/viewedge.c

Modified: brlcad/trunk/src/rt/viewedge.c
===================================================================
--- brlcad/trunk/src/rt/viewedge.c      2019-05-21 20:43:06 UTC (rev 73120)
+++ brlcad/trunk/src/rt/viewedge.c      2019-05-22 01:44:11 UTC (rev 73121)
@@ -322,9 +322,14 @@
        return 2;
     }
 
-    if (occlusion_apps[cpu]->a_dist < here->c_dist) {
-       /*
-        * The second geometry is close than the edge, therefore it is
+    if (NEAR_EQUAL(occlusion_apps[cpu]->a_dist, here->c_dist, BN_TOL_DIST)) {
+       /* same hit point.  object is probably in first and second
+        * geometry sets.  it's not occluding itself, but we want an
+        * edge because it's in the first display set.
+        */
+       return 1;
+    } else if (        occlusion_apps[cpu]->a_dist < here->c_dist) {
+       /* second geometry is closer than the first, therefore it is
         * 'foreground'. Do not draw the edge.
         *
         * This pixel DOES NOT occlude the second geometry.
@@ -900,13 +905,13 @@
      *
      *    left      right
      * _____________________
-     * |0, 0 | AL | AR | 0, 3|  above
+     * |0 0 | AL | AR | 0 3|  above
      * |____|____|____|____|
      * | TL | UL | UR | TR |  top/upper
      * |____|____|____|____|
      * | BL | LL | LR | BR |  bottom/lower
      * |____|____|____|____|
-     * |3, 0 | DL | DR | 3, 3|  debajo
+     * |3 0 | DL | DR | 3 3|  debajo
      * |____|____|____|____|
      */
 
@@ -1312,9 +1317,11 @@
      * check on edges as well since right side and top edges are
      * actually misses.
      */
-    if (occlusion_mode != OCCLUSION_MODE_NONE)
-       if (me.c_ishit || edge)
+    if (occlusion_mode != OCCLUSION_MODE_NONE) {
+       if (me.c_ishit || edge) {
            oc = occludes(ap, &me);
+       }
+    }
 
     /*
      * Perverse Pixel Painting Paradigm(tm) If a pixel should be

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

Reply via email to