MinGfx Toolkit  1.0
A minimal library for writing cross-platform (Windows, OSX, linux) graphics programs.
Public Member Functions | Friends | List of all members
mingfx::AABB Class Reference

Detailed Description

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.

Definition at line 31 of file aabb.h.

#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 &center, 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)
 

Constructor & Destructor Documentation

◆ AABB() [1/7]

mingfx::AABB::AABB ( )

Creates an empty box.

◆ AABB() [2/7]

mingfx::AABB::AABB ( const Point3 a)

Box that contains a single point.

◆ AABB() [3/7]

mingfx::AABB::AABB ( const Point3 a,
const Point3 b,
const Point3 c 
)

Box that contains a triangle defined by 3 points.

◆ AABB() [4/7]

mingfx::AABB::AABB ( const Vector3 extents)

Box centered at the origin with width, height, and depth specified by the vector.

◆ AABB() [5/7]

mingfx::AABB::AABB ( const Point3 center,
const Vector3 extents 
)

Box centered at the center with width, height, and depth specified by the vector.

◆ AABB() [6/7]

mingfx::AABB::AABB ( const Mesh mesh)

Box that contains a whole mesh.

◆ AABB() [7/7]

mingfx::AABB::AABB ( const Mesh mesh,
unsigned int  tri_id 
)

Box that contains just triangle number "tri_id" from the specified mesh.

◆ ~AABB()

virtual mingfx::AABB::~AABB ( )
virtual

Member Function Documentation

◆ Dimensions()

Vector3 mingfx::AABB::Dimensions ( ) const

Returns the dimensions of the box in x, y, and z as a 3D vector.

◆ max()

Point3 mingfx::AABB::max ( ) const

Returns the coordinates for the maximum corner of the box.

◆ min()

Point3 mingfx::AABB::min ( ) const

Returns the coordinates for the minimum corner of the box.

◆ set_user_data()

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.

◆ user_data()

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.

◆ Volume()

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.

Friends And Related Function Documentation

◆ operator+

AABB operator+ ( const AABB A,
const AABB B 
)
friend

The documentation for this class was generated from the following file: