Graphics Reference
In-Depth Information
(a)
(b)
(c)
Figure 4.3
The three common AABB representations: (a) min-max, (b) min-widths, and
(c) center-radius.
There are three common representations for AABBs (Figure 4.3). One is by the
minimum and maximum coordinate values along each axis:
// region R =
(x, y, z) | min.x<=x<=max.x, min.y<=y<=max.y, min.z<=z<=max.z
struct AABB {
Point min;
Point max;
};
This representation specifies the BV region of space as that between the two oppos-
ing corner points:
min
and
max
. Another representation is as the minimum corner
point
min
and the width or diameter extents
dx
,
dy
, and
dz
from this corner:
// region R =
(x, y, z) | min.x<=x<=min.x+dx, min.y<=y<=min.y+dy, min.z<=z<=min.z+dz
struct AABB {
Point min;
float d[3];
// diameter or width extents (dx, dy, dz)
};
The last representation specifies the AABB as a center point
C
and halfwidth
extents or radii
rx
,
ry
, and
rz
along its axes:
// region R =
(x, y, z) | |c.x-x|<=rx, |c.y-y|<=ry, |c.z-z|<=rz
struct AABB {
Point c;
// center point of AABB
float r[3];
// radius or halfwidth extents (rx, ry, rz)
};