Worldstone
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
WorldStone::AABB< T > Struct Template Reference

Axis-Aligned Bounding Box. More...

#include <AABB.h>

Public Member Functions

width () const
 
height () const
 
void maximize ()
 
void initializeForExtension ()
 
void extend (const AABB &other)
 

Static Public Member Functions

static constexpr AABB getInitializedForExtension ()
 Used to initialize before computing the bounding box of objects. More...
 

Public Attributes

xLower
 x lower bound : excluded
 
yLower
 y lower bound : excluded
 
xUpper
 x upper bound : excluded
 
yUpper
 y upper bound : excluded
 

Detailed Description

template<typename T>
struct WorldStone::AABB< T >

Axis-Aligned Bounding Box.

Template Parameters
TThe type to use for the positions
Note
The members were named lower/upper in opposition to min/max so that we can use the same code for both integers and float. For integers width = xMax - xMin + 1 as 'max' means included while for floats width = xMax - xMin. (This is basicly the difference between counting pixels and the distance between the pixels) As Upper means the bound is excluded, the data (and user) is responsible for handling this difference, not the class. An alternative would have been to store the width/height instead.

Definition at line 17 of file AABB.h.

Member Function Documentation

template<typename T>
static constexpr AABB WorldStone::AABB< T >::getInitializedForExtension ( )
inlinestatic

Used to initialize before computing the bounding box of objects.

Usage example:

extents.extend(someAABB); // Now equal to someAABB
extents.extend(otherAABB); // Now equal to the bounding box of someAABB and otherAABB
Note
The returned AABB is invalid unless you call extend or override its values.

Definition at line 54 of file AABB.h.


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