Jimcpp 2.1.0
Jimcpp is a high-performance c++ graphics engine.
|
Axis aligned bounding box in 3d dimensional space. More...
#include <jimcpp/core/engine/aabbox3d.hpp>
Public Member Functions | |
aabbox3d () | |
Default Constructor. | |
aabbox3d (const vector3d< T > &min, const vector3d< T > &max) | |
Constructor with min edge and max edge. | |
aabbox3d (const vector3d< T > &init) | |
Constructor with only one point. | |
aabbox3d (T minx, T miny, T minz, T maxx, T maxy, T maxz) | |
Constructor with min edge and max edge as single values, not vectors. | |
bool | operator== (const aabbox3d< T > &other) const |
Equality operator. | |
bool | operator!= (const aabbox3d< T > &other) const |
Inequality operator. | |
void | reset (T x, T y, T z) |
Resets the bounding box to a one-point box. | |
void | reset (const aabbox3d< T > &initValue) |
Resets the bounding box. | |
void | reset (const vector3d< T > &initValue) |
Resets the bounding box to a one-point box. | |
void | addInternalPoint (const vector3d< T > &p) |
Adds a point to the bounding box. | |
void | addInternalBox (const aabbox3d< T > &b) |
Adds another bounding box. | |
void | addInternalPoint (T x, T y, T z) |
Adds a point to the bounding box. | |
vector3d< T > | getCenter () const |
Get center of the bounding box. | |
vector3d< T > | getExtent () const |
Get extent of the box (maximal distance of two points in the box) | |
T | getRadius () const |
Get radius of the bounding sphere. | |
bool | isEmpty () const |
Check if the box is empty. | |
T | getVolume () const |
Get the volume enclosed by the box in cubed units. | |
T | getArea () const |
Get the surface area of the box in squared units. | |
void | getEdges (vector3d< T > *edges) const |
Stores all 8 edges of the box into an array. | |
void | repair () |
Repairs the box. | |
bool | isValid () const |
aabbox3d< T > | getInterpolated (const aabbox3d< T > &other, f32 d) const |
Calculates a new interpolated bounding box. | |
bool | isPointInside (const vector3d< T > &p) const |
Determines if a point is within this box. | |
bool | isPointTotalInside (const vector3d< T > &p) const |
Determines if a point is within this box and not its borders. | |
bool | isFullInside (const aabbox3d< T > &other) const |
Check if this box is completely inside the 'other' box. | |
aabbox3d< T > | intersect (const aabbox3d< T > &other) const |
Returns the intersection of this box with another, if possible. | |
bool | intersectsWithBox (const aabbox3d< T > &other) const |
Determines if the axis-aligned box intersects with another axis-aligned box. | |
bool | intersectsWithLine (const line3d< T > &line) const |
Tests if the box intersects with a line. | |
bool | intersectsWithLine (const vector3d< T > &linemiddle, const vector3d< T > &linevect, T halflength) const |
Tests if the box intersects with a line. | |
EIntersectionRelation3D | classifyPlaneRelation (const plane3d< T > &plane) const |
Classifies a relation with a plane. | |
Public Attributes | |
vector3d< T > | MinEdge |
The near edge. | |
vector3d< T > | MaxEdge |
The far edge. | |
Axis aligned bounding box in 3d dimensional space.
Has some useful methods used with occlusion culling or clipping.
Adds another bounding box.
The box grows bigger, if the new box was outside of the box.
b | Other bounding box to add into this box. |
Adds a point to the bounding box.
The box grows bigger, if point was outside of the box.
p | Point to add into the box. |
Adds a point to the bounding box.
The box grows bigger, if point is outside of the box.
x | X coordinate of the point to add to this box. |
y | Y coordinate of the point to add to this box. |
z | Z coordinate of the point to add to this box. |
|
inline |
Classifies a relation with a plane.
plane | Plane to classify relation to. |
Get center of the bounding box.
Stores all 8 edges of the box into an array.
edges | Pointer to array of 8 edges. |
Get extent of the box (maximal distance of two points in the box)
|
inline |
Calculates a new interpolated bounding box.
d=0 returns other, d=1 returns this, all other values blend between the two boxes.
other | Other box to interpolate between |
d | Value between 0.0f and 1.0f. |
|
inline |
Get radius of the bounding sphere.
Determines if the axis-aligned box intersects with another axis-aligned box.
other | Other box to check a intersection with. |
Tests if the box intersects with a line.
line | Line to test intersection with. |
|
inline |
Tests if the box intersects with a line.
linemiddle | Center of the line. |
linevect | Vector of the line. |
halflength | Half length of the line. |
|
inline |
Check if the box is empty.
This means that there is no space between the min and max edge.
Check if this box is completely inside the 'other' box.
other | Other box to check against. |
Determines if a point is within this box.
Border is included (IS part of the box)!
p | Point to check. |
Determines if a point is within this box and not its borders.
Border is excluded (NOT part of the box)!
p | Point to check. |
|
inline |
Inequality operator.
other | box to compare with. |
|
inline |
Equality operator.
other | box to compare with. |
|
inline |
Repairs the box.
Necessary if for example MinEdge and MaxEdge are swapped.
Resets the bounding box.
initValue | New box to set this one to. |
Resets the bounding box to a one-point box.
initValue | New point. |
Resets the bounding box to a one-point box.
x | X coord of the point. |
y | Y coord of the point. |
z | Z coord of the point. |