#include <AABox.h>
|
| AABox () |
|
| AABox (const Point3 &v) |
|
| AABox (const class Any &a) |
|
Any | toAny () const |
|
bool | isEmpty () const |
|
| AABox (const Point3 &low, const Point3 &high) |
|
AABox | operator* (float f) const |
|
AABox | operator/ (float f) const |
|
void | set (const Point3 &low, const Point3 &high) |
|
void | merge (const AABox &a) |
|
void | merge (const Point3 &a) |
|
void | merge (const class Box &b) |
|
void | serialize (class BinaryOutput &b) const |
|
void | deserialize (class BinaryInput &b) |
|
bool | isFinite () const |
|
const Point3 & | low () const |
|
const Point3 & | high () const |
|
Point3 | center () const |
|
Point3 | corner (int index) const |
|
float | extent (int a) const |
|
Vector3 | extent () const |
|
void | split (const Vector3::Axis &axis, float location, AABox &low, AABox &high) const |
|
bool | culledBy (const Array< Plane > &plane, int32 &cullingPlaneIndex, const uint32 testMask, uint32 &childMask) const |
|
bool | culledBy (const Array< Plane > &plane, int32 &cullingPlaneIndex=dummy, const uint32 testMask=0xFFFFFFFF) const |
|
bool | contains (const AABox &other) const |
|
bool | contains (const Point3 &point) const |
|
float | area () const |
|
float | volume () const |
|
Point3 | randomInteriorPoint () const |
|
Point3 | randomSurfacePoint () const |
|
bool | intersects (const AABox &other) const |
|
bool | intersects (const Sphere &other) const |
|
AABox | intersect (const AABox &other) const |
|
size_t | hashCode () const |
|
bool | operator== (const AABox &b) const |
|
bool | operator!= (const AABox &b) const |
|
AABox | operator+ (const Vector3 &v) const |
|
AABox | operator- (const Vector3 &v) const |
|
void | getBounds (AABox &out) const |
|
void | getBounds (Sphere &out) const |
|
Creates the empty bounds, i.e., an empty set of points.
float fnan()
Definition: g3dmath.cpp:82
Point3 hi
Definition: AABox.h:43
Point3 lo
Definition: AABox.h:40
Constructs a zero-volume AABox at v.
Point3 hi
Definition: AABox.h:43
Point3 lo
Definition: AABox.h:40
G3D::AABox::AABox |
( |
const class Any & |
a | ) |
|
|
explicit |
Assumes that low is less than or equal to high along each dimension. To have this automatically enforced, use AABox(low.min(high), low.max(high));
const Point3 & low() const
Definition: AABox.h:136
void set(const Point3 &low, const Point3 &high)
Definition: AABox.h:93
const Point3 & high() const
Definition: AABox.h:141
float G3D::AABox::area |
( |
| ) |
const |
|
inline |
260 Vector3 diag =
hi -
lo;
261 return 2.0f * (diag.x * diag.y + diag.y * diag.z + diag.x * diag.z);
Point3 hi
Definition: AABox.h:43
Point3 lo
Definition: AABox.h:40
bool isEmpty() const
Definition: AABox.h:67
Point3 G3D::AABox::center |
( |
| ) |
const |
|
inline |
Returns the centroid of the box (NaN if empty)
164 return (
lo +
hi) * 0.5;
Point3 hi
Definition: AABox.h:43
Point3 lo
Definition: AABox.h:40
less than or equal to containment
240 (other.hi.x <=
hi.
x) &&
241 (other.hi.y <=
hi.
y) &&
242 (other.hi.z <=
hi.
z) &&
243 (other.lo.x >=
lo.
x) &&
244 (other.lo.y >=
lo.
y) &&
245 (other.lo.z >=
lo.
z);
float x
Definition: Vector3.h:62
Point3 hi
Definition: AABox.h:43
float y
Definition: Vector3.h:62
float z
Definition: Vector3.h:62
Point3 lo
Definition: AABox.h:40
float x
Definition: Vector3.h:62
Point3 hi
Definition: AABox.h:43
float y
Definition: Vector3.h:62
float z
Definition: Vector3.h:62
Point3 lo
Definition: AABox.h:40
Vector3 G3D::AABox::corner |
( |
int |
index | ) |
const |
float x
Definition: Vector3.h:62
Point3 hi
Definition: AABox.h:43
#define debugAssertM(exp, message)
Definition: debugAssert.h:161
float y
Definition: Vector3.h:62
float z
Definition: Vector3.h:62
Point3 lo
Definition: AABox.h:40
Conservative culling test for up to 32 planes. Returns true if there exists a plane[p]
for which the entire object is in the negative half space (opposite the plane normal).
testMask
and childMask
are used for optimizing bounding volume hierarchies. The version of this method that produces childMask is slower than the version without; it should only be used for parent nodes.
- Parameters
-
cullingPlaneIndex | The index of the first plane for which the entire object is in the negative half-space. The function exits early when one plane is found. -1 when the function returns false (i.e. when no plane culls the whole object). |
testMask | If bit p is 0, the bounding volume automatically passes the culling test for plane[p] (i.e. it is known that the volume is entirely within the positive half space). The function must return false if testMask is 0 and test all planes when testMask is -1 (0xFFFFFFFF). |
childMask | Test mask for the children of this volume. |
Conservative culling test that does not produce a mask for children.
100 lo = b.readVector3();
101 hi = b.readVector3();
Point3 hi
Definition: AABox.h:43
Point3 lo
Definition: AABox.h:40
AABox()
Definition: AABox.h:48
float G3D::AABox::extent |
( |
int |
a | ) |
const |
|
inline |
Distance from corner(0) to the next corner along axis a.
177 return hi[a] -
lo[a];
Point3 hi
Definition: AABox.h:43
#define debugAssert(exp)
Definition: debugAssert.h:160
Point3 lo
Definition: AABox.h:40
bool isEmpty() const
Definition: AABox.h:67
Vector3 G3D::AABox::extent |
( |
| ) |
const |
|
inline |
Point3 hi
Definition: AABox.h:43
static const Vector3 & zero()
Definition: Vector3.cpp:119
Point3 lo
Definition: AABox.h:40
bool isEmpty() const
Definition: AABox.h:67
void G3D::AABox::getBounds |
( |
AABox & |
out | ) |
const |
|
inline |
void G3D::AABox::getBounds |
( |
Sphere & |
out | ) |
const |
float length() const
Definition: Vector3.h:751
Vector3 extent() const
Definition: AABox.h:181
Point3 center() const
Definition: AABox.h:163
size_t G3D::AABox::hashCode |
( |
| ) |
const |
|
inline |
Point3 hi
Definition: AABox.h:43
size_t hashCode() const
Definition: Vector3.cpp:155
Point3 lo
Definition: AABox.h:40
Returns not-a-number if empty
Point3 hi
Definition: AABox.h:43
AABox()
Definition: AABox.h:48
static const Vector3 & inf()
Definition: Vector3.cpp:124
Return the intersection of the two boxes
283 if (
isEmpty() || other.isEmpty()) {
290 if (H.x < L.x && H.y < L.y && H.z < L.z) {
Vector3 __fastcall max(const Vector3 &v) const
Definition: Vector3.h:794
Point3 hi
Definition: AABox.h:43
Vector3 __fastcall min(const Vector3 &v) const
Definition: Vector3.h:789
static const AABox & empty()
Definition: AABox.cpp:61
AABox()
Definition: AABox.h:48
Vector3 Point3
Definition: Vector3.h:820
Point3 lo
Definition: AABox.h:40
bool isEmpty() const
Definition: AABox.h:67
Returns true if there is any overlap
179 for (
int a = 0; a < 3; ++a) {
184 if ((
lo[a] > other.hi[a]) ||
185 (
hi[a] < other.lo[a])) {
Point3 hi
Definition: AABox.h:43
Point3 lo
Definition: AABox.h:40
Returns true if there is any overlap. [Jim] Arvo's algorithm from Graphics Gems II
350 for (
int i = 0; i < 3; ++i) {
351 if (sphere.center[i] <
lo[i]) {
352 d +=
square(sphere.center[i] -
lo[i]);
353 }
else if (sphere.center[i] >
hi[i]) {
354 d +=
square(sphere.center[i] -
hi[i]);
358 return d <=
square(sphere.radius);
Point3 hi
Definition: AABox.h:43
double square(double fValue)
Definition: g3dmath.h:698
Point3 lo
Definition: AABox.h:40
bool G3D::AABox::isEmpty |
( |
| ) |
const |
|
inline |
bool isNaN() const
Definition: Vector3.cpp:83
Point3 lo
Definition: AABox.h:40
bool G3D::AABox::isFinite |
( |
| ) |
const |
|
inline |
Point3 hi
Definition: AABox.h:43
bool isFinite() const
Definition: Vector3.h:652
Point3 lo
Definition: AABox.h:40
bool isEmpty() const
Definition: AABox.h:67
A large finite box. This is smaller than FLT_MAX because it leaves room to add boxes together.
static const Vector3 & minFinite()
Definition: Vector3.cpp:126
static const Vector3 & maxFinite()
Definition: Vector3.cpp:127
AABox()
Definition: AABox.h:48
Returns not-a-number if empty
Point3 lo
Definition: AABox.h:40
The largest possible finite box.
static const Vector3 & minFinite()
Definition: Vector3.cpp:126
static const Vector3 & maxFinite()
Definition: Vector3.cpp:127
AABox()
Definition: AABox.h:48
Grows to include the bounds of a
110 }
else if (! a.isEmpty()) {
Vector3 __fastcall max(const Vector3 &v) const
Definition: Vector3.h:794
Point3 hi
Definition: AABox.h:43
Vector3 __fastcall min(const Vector3 &v) const
Definition: Vector3.h:789
Point3 lo
Definition: AABox.h:40
bool isEmpty() const
Definition: AABox.h:67
Vector3 __fastcall max(const Vector3 &v) const
Definition: Vector3.h:794
Point3 hi
Definition: AABox.h:43
Vector3 __fastcall min(const Vector3 &v) const
Definition: Vector3.h:789
Point3 lo
Definition: AABox.h:40
bool isEmpty() const
Definition: AABox.h:67
void G3D::AABox::merge |
( |
const class Box & |
b | ) |
|
313 return !((
lo == b.lo) && (
hi == b.hi));
Point3 hi
Definition: AABox.h:43
Point3 lo
Definition: AABox.h:40
bool isEmpty() const
Definition: AABox.h:67
AABox G3D::AABox::operator* |
( |
float |
f | ) |
const |
|
inline |
Point3 hi
Definition: AABox.h:43
AABox()
Definition: AABox.h:48
Point3 lo
Definition: AABox.h:40
Point3 hi
Definition: AABox.h:43
AABox()
Definition: AABox.h:48
Point3 lo
Definition: AABox.h:40
Point3 hi
Definition: AABox.h:43
AABox()
Definition: AABox.h:48
Point3 lo
Definition: AABox.h:40
AABox G3D::AABox::operator/ |
( |
float |
f | ) |
const |
|
inline |
88 return *
this * (1.0f / f);
302 if (
isEmpty() && b.isEmpty()) {
305 return (
lo == b.lo) && (
hi == b.hi);
Point3 hi
Definition: AABox.h:43
Point3 lo
Definition: AABox.h:40
bool isEmpty() const
Definition: AABox.h:67
Vector3 G3D::AABox::randomInteriorPoint |
( |
| ) |
const |
float x
Definition: Vector3.h:62
Point3 hi
Definition: AABox.h:43
float y
Definition: Vector3.h:62
float uniformRandom(float low=0.0f, float hi=1.0f)
Definition: g3dmath.h:694
float z
Definition: Vector3.h:62
Point3 lo
Definition: AABox.h:40
Vector3 G3D::AABox::randomSurfacePoint |
( |
| ) |
const |
131 float aXY = extent.
x * extent.y;
132 float aYZ = extent.y * extent.z;
133 float aZX = extent.z * extent.x;
149 }
else if (r < aYZ) {
float x
Definition: Vector3.h:62
Point3 hi
Definition: AABox.h:43
float uniformRandom(float low=0.0f, float hi=1.0f)
Definition: g3dmath.h:694
Vector3 extent() const
Definition: AABox.h:181
Point3 lo
Definition: AABox.h:40
Point3 hi
Definition: AABox.h:43
Point3 lo
Definition: AABox.h:40
Assumes that low is less than or equal to high along each dimension.
float x
Definition: Vector3.h:62
Point3 hi
Definition: AABox.h:43
const Point3 & low() const
Definition: AABox.h:136
float y
Definition: Vector3.h:62
#define debugAssert(exp)
Definition: debugAssert.h:160
float z
Definition: Vector3.h:62
const Point3 & high() const
Definition: AABox.h:141
bool isNaN() const
Definition: Vector3.cpp:83
Point3 lo
Definition: AABox.h:40
Splits the box into two AABoxes along the specified axis. low contains the part that was closer to negative infinity along axis, high contains the other part. Either may have zero volume.
Point3 hi
Definition: AABox.h:43
const Point3 & low() const
Definition: AABox.h:136
T max(const T &x, const T &y)
Definition: g3dmath.h:320
T min(const T &x, const T &y)
Definition: g3dmath.h:305
const Point3 & high() const
Definition: AABox.h:141
Point3 lo
Definition: AABox.h:40
Any G3D::AABox::toAny |
( |
| ) |
const |
bool isFinite() const
Definition: AABox.h:131
Point3 hi
Definition: AABox.h:43
Point3 lo
Definition: AABox.h:40
bool isEmpty() const
Definition: AABox.h:67
float G3D::AABox::volume |
( |
| ) |
const |
|
inline |
266 Vector3 diag =
hi -
lo;
267 return diag.
x * diag.y * diag.z;
float x
Definition: Vector3.h:62
Point3 hi
Definition: AABox.h:43
Point3 lo
Definition: AABox.h:40
bool isEmpty() const
Definition: AABox.h:67
static const Vector3 & zero()
Definition: Vector3.cpp:119
AABox()
Definition: AABox.h:48
int G3D::AABox::dummy = 0 |
|
staticprivate |
Optional argument placeholder
The documentation for this class was generated from the following files: