/* * CS5600 University of Utah * Charles McGarvey * mcgarvey@eng.utah.edu */ #ifndef _AABB_H_ #define _AABB_H_ #include "vec.h" /* * An axis-aligned bounding box. */ struct aabb { vec_t min; vec_t max; }; typedef struct aabb aabb_t; /* * Initialize a axis-aligned bounding box. */ INLINE_MAYBE void aabb_init(aabb_t* b, vec_t min, vec_t max) { b->min = min; b->max = max; } /* * Create a new axis-aligned bounding box. */ INLINE_MAYBE aabb_t aabb_new(vec_t min, vec_t max) { aabb_t b; aabb_init(&b, min, max); return b; } #define AABB_UNIT aabb_new(vec_new(S(-0.5), S(-0.5), S(-0.5)), \ vec_new(S( 0.5), S( 0.5), S( 0.5))) #endif // _AABB_H_