]> Dogcows Code - chaz/rasterize/blob - aabb.h
small change to readme file
[chaz/rasterize] / aabb.h
1
2 /*
3 * CS5600 University of Utah
4 * Charles McGarvey
5 * mcgarvey@eng.utah.edu
6 */
7
8 #ifndef _AABB_H_
9 #define _AABB_H_
10
11 #include "vec.h"
12
13
14 /*
15 * An axis-aligned bounding box.
16 */
17 struct aabb
18 {
19 vec_t min;
20 vec_t max;
21 };
22 typedef struct aabb aabb_t;
23
24 /*
25 * Initialize a axis-aligned bounding box.
26 */
27 INLINE_MAYBE
28 void aabb_init(aabb_t* b, vec_t min, vec_t max)
29 {
30 b->min = min;
31 b->max = max;
32 }
33
34
35 /*
36 * Create a new axis-aligned bounding box.
37 */
38 INLINE_MAYBE
39 aabb_t aabb_new(vec_t min, vec_t max)
40 {
41 aabb_t b;
42 aabb_init(&b, min, max);
43 return b;
44 }
45
46 #define AABB_UNIT aabb_new(vec_new(S(-0.5), S(-0.5), S(-0.5)), \
47 vec_new(S( 0.5), S( 0.5), S( 0.5)))
48
49
50 #endif // _AABB_H_
51
This page took 0.03348 seconds and 4 git commands to generate.