From 86efe64b8ee3093f111b706ca17fba3a09e8a419 Mon Sep 17 00:00:00 2001 From: Recep Aslantas Date: Mon, 2 Apr 2018 12:35:22 +0300 Subject: [PATCH] helper for check aabb is valid or not --- include/cglm/box.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/cglm/box.h b/include/cglm/box.h index c8115a6..89ef5a9 100644 --- a/include/cglm/box.h +++ b/include/cglm/box.h @@ -165,4 +165,16 @@ glm_aabb_invalidate(vec3 box[2]) { glm_vec_broadcast(-FLT_MAX, box[1]); } +/*! + * @brief check if AABB is valid or not + * + * @param[in] box bounding box + */ +CGLM_INLINE +bool +glm_aabb_isvalid(vec3 box[2]) { + return glm_vec_max(box[0]) != FLT_MAX + && glm_vec_min(box[1]) != -FLT_MAX; +} + #endif /* cglm_box_h */