NiHu  2.0
NiHu::fmm::bounding_box< Dim, Scalar > Class Template Reference

multidimensional square bounding box More...

#include <bounding_box.hpp>

Public Types

using scalar_t = Scalar
 template argument as nested type
 
using location_t = Eigen::Matrix< scalar_t, dimension, 1 >
 the location type in the bounding box
 

Public Member Functions

 bounding_box (location_t const &center=location_t::Zero(), scalar_t diameter=2.0)
 constructor from center and diameter More...
 
template<class NodesDerived >
 bounding_box (Eigen::DenseBase< NodesDerived > const &nodes)
 constructor from a set of contained nodes More...
 
const location_tget_center (void) const
 return center More...
 
void set_center (location_t const &c)
 set the center More...
 
scalar_t get_diameter (void) const
 return diameter More...
 
void set_diameter (scalar_t const &d)
 set the diameter More...
 
bounding_box get_child (size_t idx) const
 get a child box More...
 
bool is_adjacent (bounding_box const &other, double tol=1e-3) const
 determine if a box is adjacent More...
 
void print_debug (std::ostream &os=std::cout) const
 print debug information to an output stream More...
 

Static Public Member Functions

static unsigned dist2idx (location_t const &child, location_t const &parent)
 convert parent-to-child direction to child index More...
 
static location_t idx2dist (size_t idx)
 convert child index to parent-to-child direction More...
 

Static Public Attributes

static const size_t dimension = Dim
 template parameter as nested constant
 

Detailed Description

template<size_t Dim, class Scalar = double>
class NiHu::fmm::bounding_box< Dim, Scalar >

multidimensional square bounding box

Template Parameters
Dimthe space dimension
Scalarscalar type of coordinates

A bounding_box is a squared box aligned to the coordinate directions, defined by a center and a diameter. bounding_box is the main building block component of the fmm cluster and the cluster_tree.

Definition at line 30 of file bounding_box.hpp.

Constructor & Destructor Documentation

◆ bounding_box() [1/2]

template<size_t Dim, class Scalar = double>
NiHu::fmm::bounding_box< Dim, Scalar >::bounding_box ( location_t const &  center = location_t::Zero(),
scalar_t  diameter = 2.0 
)
inline

constructor from center and diameter

Parameters
[in]centerthe box center
[in]diameterthe box diameter (edge length)

Definition at line 44 of file bounding_box.hpp.

◆ bounding_box() [2/2]

template<size_t Dim, class Scalar = double>
template<class NodesDerived >
NiHu::fmm::bounding_box< Dim, Scalar >::bounding_box ( Eigen::DenseBase< NodesDerived > const &  nodes)
inlineexplicit

constructor from a set of contained nodes

Template Parameters
NodesDerivedEigen derived class of Nodes
Parameters
[in]nodesmatrix containing the enclosed nodes in its columns

The bounding_box is composed so that tightly wraps all the nodes.

Definition at line 60 of file bounding_box.hpp.

Member Function Documentation

◆ dist2idx()

template<size_t Dim, class Scalar = double>
static unsigned NiHu::fmm::bounding_box< Dim, Scalar >::dist2idx ( location_t const &  child,
location_t const &  parent 
)
inlinestatic

convert parent-to-child direction to child index

Parameters
[in]childlocation of the child
[in]parentlocation of the parent
Returns
child index

Definition at line 139 of file bounding_box.hpp.

◆ get_center()

template<size_t Dim, class Scalar = double>
const location_t& NiHu::fmm::bounding_box< Dim, Scalar >::get_center ( void  ) const
inline

return center

Returns
center

Definition at line 75 of file bounding_box.hpp.

◆ get_child()

template<size_t Dim, class Scalar = double>
bounding_box NiHu::fmm::bounding_box< Dim, Scalar >::get_child ( size_t  idx) const
inline

get a child box

Parameters
[in]idxthe child index
Returns
the specified child box

Definition at line 108 of file bounding_box.hpp.

◆ get_diameter()

template<size_t Dim, class Scalar = double>
scalar_t NiHu::fmm::bounding_box< Dim, Scalar >::get_diameter ( void  ) const
inline

return diameter

Returns
diameter

Definition at line 91 of file bounding_box.hpp.

◆ idx2dist()

template<size_t Dim, class Scalar = double>
static location_t NiHu::fmm::bounding_box< Dim, Scalar >::idx2dist ( size_t  idx)
inlinestatic

convert child index to parent-to-child direction

Parameters
[in]idxthe child index
Returns
parent-to-child unit direction vector

Definition at line 152 of file bounding_box.hpp.

◆ is_adjacent()

template<size_t Dim, class Scalar = double>
bool NiHu::fmm::bounding_box< Dim, Scalar >::is_adjacent ( bounding_box< Dim, Scalar > const &  other,
double  tol = 1e-3 
) const
inline

determine if a box is adjacent

Parameters
[in]otheran other bounding_box
[in]tolthe relative tolerance of distance measurement
[in](optional)relative tolerance for distance checking
Returns
true if the two are adjacent

Two boxes are adjacent if the distance of their centres is not larger than the sum of the diameters. This condition is checked for each coordinate direction.

Definition at line 124 of file bounding_box.hpp.

◆ print_debug()

template<size_t Dim, class Scalar = double>
void NiHu::fmm::bounding_box< Dim, Scalar >::print_debug ( std::ostream &  os = std::cout) const
inline

print debug information to an output stream

Parameters
[in]osthe output stream

Definition at line 166 of file bounding_box.hpp.

◆ set_center()

template<size_t Dim, class Scalar = double>
void NiHu::fmm::bounding_box< Dim, Scalar >::set_center ( location_t const &  c)
inline

set the center

Parameters
[in]cthe new center

Definition at line 83 of file bounding_box.hpp.

◆ set_diameter()

template<size_t Dim, class Scalar = double>
void NiHu::fmm::bounding_box< Dim, Scalar >::set_diameter ( scalar_t const &  d)
inline

set the diameter

Parameters
[in]dthe new diameter

Definition at line 99 of file bounding_box.hpp.


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