Antkeeper  0.0.1
Public Types | Public Member Functions | List of all members
geom::rect_pack< T > Class Template Reference

Packs 2D rectangles. More...

#include <rect-pack.hpp>

Public Types

using scalar_type = T
 Scalar type. More...
 
using node_type = rect_pack_node< T >
 Node type. More...
 

Public Member Functions

 rect_pack (scalar_type w, scalar_type h)
 Creates a rect pack and sets the bounds of the root node. More...
 
 rect_pack ()
 Creates an empty rect pack. More...
 
void resize (scalar_type w, scalar_type h)
 Clears the pack and resizes the root node bounds. More...
 
void clear ()
 Clear the pack, deallocating all nodes. More...
 
const node_typepack (scalar_type w, scalar_type h)
 Packs a rect into the rect pack. More...
 
const node_typeget_root () const
 Returns a reference to the root node. More...
 

Detailed Description

template<class T>
class geom::rect_pack< T >

Packs 2D rectangles.

See also
geom::rect_pack_node
http://www.blackpawn.com/texts/lightmaps/

Definition at line 60 of file rect-pack.hpp.

Member Typedef Documentation

◆ node_type

template<class T >
using geom::rect_pack< T >::node_type = rect_pack_node<T>

Node type.

Definition at line 67 of file rect-pack.hpp.

◆ scalar_type

template<class T >
using geom::rect_pack< T >::scalar_type = T

Scalar type.

Definition at line 64 of file rect-pack.hpp.

Constructor & Destructor Documentation

◆ rect_pack() [1/2]

template<class T >
geom::rect_pack< T >::rect_pack ( scalar_type  w,
scalar_type  h 
)

Creates a rect pack and sets the bounds of the root node.

Parameters
wWidth of the root node.
hHeight of the root node.

Definition at line 116 of file rect-pack.hpp.

◆ rect_pack() [2/2]

template<class T >
geom::rect_pack< T >::rect_pack

Creates an empty rect pack.

Definition at line 122 of file rect-pack.hpp.

Member Function Documentation

◆ clear()

template<class T >
void geom::rect_pack< T >::clear

Clear the pack, deallocating all nodes.

Definition at line 134 of file rect-pack.hpp.

◆ get_root()

template<class T >
const rect_pack< T >::node_type & geom::rect_pack< T >::get_root
inline

Returns a reference to the root node.

Definition at line 148 of file rect-pack.hpp.

◆ pack()

template<class T >
const rect_pack< T >::node_type * geom::rect_pack< T >::pack ( scalar_type  w,
scalar_type  h 
)

Packs a rect into the rect pack.

Parameters
wWidth of the rect.
hHeight of the rect.
Returns
Pointer to the node in which the rect was packed, or nullptr if the rect could not be packed.

Definition at line 142 of file rect-pack.hpp.

◆ resize()

template<class T >
void geom::rect_pack< T >::resize ( scalar_type  w,
scalar_type  h 
)

Clears the pack and resizes the root node bounds.

Parameters
wNew width of the root node.
hNew height of the root node.
See also
rect_pack::clear()

Definition at line 127 of file rect-pack.hpp.


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