]> git.tdb.fi Git - libs/math.git/commitdiff
Fix composite shape ray intersection logic
authorMikko Rasa <tdb@tdb.fi>
Mon, 17 Apr 2017 19:27:29 +0000 (22:27 +0300)
committerMikko Rasa <tdb@tdb.fi>
Mon, 17 Apr 2017 19:27:29 +0000 (22:27 +0300)
The test for start_nesting coalescence was written the wrong way, causing
intersection shapes to return spurious hits when the ray started inside
some part of the shape.  Presumably union shapes did not return hits in
some cases when they should.

source/geometry/compositeshape.h

index 0f1dd437c99eee065de8d9720f05ce2573d1a90b..e9aeadcfe73df68657fab07473d15a6fba2f25a6 100644 (file)
@@ -181,7 +181,7 @@ inline unsigned CompositeShape<T, D, O>::get_intersections(const Ray<T, D> &ray,
                n = k;
 
                if(i!=shapes.begin())
-                       start_nesting = (start_nesting>!Ops::shortcircuit(false));
+                       start_nesting = (start_nesting>!Ops::shortcircuit(true));
        }
 
        if(buffer!=points)