MinGfx Toolkit
1.0
A minimal library for writing cross-platform (Windows, OSX, linux) graphics programs.
|
A 3D axis-aligned bounding box defined by two corners (min and max).
AABBs can be added together using the + operator to make them grow to cover the extents of both boxes. Each box can also store a user_id (int), which can be used to associate the box with some other object in your program.
#include <aabb.h>
Public Member Functions | |
AABB () | |
Creates an empty box. More... | |
AABB (const Point3 &a) | |
Box that contains a single point. More... | |
AABB (const Point3 &a, const Point3 &b, const Point3 &c) | |
Box that contains a triangle defined by 3 points. More... | |
AABB (const Vector3 &extents) | |
Box centered at the origin with width, height, and depth specified by the vector. More... | |
AABB (const Point3 ¢er, const Vector3 &extents) | |
Box centered at the center with width, height, and depth specified by the vector. More... | |
AABB (const Mesh &mesh) | |
Box that contains a whole mesh. More... | |
AABB (const Mesh &mesh, unsigned int tri_id) | |
Box that contains just triangle number "tri_id" from the specified mesh. More... | |
virtual | ~AABB () |
Vector3 | Dimensions () const |
Returns the dimensions of the box in x, y, and z as a 3D vector. More... | |
float | Volume () const |
Returns the volume of the box or -1.0 when empty and 0.0 if the box contains just a single point. More... | |
Point3 | min () const |
Returns the coordinates for the minimum corner of the box. More... | |
Point3 | max () const |
Returns the coordinates for the maximum corner of the box. More... | |
void | set_user_data (int data) |
You can set this to whatever you want in order to use it as a handle into your own program. The intent is to make it possible for you to associate this AABB with the id of some object in your application. More... | |
int | user_data () |
You can set this to whatever you want in order to use it as a handle into your own program. The intent is to make it possible for you to associate this AABB with the id of some object in your application. More... | |
Friends | |
AABB | operator+ (const AABB &A, const AABB &B) |
mingfx::AABB::AABB | ( | ) |
Creates an empty box.
mingfx::AABB::AABB | ( | const Point3 & | a | ) |
Box that contains a single point.
Box that contains a triangle defined by 3 points.
mingfx::AABB::AABB | ( | const Vector3 & | extents | ) |
Box centered at the origin with width, height, and depth specified by the vector.
Box centered at the center with width, height, and depth specified by the vector.
mingfx::AABB::AABB | ( | const Mesh & | mesh | ) |
Box that contains a whole mesh.
mingfx::AABB::AABB | ( | const Mesh & | mesh, |
unsigned int | tri_id | ||
) |
Box that contains just triangle number "tri_id" from the specified mesh.
|
virtual |
Vector3 mingfx::AABB::Dimensions | ( | ) | const |
Returns the dimensions of the box in x, y, and z as a 3D vector.
Point3 mingfx::AABB::max | ( | ) | const |
Returns the coordinates for the maximum corner of the box.
Point3 mingfx::AABB::min | ( | ) | const |
Returns the coordinates for the minimum corner of the box.
void mingfx::AABB::set_user_data | ( | int | data | ) |
You can set this to whatever you want in order to use it as a handle into your own program. The intent is to make it possible for you to associate this AABB with the id of some object in your application.
int mingfx::AABB::user_data | ( | ) |
You can set this to whatever you want in order to use it as a handle into your own program. The intent is to make it possible for you to associate this AABB with the id of some object in your application.
float mingfx::AABB::Volume | ( | ) | const |
Returns the volume of the box or -1.0 when empty and 0.0 if the box contains just a single point.