aabb box size and radius

This commit is contained in:
Recep Aslantas
2018-04-02 16:26:14 +03:00
parent 86efe64b8e
commit dbd1e334ea

View File

@@ -177,4 +177,26 @@ glm_aabb_isvalid(vec3 box[2]) {
&& glm_vec_min(box[1]) != -FLT_MAX;
}
/*!
* @brief distance between of min and max
*
* @param[in] box bounding box
*/
CGLM_INLINE
float
glm_aabb_size(vec3 box[2]) {
return glm_vec_distance(box[0], box[1]);
}
/*!
* @brief radius of sphere which surrounds AABB
*
* @param[in] box bounding box
*/
CGLM_INLINE
float
glm_aabb_radius(vec3 box[2]) {
return glm_aabb_size(box) * 0.5f;
}
#endif /* cglm_box_h */