mirror of
https://github.com/recp/cglm.git
synced 2025-12-24 12:32:40 +00:00
aabb box size and radius
This commit is contained in:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user