diff options
Diffstat (limited to 'intern/cycles/util/util_boundbox.h')
-rw-r--r-- | intern/cycles/util/util_boundbox.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/intern/cycles/util/util_boundbox.h b/intern/cycles/util/util_boundbox.h index 369082af60a..a71e0399619 100644 --- a/intern/cycles/util/util_boundbox.h +++ b/intern/cycles/util/util_boundbox.h @@ -167,6 +167,15 @@ public: return result; } + + __forceinline bool intersects(const BoundBox& other) + { + float3 center_diff = center() - other.center(), + total_size = (size() + other.size()) * 0.5f; + return fabsf(center_diff.x) <= total_size.x && + fabsf(center_diff.y) <= total_size.y && + fabsf(center_diff.z) <= total_size.z; + } }; __forceinline BoundBox merge(const BoundBox& bbox, const float3& pt) |