Box given by its min- and max- corners. More...
#include <MRBox.h>
Public Types | |
using | VTraits = VectorTraits<V> |
using | T = typename VTraits::BaseType |
using | Vb = typename VTraits::template ChangeBaseType<bool> |
using | VbTraits = VectorTraits<Vb> |
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 | |
V | center () const |
computes center of the box | |
V | corner (const Vb &c) const |
V | 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 | |
V | 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 | |
Box & | intersect (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) |
static Vb | getMinBoxCorner (const V &n) |
Public Attributes | |
V | min |
V | max |
Static Public Attributes | |
static constexpr int | elements = VTraits::size |
Box given by its min- and max- corners.
using MR::Box< V >::T = typename VTraits::BaseType |
using MR::Box< V >::Vb = typename VTraits::template ChangeBaseType<bool> |
using MR::Box< V >::VbTraits = VectorTraits<Vb> |
using MR::Box< V >::VTraits = VectorTraits<V> |
|
inline |
create invalid box by default
|
inline |
|
inlineexplicit |
skip initialization of min/max
|
inlineexplicit |
|
inline |
computes center of the box
|
inline |
checks whether given point is inside (including the surface) of the box
returns the corner of this box as specified by given bool-vector: 1 element in (c) means take min's coordinate, 0 element in (c) means take max's coordinate
decreases min and increased max on given value
|
inlinestatic |
|
inline |
returns closest point in the box to given point
returns squared distance between this box and given one; returns zero if the boxes touch or intersect
returns squared distance between this box and given point; returns zero if the point is inside or on the boundary of the box
considering all planes with given normal and arbitrary shift: dot(n,x) = d finds the box's corner for which d is minimal
minimally increases the box to include another box
|
inline |
minimally increases the box to include given point
decreases min and increases max to their closest representable value
computes intersection between this and other box
checks whether this box intersects or touches given box
|
inline |
|
inline |
min/max access by 0/1 index
|
inline |
computes size of the box in all dimensions
|
inline |
true if the box contains at least one point
|
staticconstexpr |
V MR::Box< V >::max |
V MR::Box< V >::min |