Stellarium  0.16.1
List of all members | Public Types | Public Member Functions | Public Attributes
AABBox Class Reference

An axis-aligned bounding-box class. More...

#include <GeomMath.hpp>

+ Collaboration diagram for AABBox:

Public Types

enum  Corner {
  MinMinMin = 0, MaxMinMin, MaxMaxMin, MinMaxMin,
  MinMinMax, MaxMinMax, MaxMaxMax, MinMaxMax,
  CORNERCOUNT
}
 Identifies a corner of the AABB. More...
 
enum  Face {
  Front = 0, Back, Bottom, Top,
  Left, Right, FACECOUNT
}
 Identifies a face of the AABB. More...
 

Public Member Functions

 AABBox ()
 Creates an AABBox with minimum vertex set to infinity and maximum vertex set to -infinity. More...
 
 AABBox (const Vec3f &min, const Vec3f &max)
 Creates an AABBox with the specified minimum and maximum extents. More...
 
void expand (const Vec3f &vec)
 Updates the bounding box to include the specified vertex. More...
 
void expand (const AABBox &box)
 Updates the bounding box to include the specified other AABB. More...
 
void reset ()
 Resets minimum to infinity and maximum to -infinity (equivalent to creating a new AABBox with the default constructor) More...
 
bool isValid () const
 Returns true when each component of the minimum extents is smaller than the corresponding component of the maximum extents. More...
 
float getVolume () const
 Returns the volume of the bounding box. More...
 
Vec3f getCorner (AABBox::Corner corner) const
 Returns the coordinates of the specified corner of the AABB. More...
 
Vec4f getPlane (AABBox::Face p) const
 Return the plane equation in the general form for the specified face of the AABB as Vec4f. More...
 
Vec3f positiveVertex (Vec3f &normal) const
 Returns a Vec3f that for each component either: More...
 
Vec3f negativeVertex (Vec3f &normal) const
 Returns a Vec3f that for each component either: More...
 

Public Attributes

Vec3f min
 The minimal extents of the box. More...
 
Vec3f max
 The maximal extents of the box. More...
 

Detailed Description

An axis-aligned bounding-box class.

Definition at line 31 of file GeomMath.hpp.

Member Enumeration Documentation

Identifies a corner of the AABB.

Definition at line 35 of file GeomMath.hpp.

Identifies a face of the AABB.

Definition at line 43 of file GeomMath.hpp.

Constructor & Destructor Documentation

AABBox::AABBox ( )

Creates an AABBox with minimum vertex set to infinity and maximum vertex set to -infinity.

AABBox::AABBox ( const Vec3f min,
const Vec3f max 
)

Creates an AABBox with the specified minimum and maximum extents.

Member Function Documentation

void AABBox::expand ( const Vec3f vec)

Updates the bounding box to include the specified vertex.

void AABBox::expand ( const AABBox box)

Updates the bounding box to include the specified other AABB.

Vec3f AABBox::getCorner ( AABBox::Corner  corner) const

Returns the coordinates of the specified corner of the AABB.

Vec4f AABBox::getPlane ( AABBox::Face  p) const

Return the plane equation in the general form for the specified face of the AABB as Vec4f.

float AABBox::getVolume ( ) const

Returns the volume of the bounding box.

bool AABBox::isValid ( ) const

Returns true when each component of the minimum extents is smaller than the corresponding component of the maximum extents.

This allows to detect empty (or freshly created) boxes with negative volume, or AABBs with only a single vertex (where the minimum and maximum extents are the same).

Vec3f AABBox::negativeVertex ( Vec3f normal) const

Returns a Vec3f that for each component either:

  • returns the corresponding component of the maximum extents of the AABB if the component of the normal parameter is less than zero,
  • or the component of the minimum extents of the AABBox otherwise.
Vec3f AABBox::positiveVertex ( Vec3f normal) const

Returns a Vec3f that for each component either:

  • returns the corresponding component of the minimum extents of the AABB if the component of the normal parameter is less than zero,
  • or the component of the maximum extents of the AABBox otherwise.
void AABBox::reset ( )

Resets minimum to infinity and maximum to -infinity (equivalent to creating a new AABBox with the default constructor)

Member Data Documentation

Vec3f AABBox::max

The maximal extents of the box.

Definition at line 95 of file GeomMath.hpp.

Vec3f AABBox::min

The minimal extents of the box.

Definition at line 93 of file GeomMath.hpp.


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