MeshLib Documentation
Loading...
Searching...
No Matches
MR::Box< V > Struct Template Reference

Box given by its min- and max- corners. More...

#include <MRBox.h>

Public Types

using VTraits = VectorTraits<V>
 
using T = typename VTraits::BaseType
 

Public Member Functions

const V & operator[] (int e) const
 min/max access by 0/1 index
 
V & operator[] (int e)
 
 Box ()
 create invalid box by default
 
 Box (const V &min, const V &max)
 
template<typename VV = V, typename std::enable_if_t< VectorTraits< VV >::supportNoInit, int > = 0>
 Box (NoInit)
 skip initialization of min/max
 
template<typename VV = V, typename std::enable_if_t<!VectorTraits< VV >::supportNoInit, int > = 0>
 Box (NoInit)
 
template<typename U >
 Box (const Box< U > &a)
 
bool valid () const
 true if the box contains at least one point
 
center () const
 computes center of the box
 
size () const
 computes size of the box in all dimensions
 
T diagonal () const
 computes length from min to max
 
T volume () const
 computes the volume of this box
 
void include (const V &pt)
 minimally increases the box to include given point
 
void include (const Box &b)
 minimally increases the box to include another box
 
bool contains (const V &pt) const
 checks whether given point is inside (including the surface) of the box
 
getBoxClosestPointTo (const V &pt) const
 returns closest point in the box to given point
 
bool intersects (const Box &b) const
 checks whether this box intersects or touches given box
 
Box intersection (const Box &b) const
 computes intersection between this and other box
 
Boxintersect (const Box &b)
 
T getDistanceSq (const Box &b) const
 
T getDistanceSq (const V &pt) const
 
Box expanded (const V &expansion) const
 decreases min and increased max on given value
 
Box insignificantlyExpanded () const
 decreases min and increases max to their closest representable value
 
bool operator== (const Box &a) const
 
bool operator!= (const Box &a) const
 

Static Public Member Functions

static Box fromMinAndSize (const V &min, const V &size)
 

Public Attributes

min
 
max
 

Static Public Attributes

static constexpr int elements = VTraits::size
 

Detailed Description

template<typename V>
struct MR::Box< V >

Box given by its min- and max- corners.

Member Typedef Documentation

◆ T

template<typename V >
using MR::Box< V >::T = typename VTraits::BaseType

◆ VTraits

template<typename V >
using MR::Box< V >::VTraits = VectorTraits<V>

Constructor & Destructor Documentation

◆ Box() [1/5]

template<typename V >
MR::Box< V >::Box ( )
inline

create invalid box by default

◆ Box() [2/5]

template<typename V >
MR::Box< V >::Box ( const V & min,
const V & max )
inline

◆ Box() [3/5]

template<typename V >
template<typename VV = V, typename std::enable_if_t< VectorTraits< VV >::supportNoInit, int > = 0>
MR::Box< V >::Box ( NoInit )
inlineexplicit

skip initialization of min/max

◆ Box() [4/5]

template<typename V >
template<typename VV = V, typename std::enable_if_t<!VectorTraits< VV >::supportNoInit, int > = 0>
MR::Box< V >::Box ( NoInit )
inlineexplicit

◆ Box() [5/5]

template<typename V >
template<typename U >
MR::Box< V >::Box ( const Box< U > & a)
inlineexplicit

Member Function Documentation

◆ center()

template<typename V >
V MR::Box< V >::center ( ) const
inline

computes center of the box

◆ contains()

template<typename V >
bool MR::Box< V >::contains ( const V & pt) const
inline

checks whether given point is inside (including the surface) of the box

◆ diagonal()

template<typename V >
T MR::Box< V >::diagonal ( ) const
inline

computes length from min to max

◆ expanded()

template<typename V >
Box MR::Box< V >::expanded ( const V & expansion) const
inline

decreases min and increased max on given value

◆ fromMinAndSize()

template<typename V >
static Box MR::Box< V >::fromMinAndSize ( const V & min,
const V & size )
inlinestatic

◆ getBoxClosestPointTo()

template<typename V >
V MR::Box< V >::getBoxClosestPointTo ( const V & pt) const
inline

returns closest point in the box to given point

◆ getDistanceSq() [1/2]

template<typename V >
T MR::Box< V >::getDistanceSq ( const Box< V > & b) const
inline

returns squared distance between this box and given one; returns zero if the boxes touch or intersect

◆ getDistanceSq() [2/2]

template<typename V >
T MR::Box< V >::getDistanceSq ( const V & pt) const
inline

returns squared distance between this box and given point; returns zero if the point is inside or on the boundary of the box

◆ include() [1/2]

template<typename V >
void MR::Box< V >::include ( const Box< V > & b)
inline

minimally increases the box to include another box

◆ include() [2/2]

template<typename V >
void MR::Box< V >::include ( const V & pt)
inline

minimally increases the box to include given point

◆ insignificantlyExpanded()

template<typename V >
Box MR::Box< V >::insignificantlyExpanded ( ) const
inline

decreases min and increases max to their closest representable value

◆ intersect()

template<typename V >
Box & MR::Box< V >::intersect ( const Box< V > & b)
inline

◆ intersection()

template<typename V >
Box MR::Box< V >::intersection ( const Box< V > & b) const
inline

computes intersection between this and other box

◆ intersects()

template<typename V >
bool MR::Box< V >::intersects ( const Box< V > & b) const
inline

checks whether this box intersects or touches given box

◆ operator!=()

template<typename V >
bool MR::Box< V >::operator!= ( const Box< V > & a) const
inline

◆ operator==()

template<typename V >
bool MR::Box< V >::operator== ( const Box< V > & a) const
inline

◆ operator[]() [1/2]

template<typename V >
V & MR::Box< V >::operator[] ( int e)
inline

◆ operator[]() [2/2]

template<typename V >
const V & MR::Box< V >::operator[] ( int e) const
inline

min/max access by 0/1 index

◆ size()

template<typename V >
V MR::Box< V >::size ( ) const
inline

computes size of the box in all dimensions

◆ valid()

template<typename V >
bool MR::Box< V >::valid ( ) const
inline

true if the box contains at least one point

◆ volume()

template<typename V >
T MR::Box< V >::volume ( ) const
inline

computes the volume of this box

Member Data Documentation

◆ elements

template<typename V >
int MR::Box< V >::elements = VTraits::size
staticconstexpr

◆ max

template<typename V >
V MR::Box< V >::max

◆ min

template<typename V >
V MR::Box< V >::min

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